From: Junio C Hamano <gitster@pobox•com>
To: Luke Diamand <luke@diamand•org>
Cc: git@vger•kernel.org
Subject: Re: [PATCHv1 2/2] git-p4: work with a detached head
Date: Wed, 09 Sep 2015 14:52:13 -0700 [thread overview]
Message-ID: <xmqqfv2n5khe.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1441461738-25066-3-git-send-email-luke@diamand.org> (Luke Diamand's message of "Sat, 5 Sep 2015 15:02:18 +0100")
Luke Diamand <luke@diamand•org> writes:
> def run(self, args):
> if len(args) == 0:
> self.master = currentGitBranch()
> - if len(self.master) == 0 or not gitBranchExists("refs/heads/%s" % self.master):
> - die("Detecting current git branch failed!")
> + if self.master == "undefined":
> + self.master = None
The comparison with textual "undefined" smelled fishy and I ended up
looking at the implementation of currentGitBranch().
def currentGitBranch():
return read_pipe("git name-rev HEAD").split(" ")[1].strip()
Yuck. I know it is not entirely the fault of this patch, but
shouldn't it be reading from
$ git symbolic-ref HEAD
and catch the error "fatal: ref HEAD is not a symbolic ref" and use
it as a signal to tell that the HEAD is detached?
next prev parent reply other threads:[~2015-09-09 21:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-05 14:02 [PATCHv1 0/2] git-p4: work on a detached head Luke Diamand
2015-09-05 14:02 ` [PATCHv1 1/2] git-p4: add failing test for submit from " Luke Diamand
2015-09-05 14:02 ` [PATCHv1 2/2] git-p4: work with a " Luke Diamand
2015-09-09 21:52 ` Junio C Hamano [this message]
2015-09-10 7:29 ` Luke Diamand
2015-09-10 16:20 ` Junio C Hamano
2015-10-28 17:44 ` Junio C Hamano
2015-10-28 19:03 ` Luke Diamand
2015-09-09 12:03 ` [PATCHv1 0/2] git-p4: work on " Lars Schneider
2015-09-10 1:57 ` Jacob Keller
2015-09-10 1:59 ` Jacob Keller
2015-09-10 12:23 ` Luke Diamand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqfv2n5khe.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=luke@diamand$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox