git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fwd: Bug#793884: git: allows nonsensical command 'git checkout -b HEAD'
       [not found] <20150728141858.22342.16605.reportbug@zam581.zam.kfa-juelich.de>
@ 2015-07-28 14:33 ` Duy Nguyen
  2015-07-28 16:32   ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Duy Nguyen @ 2015-07-28 14:33 UTC (permalink / raw)
  To: Git Mailing List

This seems like a good thing to fix (i.e. make sure XX is not
ambiguous before creating it with "git checkout -b XX")


---------- Forwarded message ----------
From: Andreas Beckmann <anbe@debian.org>
Date: Tue, Jul 28, 2015 at 9:18 PM
Subject: Bug#793884: git: allows nonsensical command 'git checkout -b HEAD'
To: Debian Bug Tracking System <submit@bugs.debian.org>


Package: git
Version: 1:2.1.4-2.1
Severity: normal
Tags: upstream

$ git branch HEAD
fatal: it does not make sense to create 'HEAD' manually
# OK, special casing prevents this
$ git checkout -b HEAD
Switched to a new branch 'HEAD'
# but not this :-P
$ git checkout master
Switched to branch 'master'
$ git checkout HEAD
warning: refname 'HEAD' is ambiguous.
Switched to branch 'HEAD'
# oops ;-)
$ git checkout master
Switched to branch 'master'
$ git branch -d HEAD
Deleted branch HEAD (was 6e54945).
# OK, we can easily cleanup this mess again

The same works in 1:2.4.6-1 in sid.

If there is some special casing for HEAD in git branch, the same
should probably be done for git checkout -b, too.


Andreas



-- 
Duy

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fwd: Bug#793884: git: allows nonsensical command 'git checkout -b HEAD'
  2015-07-28 14:33 ` Fwd: Bug#793884: git: allows nonsensical command 'git checkout -b HEAD' Duy Nguyen
@ 2015-07-28 16:32   ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2015-07-28 16:32 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Git Mailing List

Duy Nguyen <pclouds@gmail.com> writes:

> This seems like a good thing to fix (i.e. make sure XX is not
> ambiguous before creating it with "git checkout -b XX")

Yeah, sounds like an easy lunch-time hack low-hanging fruit :-).

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-28 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20150728141858.22342.16605.reportbug@zam581.zam.kfa-juelich.de>
2015-07-28 14:33 ` Fwd: Bug#793884: git: allows nonsensical command 'git checkout -b HEAD' Duy Nguyen
2015-07-28 16:32   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).