It's easy to test as a minimal test case, actually. If one will get
along with the complicated git format – %x01 is just $'\1'.
I attach minimal.zsh. It reveals bug when extendedglob is added to
emulate -LR zsh. Just to be run in any git directory, hoping that any
log message will have "(HEAD -> master, origin/master)" at top.
Interestingly, --max-count=1 instead of 2 stops the bug.
Example runs in two different repositories:
15f1acdUpdated README.md (HEAD -> master, origin/master)4 days
agoSebastian Gniazdowski
0280384Information on source of *foo*~^*bar*4 days agoSebastian Gniazdowski
15f1acd 'Updated README.md'
0280384 'Information on source of *foo*~^*bar*' >< '4 days ago'
Sebastian Gniazdowski
e6d9a0eA stub for uizcm, with binding (^O^U) (HEAD -> master)3 hours
agoSebastian Gniazdowski
feb4624myctags: Message about recompilation request (origin/master)3
hours agoSebastian Gniazdowski
e6d9a0e 'A stub for uizcm, with binding (^O^U)'
feb4624 'myctags: Message about recompilation request' >
(origin/master)< '3 hours ago' Sebastian Gniazdowski
It can be seen that third line doesn't have (HEAD -> master) etc.
Attached code:
====================================
#!/usr/bin/env zsh
emulate -LR zsh
setopt extendedglob
gitcmd=( git log --max-count=2
--pretty=format:'%h%x01%s%x02%d%x03%cr%x04%an' --abbrev-commit )
gitout=( "${(@f)"$( "${gitcmd[@]}" )"}" )
print -rl -- "${gitout[@]}"
gitout=( "${gitout[@]//(#b)([^$'\1']#)$'\1'([^$'\2']#)$'\2'([^$'\3']#)$'\3'([^$'\4']#)$'\4'(*)/${match[1]}
${(q-)match[2]}} >${match[3]}< ${(q-)match[4]} ${match[5]}" )
print -rl -- "${gitout[@]}"
Attachment:
minimal.zsh
Description: Binary data