From: "Jakub Narębski" <jnareb@gmail.com>
To: Johannes Sixt <j6t@kdbg.org>, Junio C Hamano <gitster@pobox.com>
Cc: Anatol Rudolph <a.rudolph@2vizcon.com>, git@vger.kernel.org
Subject: Re: git branch command is incompatible with bash
Date: Tue, 28 Jul 2015 12:01:04 +0200 [thread overview]
Message-ID: <55B752E0.7020901@gmail.com> (raw)
In-Reply-To: <55B72F09.3030000@kdbg.org>
W dniu 2015-07-28 o 09:28, Johannes Sixt pisze:
> Am 27.07.2015 um 23:49 schrieb Junio C Hamano:
>> Johannes Sixt <j6t@kdbg.org> writes:
>>
>>> Try
>>>
>>> branchName=$(git rev-parse --abbrev-ref HEAD)
>>
>> Hmm, interesting.
>>
>> $ git checkout --orphan notyet
>> $ git rev-parse --abbrev-ref HEAD
>> $ git symbolic-ref --short HEAD
>>
>
> Please don't scare newcomers with these corner cases ;-)
:-P
Yet another corner case:
$ git checkout origin/master # or v1.0.0
$ git rev-parse --abbrev-ref HEAD
$ git symbolic-ref --short HEAD
> I see this:
>
> $ git rev-parse --abbrev-ref HEAD
> HEAD
> fatal: ambiguous argument 'HEAD': unknown revision or path not in the
> working tree.
> Use '--' to separate paths from revisions, like this:
> 'git <command> [<revision>...] -- [<file>...]'
Errr... this error message is errorneous (well, at least somewhat
misleading). Git should know that HEAD is not a path, and that
--abbrev-ref doe not need no revision.
> $ git symbolic-ref --short HEAD
> notyet
>
> Are you trying to say that the result of 'rev-parse --abbrev-ref HEAD'
> is suboptimal and that of 'symbolic-ref --short HEAD' is OK?
--
Jakub Narębski
next prev parent reply other threads:[~2015-07-28 10:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-27 12:12 git branch command is incompatible with bash Anatol Rudolph
2015-07-27 21:11 ` Johannes Sixt
2015-07-27 21:49 ` Junio C Hamano
2015-07-28 7:28 ` Johannes Sixt
2015-07-28 10:01 ` Jakub Narębski [this message]
2015-07-28 15:23 ` Junio C Hamano
2015-07-28 16:25 ` Jeff King
2015-07-28 17:27 ` Johannes Sixt
2015-07-29 0:23 ` Scott Schmit
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55B752E0.7020901@gmail.com \
--to=jnareb@gmail.com \
--cc=a.rudolph@2vizcon.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).