Show interpreted branch name in error messages
Change the error message when doing: "git branch @{-1}", "git checkout -b @{-1}", or "git branch -m foo @{-1}" * was: A branch named '@{-1}' already exists. * now: A branch named 'bar' already exists. Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
55c4a67307
commit
587a9ee7da
2
branch.c
2
branch.c
@ -146,7 +146,7 @@ int validate_new_branchname(const char *name, struct strbuf *ref, int force)
|
||||
if (!ref_exists(ref->buf))
|
||||
return 0;
|
||||
else if (!force)
|
||||
die("A branch named '%s' already exists.", name);
|
||||
die("A branch named '%s' already exists.", ref->buf + strlen("refs/heads/"));
|
||||
|
||||
head = resolve_ref("HEAD", sha1, 0, NULL);
|
||||
if (!is_bare_repository() && head && !strcmp(head, ref->buf))
|
||||
|
Reference in New Issue
Block a user