Code

branch: do not attempt to track HEAD implicitly
authorThomas Rast <trast@student.ethz.ch>
Tue, 14 Dec 2010 18:38:22 +0000 (19:38 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 Dec 2010 19:05:09 +0000 (11:05 -0800)
commit84c1a89588c598530c4b0d2297ddddea9ee68278
tree5028e6ae9bb6201da7ed395e8beb401e929faa73
parentc6d059bbccb8460959b9aedfeefbb4d6aac6e842
branch: do not attempt to track HEAD implicitly

With branch.autosetupmerge=always, 'HEAD' becomes a valid target for
branch tracking.  This is a bit silly, and in fact the code already
guards against it when attempting it explicitly:

  $ git checkout HEAD^0
  $ git branch -t foo
  fatal: Cannot setup tracking information; starting point is not a branch.

Silently drop the HEAD candidate in the implicit (i.e. without -t
flag) case, so that the branch starts out without an upstream.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
branch.c
t/t3200-branch.sh