[PATCH] [TOPGIT] make tg remote idempotent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Before this patch each call to tg remote added three config entries
no matter if they already existed.  After some time my .git/config was
crowded.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
 tg-remote.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tg-remote.sh b/tg-remote.sh
index c3e8bd3..7f7a1b0 100644
--- a/tg-remote.sh
+++ b/tg-remote.sh
@@ -27,9 +27,9 @@ 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/*"
+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/*"
 
 info "Remote $name can now follow TopGit topic branches."
 if [ -z "$populate" ]; then
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux