Skip to content
This repository

Wrong jump for diff with no content change #75

Closed
vivien opened this Issue · 3 comments

2 participants

Vivien Didelot Jonas Fonseca
Vivien Didelot

In some rare cases, the "Press Enter to jump" feature skips a diff header. You may try this in the tig repository:

touch FOO
echo bar >> NEWS
git add .
git commit -am baz

In the diff view, pressing Enter on "NEWS" jumps to the FOO diff header.
That's because the diff stat does not show new empty files while tig wants to jump to the first diff header.

Jonas Fonseca
Owner

Verified. The question is how to figure out when a diff has not been listed in the diffstat taking into account binary diffs etc.

Vivien Didelot

An alternative would be to use git show -p --numstat, which displays an easy to parse stat for every file.
But to answer your question, the only option I have in mind is: number of LINE_DIFF_STAT != number of LINE_DIFF_HEADER.

Jonas Fonseca
Owner
jonas commented

It looks like this was fixed in git version 1.8.0.2. From the release notes:

 * We failed to mention a file without any content change but whose
   permission bit was modified, or (worse yet) a new file without any
   content in the "git diff --stat" output.

From https://git.kernel.org/cgit/git/git.git/tree/Documentation/RelNotes/1.8.0.2.txt#n11

Jonas Fonseca jonas closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.