summaryrefslogtreecommitdiff
path: root/src/diff_output.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-05-07 07:15:39 -0700
committerRussell Belfer <rb@github.com>2013-05-07 07:15:39 -0700
commitc2f602f8a5265a4be6383127435a18a8be98c9fe (patch)
tree7d10a47baf41f6813d6565c64a6adb8384082934 /src/diff_output.c
parentd63eec6946341e5efa0514bbf2904db2ded2a294 (diff)
downloadlibgit2-c2f602f8a5265a4be6383127435a18a8be98c9fe.tar.gz
Fix line numbering for patches with eofnl
When a patch contained an eofnl change (i.e. the last line either gained or lost a newline), the oldno and newno line number values for the lines in the last hunk of the patch were not useful. This makes them behave in a more expected manner.
Diffstat (limited to 'src/diff_output.c')
-rw-r--r--src/diff_output.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/diff_output.c b/src/diff_output.c
index dda0f534d..2214ae1b5 100644
--- a/src/diff_output.c
+++ b/src/diff_output.c
@@ -930,11 +930,13 @@ static int diff_patch_line_cb(
switch (line_origin) {
case GIT_DIFF_LINE_ADDITION:
+ case GIT_DIFF_LINE_DEL_EOFNL:
line->oldno = -1;
line->newno = patch->newno;
patch->newno += line->lines;
break;
case GIT_DIFF_LINE_DELETION:
+ case GIT_DIFF_LINE_ADD_EOFNL:
line->oldno = patch->oldno;
line->newno = -1;
patch->oldno += line->lines;