remote rename: warn when refspec was not updated
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Martin von Zweigbergk committed
Sep 3, 2011 at 11:26 UTC
1822b86a515af708e2259bae2b6a1f2052a2d3aa
1 file changed
+6
builtin/remote.c
+6
@@ -682,6 +682,12 @@ static int mv(int argc, const char **argv)
682
ptr-buf2.buf + strlen(":refs/remotes/"),
683
strlen(rename.old), rename.new,
684
strlen(rename.new));
685
+ else
686
+ warning("Not updating non-default fetch respec\n"
687
+ "\t%s\n"
688
+ "\tPlease update the configuration manually if necessary.",
689
+ buf2.buf);
690
+
691
if (git_config_set_multivar(buf.buf, buf2.buf, "^$", 0))
692
return error("Could not append '%s'", buf.buf);
693
}