X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=blobdiff_plain;f=tg-remote.sh;h=61774d7a0e28bf0131b1cb1f3851184bb1159c85;hp=3a40081b6b32435837c3b597ee4593f38e79de08;hb=120b1ea119b87b3ea292f0c2e2416540e790fcd1;hpb=7d934bdd48268f8134679185aab4b7bb5c5d2361 diff --git a/tg-remote.sh b/tg-remote.sh index 3a40081..61774d7 100644 --- a/tg-remote.sh +++ b/tg-remote.sh @@ -15,21 +15,29 @@ while [ -n "$1" ]; do --populate) populate=1;; -*) - echo "Usage: tg [...] remote [--populate] REMOTE" >&2 + echo "Usage: tg [...] remote [--populate] [REMOTE]" >&2 exit 1;; *) name="$arg";; esac done +[ -n "$name" ] || + name="$base_remote" + git config "remote.$name.url" >/dev/null || die "unknown remote '$name'" ## Configure the remote git config --replace-all "remote.$name.fetch" "+refs/top-bases/*:refs/remotes/$name/top-bases/*" "\\+refs/top-bases/\\*:refs/remotes/$name/top-bases/\\*" -git config --replace-all "remote.$name.push" "+refs/top-bases/*:refs/top-bases/*" "\\+refs/top-bases/\\*:refs/top-bases/\\*" -git config --replace-all "remote.$name.push" "+refs/heads/*:refs/heads/*" "\\+refs/heads/\\*:refs/heads/\\*" + +if git config --get-all "remote.$name.push" "\\+refs/top-bases/\\*:refs/top-bases/\\*" >/dev/null && test "xtrue" != "x$(git config --bool --get topgit.dontwarnonoldpushspecs)"; then + info "Probably you want to remove the push specs introduced by an old version of topgit:" + info ' git config --unset-all "remote.'$name'.push" "\\+refs/top-bases/\\*:refs/top-bases/\\*"' + info ' git config --unset-all "remote.'$name'.push" "\\+refs/heads/\\*:refs/heads/\\*"' + info '(or use git config --bool --add topgit.dontwarnonoldpushspecs true to get rid of this warning)' +fi info "Remote $name can now follow TopGit topic branches." if [ -z "$populate" ]; then