git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] [TOPGIT] make tg remote idempotent

From
Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date
Jan 14, 2009, 21:27 UTC
Message-ID
<1231968443-13960-1-git-send-email-u.kleine-koenig@pengutronix.de>

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@pengutronix.de>
---
 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
Next: Uwe Kleine-König
Message 1 of 7 in “[TOPGIT] make tg remote idempotent”
  1. [TOPGIT] make tg remote idempotentUwe Kleine-König, Jan 14, 2009
  2. [TOPGIT] make creating a commit from a topgit branch a functionUwe Kleine-König, Jan 14, 2009
  3. martin f krafftJan 21, 2009
  4. Uwe Kleine-KönigJan 21, 2009
  5. martin f krafftJan 22, 2009
  6. Uwe Kleine-KönigJan 21, 2009
  7. martin f krafftJan 21, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.