Re: logging disjoint sets of commits in a single command
flat view
From: Jeff King <hidden>
Date: 2016-06-15 22:52:54
On Wed, Feb 01, 2012 at 01:39:29AM +0100, Carlos Martín Nieto wrote:
quoted
Here's a sample command line against a kernel tree: git log 373af0c^..373af0c 590dfe2^..590dfe2 I want git to log those two specific commits, but in fact it looks like limit_list is marking 590dfe2 as UNINTERESTING while processing 373af0c, and so it gets pruned. Is there some way around this, or would a patch to fix it be acceptable?From my reading of the manpage (and the way most git commands work) log accepts one range of commits. They all get bunched up together.
Right. That command is equivalent to:
373af0c 590dfe2 --not 373af0c^ 590dfe2^
So the limiting for one range you're interested in ends up marking part
of the other as uninteresting, and that's by design. This topic came up
recently, and I think the general consensus is that it would be cool to
be able to do totally independent ranges, but that would be backwards
incompatible with the current behavior.
In the general case, you can emulate this with:
{ git log 373af0c^..373af0c
git log 590dfe2^..590dfe2
} | $PAGER
which is of course slightly more annoying to type. If you're just
interested in _single_ commits, though, you can just give the commits
and turn off walking:
git log --no-walk 373af0c 590dfe2
You might find cat-file's --batch mode interesting.
git rev-list 373af0c^..373af0c | git cat-file --batch
git rev-list 590dfe2^..590dfe2 | git cat-file --batch
looks a lot like what you're looking for.I think you could even drop the rev-lists in this case, since he just wants a single commit. However, cat-file lacks the niceties of "log", like fancy --pretty formatting and automatic diffing against parents. -Peff