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

[PATCHv2 3/2] remote rename: warn when refspec was not updated

From
Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Date
Sep 3, 2011, 15:26 UTC
Message-ID
<1315063619-6072-1-git-send-email-martin.von.zweigbergk@gmail.com>
In-Reply-To
<20110902160333.GB19690@sigill.intra.peff.net>

When renaming a remote, we also try to update the fetch refspec accordingly, but only if it has the default format. For others, such as refs/heads/master:refs/heads/origin, we are conservative and leave it untouched. Let's give the user a warning about refspecs that are not updated, so he can manually update the config if necessary.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
---

This addresses the first part of your email. I'm not sure what should happen when only some refspecs can be updated. I can't think of any sensible examples with mixed default and non-default refspecs, so for me it's hard to see whether we would make things better or worse by making it all-or-nothing. I have more or less always used the default ones myself. Do you have any good examples?

 builtin/remote.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/builtin/remote.c b/builtin/remote.c
index 0df6ab0..61326cb 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -672,6 +672,12 @@ static int mv(int argc, const char **argv)
 				      ptr-buf2.buf + strlen(":refs/remotes/"),
 				      strlen(rename.old), rename.new,
 				      strlen(rename.new));
+		else
+			warning("Not updating non-default fetch respec\n"
+				"\t%s\n"
+				"\tPlease update the configuration manually if necessary.",
+				buf2.buf);
+
 		if (git_config_set_multivar(buf.buf, buf2.buf, "^$", 0))
 			return error("Could not append '%s'", buf.buf);
 	}
-- 
1.7.6.51.g07e0e
Previous: Jeff KingNext: Junio C Hamano
Message 4 of 10 in “[PATCHv2 1/2] remote: write correct fetch spec when renaming remote 'remote'”
  1. Martin von ZweigbergkSep 2, 2011
  2. 2/2 remote: "rename o foo" should not rename ref "origin/bar"Martin von Zweigbergk, Sep 2, 2011
  3. Jeff KingSep 2, 2011
  4. 3/2 remote rename: warn when refspec was not updatedMartin von Zweigbergk, Sep 3, 2011
  5. Junio C HamanoSep 6, 2011
  6. Martin von ZweigbergkSep 8, 2011
  7. Junio C HamanoSep 8, 2011
  8. Martin von ZweigbergkSep 8, 2011
  9. Junio C HamanoSep 8, 2011
  10. 4/2 remote: only update remote-tracking branch if updating refspecMartin von Zweigbergk, Sep 10, 2011

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.