Skip to content

Commit

Permalink
Handle cases correctly when converting to unified diffs.
Browse files Browse the repository at this point in the history
@@ sections with strings already have the newline character at the end.
For those without  dont print output with added space.
  • Loading branch information
AceHusky12 committed Jul 12, 2022
1 parent 531c807 commit 3a36a54
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion unify.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,11 @@ generate_output()

i = o_first ? o_last - o_first + 1 : 0;
j = n_first ? n_last - n_first + 1 : 0;
printf("@@ -%ld,%ld +%ld,%ld @@ %s\n", o_first, i, n_first, j,pstuff);
if (strlen(pstuff) == 0)
printf("@@ -%ld,%ld +%ld,%ld @@\n", o_first, i, n_first, j);
else
printf("@@ -%ld,%ld +%ld,%ld @@ %s", o_first, i, n_first, j,
pstuff);
for (line = root.link; line; line = hold) {
printf("%c%s", use_equals && line->type == ' '? '=' : line->type,
line->str);
Expand Down

0 comments on commit 3a36a54

Please sign in to comment.