threads / discuss / 40881

'git log --source' seems to fail to show ref name after the first tag comes out.

Subject: 'git log --source' seems to fail to show ref name after the first tag comes out.

## tl;dr

3 messages between Nov 25, 2015 and Nov 25, 2015.

replies: 2people: 2as markdown or json

Raymundo· Nov 25, 2015, 10:29 UTC · lore
Hello,
At first, I'm sorry I'm not good at English.
When I execute this command:
git log --oneline --source --all --decorate

I get the output below: (I replaced commit messages written in Korean with "COMMIT MSG")

295c670 refs/heads/gyparkwiki_base (gyparkwiki_base) COMMIT MSG c130d61 refs/heads/master (HEAD -> master, origin/master, origin/HEAD) version 2.27a 6f6f40c refs/heads/gyparkwiki (gyparkwiki) COMMIT MSG ... a37772f refs/heads/gyparkwiki COMMIT MSG afeaa51 refs/heads/gyparkwiki COMMIT MSG af2676e (tag: last_CVS_utf) COMMIT MSG <- ref name is not shown from this line b4d27c9 COMMIT MSG 4f834f8 COMMIT MSG ... 7534d49 COMMIT MSG e5c8a6c *** empty log message *** 596aa3e refs/tags/urlprefix (tag: urlprefix) COMMIT MSG <- ref name appears again from this line 8fc4de3 refs/tags/urlprefix COMMIT MSG ... a0b587 refs/tags/urlprefix COMMIT MSG f8526f9 refs/tags/urlprefix COMMIT MSG 277478b (tag: last_CVS_testwiki) COMMIT MSG <- ref name disappear again from this line 65919c8 *** empty log message *** ...

As you can see, ref names in the second column repeats to disappear and come back, at every lines that contain tags.

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.

Maybe is this a bug?

Thank you. G.Y.Park from South Korea

Jeff King· Nov 25, 2015, 12:59 UTC · re: Raymundo · lore

Re: 'git log --source' seems to fail to show ref name after the first tag comes out.

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
Raymundo· Nov 25, 2015, 14:00 UTC · re: Jeff King · lore

Re: 'git log --source' seems to fail to show ref name after the first tag comes out.

2015-11-25 21:59 GMT+09:00 Jeff King <peff@peff.net>:
Show 25 quoted lines
>
> 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
It's a good news that you found the reason so soon.
I'd like to wait for next version :-)
Thank you!

← back to recent threads