Question about 'git log', custom formats, and '--left-right' and friends

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone,

I think I've come across a limitation of using custom pretty formats
along with the '--left-right', '--boundary', '--cherry-mark'
options to 'git log'.

I'm trying to replicate the behaviour of the 'oneline' pretty format when it
is used with or without the options above and a symmetric difference. When not
using any of the options above, no mark is added before the commit hash in
non-graph mode, and a '*' is added in graph-mode. When using the options above,
the corresponding marks are used: '>', '<', for left/right, '-' for boundary ('o'
in graph mode), '+' and '=' for cherry-mark, etc.

I'd like to get this behaviour with a custom pretty format (I use it to add some
more informations to what '--oneline' shows), but it seems it is not possible. And
the '%m' placeholder does not help a lot, as it's 'always on'. The script below demonstrates
what I'm talking about:

~~~
#!/bin/sh

run () {
echo
echo "RUNNING: $@"
"$@"
}

rm -rf test
mkdir test
cd test

git init -b master remote
echo data>remote/file && git -C remote add file && git -C remote commit -m root
git clone remote clone
echo dato>remote/file && git -C remote add file && git -C remote commit -m L
echo date>clone/file  && git -C clone  add file && git -C clone  commit -m R
git -C clone fetch
git -C clone config pretty.ol     '%h %s'
git -C clone config pretty.ol2 '%m %h %s'

run git -C clone log --oneline --no-decorate --left-right @{u}...
run git -C clone log --format=ol  --left-right @{u}...
run git -C clone log --format=ol2 --left-right @{u}...

run git -C clone log --graph --oneline --no-decorate --left-right @{u}...
run git -C clone log --graph --format=ol  --left-right @{u}...
run git -C clone log --graph --format=ol2 --left-right @{u}...

run git -C clone log --oneline --no-decorate @{u}...
run git -C clone log --format=ol  @{u}...
run git -C clone log --format=ol2 @{u}...

run git -C clone log --graph --oneline --no-decorate @{u}...
run git -C clone log --graph --format=ol  @{u}...
run git -C clone log --graph --format=ol2 @{u}...
~~~

the (commented) output looks like:
---
RUNNING: git -C clone log --oneline --no-decorate --left-right @{u}...
< 10f70d1 L
31e5b8e R

RUNNING: git -C clone log --format=ol --left-right @{u}...
10f70d1 L
31e5b8e R

-> NOT OK: no marks shown

RUNNING: git -C clone log --format=ol2 --left-right @{u}...
< 10f70d1 L
31e5b8e R

-> OK: marks shown

RUNNING: git -C clone log --graph --oneline --no-decorate --left-right @{u}...
< 10f70d1 L
31e5b8e R

RUNNING: git -C clone log --graph --format=ol --left-right @{u}...
< 10f70d1 L
31e5b8e R

-> OK: marks shown

RUNNING: git -C clone log --graph --format=ol2 --left-right @{u}...
< < 10f70d1 L
> 31e5b8e R

-> NOT OK: marks shown twice

RUNNING: git -C clone log --oneline --no-decorate @{u}...
10f70d1 L
31e5b8e R

RUNNING: git -C clone log --format=ol @{u}...
10f70d1 L
31e5b8e R

-> OK: no marks shown

RUNNING: git -C clone log --format=ol2 @{u}...
< 10f70d1 L
31e5b8e R

-> NOT OK: marks shown

RUNNING: git -C clone log --graph --oneline --no-decorate @{u}...
* 10f70d1 L
* 31e5b8e R

RUNNING: git -C clone log --graph --format=ol @{u}...
* 10f70d1 L
* 31e5b8e R

-> OK: no marks shown

RUNNING: git -C clone log --graph --format=ol2 @{u}...
* < 10f70d1 L
* > 31e5b8e R

-> NOT OK: different marks shown twice
---


Am I missing something here ? Is this a known limitation ?


Thanks and cheers,

Philippe.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux