Skip to content

Commit 1822b86

Browse files
Martin von Zweigbergkgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Martin von Zweigbergk <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 60e5eee commit 1822b86

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

builtin/remote.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,12 @@ static int mv(int argc, const char **argv)
682682
ptr-buf2.buf + strlen(":refs/remotes/"),
683683
strlen(rename.old), rename.new,
684684
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+
685691
if (git_config_set_multivar(buf.buf, buf2.buf, "^$", 0))
686692
return error("Could not append '%s'", buf.buf);
687693
}

0 commit comments

Comments
 (0)