Revision 8ced1aa08f9e1798b2b3fec41a0598ef79b477fe authored by Chris Webb on 26 June 2012, 15:06:42 UTC, committed by Junio C Hamano on 26 June 2012, 18:11:14 UTC
abe199808c (git checkout -b: allow switching out of an unborn branch)
introduced a bug demonstrated by

  git checkout --orphan foo
  git checkout --detach
  git symbolic-ref HEAD

which gives 'refs/heads/(null)'.

This happens because we strbuf_addf(&branch_ref, "refs/heads/%s",
opts->new_branch) when opts->new_branch can be NULL for --detach.

Catch and forbid this case, adding a test to t2017 to catch it in
future.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent abe1998
History
File Mode Size
static
INSTALL -rw-r--r-- 17.0 KB
Makefile -rw-r--r-- 5.3 KB
README -rw-r--r-- 17.6 KB
gitweb.perl -rwxr-xr-x 224.3 KB

README

back to top