Heyup, everybody.

Apologies if this turns out to be a duplicate. Gmane seems broken, so
I couldn't search the archive.

I'm using git version 2.4.0-rc1. The same behavior exists in 2.1.0.

With git-log it is possible to specify a custom pretty format that
outputs one line per commit:
> git log --pretty=format:"%h ..." HEAD~3...HEAD
826aed5 ...
915e44c ...
067178e ...

Trying the same with rev-list results in:
> git rev-list --pretty=format:"%h ..." HEAD~3...HEAD
commit 826aed50cbb072d8f159e4c8ba0f9bd3df21a234
826aed5 ...
commit 915e44c6357f3bd9d5fa498a201872c4367302d3
915e44c ...
commit 067178ed8a7822e6bc88ad606b707fc33658e6fc
067178e ...

Is the separate line of "commit <hash>" a must for all formats except
"oneline" or a possible bug?
Based on the git-rev-list man page and git-log, I would expect to be
able to override the format as described, since it is possible to get
the "commit <hash>" line for any format by prefixing it with "commit
%H".

The only way to get similar behaviour is to do something like:
> git rev-list ... | grep -v '^commit'
and that's quite hacky.

I looked at the code and the flow in rev-list seems odd to me. The
header_prefix is set outside of show_commit(), it is empty for
format=oneline, but set to "commit " for any other formats. It's then
printed inside show_commit() and followed by the (possibly
abbreviated) hash. So the display logic is split into two places,
neither of which knows much about the other, both make decisions based
on the pretty format specified.

Even if the behavior is correct, would you agree that this could be
refactored a bit, so the output is less stitched together?
I'd happily try to help refactoring or fixing it, if it is indeed a bug.

Thanks for your ears!
  Oliver
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to