Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Wrong jump for diff with no content change #75

Closed
vivien opened this Issue Aug 11, 2012 · 3 comments

Comments

Projects
None yet
2 participants
Contributor

vivien commented Aug 11, 2012

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.

Owner

jonas commented Aug 13, 2012

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

Contributor

vivien commented Aug 13, 2012

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.

Owner

jonas commented Mar 8, 2014

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 jonas closed this Mar 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment