X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=blobdiff_plain;f=tg-remote.sh;h=86dcd9a6ca213bfdc57f5122a557b959c8d2cd00;hp=dd3d66625ea6ffda0398f908599d1b7b5e0093d8;hb=81b2ec861034ac65909d3d9f578690fcac0c731b;hpb=4bf0ffdaa7d7f4ae21d50e72feb7372571971e10 diff --git a/tg-remote.sh b/tg-remote.sh index dd3d666..86dcd9a 100644 --- a/tg-remote.sh +++ b/tg-remote.sh @@ -15,7 +15,7 @@ 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";; @@ -27,9 +27,14 @@ git config "remote.$name.url" >/dev/null || die "unknown remote '$name'" ## Configure the remote -git config --add "remote.$name.fetch" "+refs/top-bases/*:refs/remotes/$name/top-bases/*" -git config --add "remote.$name.push" "+refs/top-bases/*:refs/top-bases/*" -git config --add "remote.$name.push" "+refs/heads/*:refs/heads/*" +git config --replace-all "remote.$name.fetch" "+refs/top-bases/*:refs/remotes/$name/top-bases/*" "\\+refs/top-bases/\\*:refs/remotes/$name/top-bases/\\*" + +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 @@ -59,3 +64,5 @@ git for-each-ref "refs/remotes/$name/top-bases" | git config "topgit.remote" "$name" info "The remote '$name' is now the default source of topic branches." + +# vim:noet