From: Linus Torvalds <torvalds@linux-foundation.org>
To: David Kastrup <dak@gnu.org>
Cc: git@vger.kernel.org
Subject: Re: A question about git-rev-list
Date: Mon, 16 Jul 2007 13:05:34 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.0.999.0707161258560.20061@woody.linux-foundation.org> (raw)
In-Reply-To: <86wsx0wwvs.fsf@lola.quinscape.zz>
On Mon, 16 Jul 2007, David Kastrup wrote:
>
> if I do
>
> git-rev-list --remove-empty HEAD --not some-commit -- filename | tail -1
>
> do I have any guarantee that the commit id I get (if any) is a direct
> descendant of some-commit?
No. You get the guarantee that
- it's some kind of parent of HEAD
- it's *not* a parent of some-commit
But the trivial case is a simple history like
/-B-\
A D
\-C-/
(where "A" is the root commit, and "D" is the current HEAD, and there are
two development lines from A to D).
If you now do
git-rev-list HEAD --not C
you would generally see B on the list of commits, even though it's
obviously not a direct descendant of C.
No amount of flags will change that. Of course, B might not show up
for _other_ reasons (ie simply because it doesn't change "filename" at
all), but generally you must always think of git-rev-list (and git log) as
a _set_ operation.
There are no git operations that will look for "chain of commits from C to
D" if that is what you want. No such chain necessarily even exists, and
quite often it is ambiguous when it *does* exist (ie there is not a single
chain from A to D, there are two chains).
You could add some kind of function that looks for the "shortest chain of
commits from X to Y", but that would really be something fundamentally
different from what git-rev-list gives you.
Linus
next prev parent reply other threads:[~2007-07-16 20:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-16 8:55 A question about git-rev-list David Kastrup
2007-07-16 20:05 ` Linus Torvalds [this message]
2007-07-16 21:16 ` David Kastrup
2007-07-17 4:33 ` Junio C Hamano
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=alpine.LFD.0.999.0707161258560.20061@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=dak@gnu.org \
--cc=git@vger.kernel.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