From: Junio C Hamano <gitster@pobox.com>
To: Heiko Voigt <hvoigt@hvoigt.net>
Cc: paulus@samba.org, max@max630.net, git@vger.kernel.org,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH] gitk: fix --all behavior combined with --not
Date: Thu, 11 Jul 2019 11:55:09 -0700 [thread overview]
Message-ID: <xmqq7e8os8oi.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20190711122452.GC65621@book.hvoigt.net> (Heiko Voigt's message of "Thu, 11 Jul 2019 14:24:52 +0200")
Heiko Voigt <hvoigt@hvoigt.net> writes:
> if {$revs eq {}} {
> set revs HEAD
> - } elseif {[lsearch -exact $revs --all] >= 0} {
> - lappend revs HEAD
> + } else {
> + linsert revs 0 --all-include-head
> }
OK. So the new option means "from here on, the meaning of the
'--all' option changes its meaning from 'all refs' to 'all refs and
HEAD'". That way, gitk does not have to guess if '--all' found on
the command line is an option or something else (e.g. pathspec etc.)
That makes sense. It would be a no-op if '--all' is not used, which
is also good.
>> To put it the other way around, what use case would we have that we
>> want to enumerate all refs but not HEAD, *and* exclude HEAD only
>> when HEAD is detached? I can see the use of "what are commits
>> reachable from the current HEAD but not reachable from any of the
>> refs/*?" and that would be useful whether HEAD is detached or is on
>> a concrete branch, so "rev-parse --all" that does not include
>> detached HEAD alone does not feel so useful at least to me.
>
> What about my example. My use case is: Show me everything that is not merged
> into a stable branch (i.e. origin/master). For a human viewer it does not
> really matter if an extra detachted HEAD is shown, but for a CI script it
> might. Ok this might be quite artificial, what do you think?
That is, to drive "gitk --all ^origin/master"? If HEAD is detached,
isn't the history that leads to it something that is "not merged
into a stable branch", too? IOW, I think you would want the same
behaviour as "git log --all ^origin/master" for that use case, and
treat HEAD just like any of the refs.
Back in the days, detached HEAD was mostly tentative state, but
these days, especially for those who use submodules, wouldn't it be
a norm to have your checkout associated with a detached HEAD? I
think treating (detached) HEAD just like any of the refs matches
the end-user expectations even more these days.
>> I am reasonably sure that back when "rev-parse --all" was invented,
>> the use of detached HEAD was not all that prevalent (I would not be
>> surprised if it hadn't been invented yet), so it being documented to
>> enumerate all refs does not necessarily contradict to include HEAD
>> if it is different from any of the ref tips (i.e. detached).
>
> I just dug up the old discussion to this to find some reasoning why this was
> not changed. So you have changed your mind about this? [1]
Yup. See above. I think the time has changed the needs.
Thanks.
next prev parent reply other threads:[~2019-07-11 18:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-04 8:09 [PATCH] gitk: fix --all behavior combined with --not Heiko Voigt
2019-07-04 10:38 ` Johannes Schindelin
2019-07-04 11:31 ` Heiko Voigt
2019-07-08 19:01 ` Junio C Hamano
2019-07-09 4:55 ` Junio C Hamano
2019-07-09 5:16 ` Junio C Hamano
2019-07-10 7:58 ` Heiko Voigt
2019-07-10 18:40 ` Junio C Hamano
2019-07-11 12:24 ` Heiko Voigt
2019-07-11 18:55 ` Junio C Hamano [this message]
2019-07-11 17:11 ` Johannes Sixt
2019-07-10 7:44 ` Heiko Voigt
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=xmqq7e8os8oi.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=hvoigt@hvoigt.net \
--cc=max@max630.net \
--cc=paulus@samba.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.
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).