Re: 'git log --source' seems to fail to show ref name after the first tag comes out.
- From
Jeff King <peff@peff.net>
- Date
- Nov 25, 2015, 12:59 UTC
- Message-ID
- <20151125125956.GC4504@sigill.intra.peff.net>
- In-Reply-To
- <CAAe7MbAwWHXxVOu-CU7QpN0K3XTKJ1=xp4-dzSwBQatdAZ1vaQ@mail.gmail.com>
On Wed, Nov 25, 2015 at 07:29:02PM +0900, Raymundo wrote:
> At first, I'm sorry I'm not good at English.
No problem. Your report was very clear. :)
Show 6 quoted lines
> When I execute this command: > > git log --oneline --source --all --decorate > [...] > As you can see, ref names in the second column repeats to disappear > and come back, at every lines that contain tags.
I was able to reproduce this pretty easily with a short test case:
git init git commit --allow-empty -m one git commit --allow-empty -m two git commit --allow-empty -m three git tag -m mytag HEAD^
Starting from one source works:
$ git log --oneline --source master de009a4 master three b75220d master two 62f49bd master one
But starting from the tag as well does not:
$ git log --oneline --source master mytag de009a4 master three b75220d two 62f49bd one
Or more simply, starting from the tag never has any sources:
$ git log --oneline --source mytag b75220d two 62f49bd one
It's like the tag paints its commit with an empty "source" field (and then we propagate that down the graph).
> I tested using Git version 2.6.3 > > For reference, Git version 1.7.9.rc0 does not have this problem. It > shows ref names on all lines well.
Sounds like a good opportunity to use git-bisect. I came up with 2073949 (traverse_commit_list: support pending blobs/trees with paths, 2014-10-15) from git v2.2.0, which unfortunately was written by me. :)
This one-liner seems to fix it:
diff --git a/revision.c b/revision.c index af2a18e..d434b8b 100644 --- a/revision.c +++ b/revision.c @@ -297,7 +297,6 @@ static struct commit *handle_commit(struct rev_info *revs, * through to the non-tag handlers below. Do not * propagate data from the tag's pending entry. */ - name = ""; path = NULL; mode = 0; } But I'm not sure if it causes other problems. In particular, I see why we would not propagate a path field, but I do not know why the original was avoiding propagating the name field. -Peff