Re: Incorrect pipe for git log graph when using --name-status option
- From
hIpPy <hippy2981@gmail.com>
- Date
- Feb 13, 2017, 21:43 UTC
- Message-ID
- <CAM_JFCzniePuqJTFOy-odLfuKcBjssh0zk3PFBsVcm6Ww6iW5w@mail.gmail.com>
- In-Reply-To
- <20170213212734.howisucqqhusbglc@sigill.intra.peff.net>
On Mon, Feb 13, 2017 at 1:27 PM, Jeff King <peff@peff.net> wrote:
Show 28 quoted lines
> On Mon, Feb 13, 2017 at 01:18:40PM -0800, Junio C Hamano wrote: > >> Jeff King <peff@peff.net> writes: >> >> > I think the problem is specifically related to the "terminator" versus >> > "separator" semantics. Try: >> > >> > git log --graph --name-status --pretty=format:%h >> > >> > versus: >> > >> > git log --graph --name-status --pretty=tformat:%h >> > >> > The latter works fine. The problem seems to happen with all diff >> > formats, so I think the issue is that git is not aggressive enough about >> > inserting the newline at the right spot when using separator mode. >> >> I guess that is one of the reasons why we made --format=%h a synonym >> to --pretty=tformat:%h and not --pretty=format:%h ;-) > > Yeah. I have never found "--pretty=format" to do what I want versus > tformat. I wish we could just get rid of it, but I think it is likely to > be used as a plumbing interface. > > So I think there probably _is_ a bug in it to be fixed, but my immediate > response is "don't ever use --pretty=format:". > > -Peff
I have 1 issue with tformat in that I feel it reduces readability a bit when using options. But I can use it if that is recommended over the other.
Without --name-status: This is OK.
$ git log --graph --date=relative --decorate --abbrev-commit --format='%h - %aD (%ar)%d%n %s - %an' -2 * bf7ace7daf - Mon, 6 Feb 2017 13:09:32 -0800 (7 days ago) (HEAD -> rm/option-for-name-status) | wip: --ns for --name-status - Rishikesh Mandvikar * 592e5c5bce - Wed, 1 Feb 2017 16:35:30 +0100 (12 days ago) (origin/master, origin/HEAD, master) |\ Merge pull request #994 from jeffhostetler/jeffhostetler/fscache_nfd - Johannes Schindelin
With --name-status: I'm sorry if I nitpick here but I think the --name-status items should either be preceeded and followed by blank line OR not (as in oneline) but not just preceded (example below).
$ git log --graph --date=relative --decorate --abbrev-commit --format='%h - %aD (%ar)%d%n %s - %an' -2 --name-status * bf7ace7daf - Mon, 6 Feb 2017 13:09:32 -0800 (7 days ago) (HEAD -> rm/option-for-name-status) | wip: --ns for --name-status - Rishikesh Mandvikar | | M diff.c * 592e5c5bce - Wed, 1 Feb 2017 16:35:30 +0100 (12 days ago) (origin/master, origin/HEAD, master) |\ Merge pull request #994 from jeffhostetler/jeffhostetler/fscache_nfd - Johannes Schindelin
So either of below is better that above (I feel):
Blank lines before and after --name-status items:
$ git log --graph --date=relative --decorate --abbrev-commit --format='%h - %aD (%ar)%d%n %s - %an' -2 --name-status * bf7ace7daf - Mon, 6 Feb 2017 13:09:32 -0800 (7 days ago) (HEAD -> rm/option-for-name-status) | wip: --ns for --name-status - Rishikesh Mandvikar | | M diff.c | * 592e5c5bce - Wed, 1 Feb 2017 16:35:30 +0100 (12 days ago) (origin/master, origin/HEAD, master) |\ Merge pull request #994 from jeffhostetler/jeffhostetler/fscache_nfd - Johannes Schindelin
No blank lines before and after --name-status items:
$ git log --graph --date=relative --decorate --abbrev-commit --format='%h - %aD (%ar)%d%n %s - %an' -2 --name-status * bf7ace7daf - Mon, 6 Feb 2017 13:09:32 -0800 (7 days ago) (HEAD -> rm/option-for-name-status) | wip: --ns for --name-status - Rishikesh Mandvikar | M diff.c * 592e5c5bce - Wed, 1 Feb 2017 16:35:30 +0100 (12 days ago) (origin/master, origin/HEAD, master) |\ Merge pull request #994 from jeffhostetler/jeffhostetler/fscache_nfd - Johannes Schindelin
What do guys think?
If there is a way to get what I want using tformat?
Thanks, RM