branch.c: use the parsed branch name

When setting up tracking info, branch.c uses the given branch specifier
("name"). Use the parsed name ("ref.buf") instead so that

git branch --set-upstream @{-1} foo

sets up tracking info for the previous branch rather than for a branch
named "@{-1}".

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael J Gruber
2011-08-19 13:45:43 +02:00
committed by Junio C Hamano
parent ec099546a9
commit e9d4f7405b
2 changed files with 15 additions and 1 deletions

View File

@ -210,7 +210,7 @@ void create_branch(const char *head,
start_name);
if (real_ref && track)
setup_tracking(name, real_ref, track);
setup_tracking(ref.buf+11, real_ref, track);
if (!dont_change_ref)
if (write_ref_sha1(lock, sha1, msg) < 0)