Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are some git commits hidden inside the cygwin shell?

One of my colleagues recently noticed a discrepancy between the normal git log command, and and the following alias:

git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

After a bit of poking, we found out that it may be related to the cygwin bash.

Here are our findings:

  • git log --graph

    all commits visible

  • git log --oneline

    some commits missing... okay! let's prepare an error report by redirecting the output to a text file:

  • git log --oneline > test.txt

    Alas, all commits are visible in test.txt ?!? Let's investigate further by taking apart the alias. Removing color codes:

  • git log --graph --pretty=format:'%h - %d %s (%cr) <%an>'

    some commits missing. So it must be one of the variables...

[... some frobnications later ...]

  • git log --graph --pretty=format:'%h - %d %s (%cr)'

    all commits visible

  • git log --graph --pretty=format:'%h - %d %s <%an>'

    all commits visible

It seems to break after certain combinations of variables. In this case (%cr) <%an>

I also tried the same repository on linux and on there, it works as expected (i.e. all commits are shown in the log).

We would like to know why this is happening.

like image 892
exhuma Avatar asked Nov 14 '22 10:11

exhuma


1 Answers

Try these to get closer to the cause:

  • use cygwin with a different terminal, say xterm or mintty.
  • set (or unset?) $PAGER and see how that affects the bug.
  • if $PAGER is less, save the log from inside less (S), and/or -R to turn on /off processing of ANSI escapes, if you have color on.
  • try with --no-color, if you have color on
  • check your locale settings, $LC_ALL, $LANG etc. try

LANG=C git log etc

like image 197
Michael Slade Avatar answered Nov 16 '22 01:11

Michael Slade