diff options
author | Chris Webb <chris@arachsys.com> | 2012-06-26 16:06:42 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-06-26 11:11:14 -0700 |
commit | 8ced1aa08f9e1798b2b3fec41a0598ef79b477fe (patch) | |
tree | 4cad32f246e34e8686b0dae6045c60875de8f4ae /string-list.c | |
parent | git checkout -b: allow switching out of an unborn branch (diff) | |
download | tgif-8ced1aa08f9e1798b2b3fec41a0598ef79b477fe.tar.xz |
git-checkout: disallow --detach on unborn branch
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>
Diffstat (limited to 'string-list.c')
0 files changed, 0 insertions, 0 deletions