From: "Rafael Ascensão" <rafa.almas@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Daniels Umanovskis <daniels@umanovskis.se>, git@vger.kernel.org
Subject: Re: [PATCH 0/2] branch: introduce --current display option
Date: Wed, 10 Oct 2018 15:24:34 +0100 [thread overview]
Message-ID: <20181010142423.GA3390@rigel> (raw)
In-Reply-To: <xmqq8t36q1k6.fsf@gitster-ct.c.googlers.com>
On Wed, Oct 10, 2018 at 05:59:05AM +0900, Junio C Hamano wrote:
>
> But I do not think that is what is going on. There is "--list" that
> lists branches whose name match given patterns, and at the end-user
> level (I haven't seen the implementation) this is another mode of
> that operation that limits itself to the one that is currently
> checked out
>
Given the idea that showing the current branch is a particular case of
what --list does, one option could be to treat the 'HEAD' pattern
specially.
[After writing another version of this email, I found that we
already special case the pattern 'HEAD']
$git branch; already treats the 'HEAD' pattern specially to print
something like: "* (HEAD detached at e83c516331)" when the HEAD is
detached. But returns without output when the HEAD is attached.
We could make $git branch --list HEAD; print the current branch
paralleling nicely with what $git rev-parse --abrev-ref HEAD; already
does when given attached and detached HEAD; But keeping the perks of the
more human-readable output (color, * marker, formatting, etc).
Since the output of git branch isn't meant to be parsable, changing this
behaviour shouldn't affect users, and introduce the feature without the
need of new options.
But I suspect this approach may be diverging from the spirit of this
patch.
From my time spent on #git, I find that the concept of 'HEAD' is
something that many new users misunderstand. So, if the original
motivation behind this patch is to be able to determine the current
branch without using the concept of 'HEAD', my suggestion falls short.
Cheers,
Rafael Ascensão
next prev parent reply other threads:[~2018-10-10 14:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 18:20 [PATCH 0/2] branch: introduce --current display option Daniels Umanovskis
2018-10-09 20:59 ` Junio C Hamano
2018-10-10 9:29 ` Eric Sunshine
2018-10-10 9:42 ` Eric Sunshine
2018-10-10 14:24 ` Rafael Ascensão [this message]
2018-10-10 23:51 ` brian m. carlson
2018-10-10 15:03 ` Ævar Arnfjörð Bjarmason
2018-10-10 16:29 ` Daniels Umanovskis
2018-10-10 18:08 ` Stefan Beller
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=20181010142423.GA3390@rigel \
--to=rafa.almas@gmail.com \
--cc=daniels@umanovskis.se \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.
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).