Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Wrong jump for diff with no content change #75

Closed
vivien opened this Issue · 3 comments

2 participants

@vivien

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
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

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
Owner

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
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.