remote: "rename o foo" should not rename ref "origin/bar"

When renaming a remote called 'o' using 'git remote rename o foo', git
should also rename any remote-tracking branches for the remote. This
does happen, but any remote-tracking branches starting with
'refs/remotes/o', such as 'refs/remotes/origin/bar', will also be
renamed (to 'refs/remotes/foorigin/bar' in this case).

Fix it by simply matching one more character, up to the slash
following the remote name.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Martin von Zweigbergk
2011-09-01 20:50:34 -04:00
committed by Junio C Hamano
parent 28f555f635
commit 60e5eee0f1
2 changed files with 11 additions and 1 deletions

View File

@ -580,7 +580,7 @@ static int read_remote_branches(const char *refname,
unsigned char orig_sha1[20];
const char *symref;
strbuf_addf(&buf, "refs/remotes/%s", rename->old);
strbuf_addf(&buf, "refs/remotes/%s/", rename->old);
if (!prefixcmp(refname, buf.buf)) {
item = string_list_append(rename->remote_branches, xstrdup(refname));
symref = resolve_ref(refname, orig_sha1, 1, &flag);