filterdiff: Fix header output. - #13
Conversation
When outputting header lines, apply prefix changes only to lines starting with "---" and "+++" but also apply these changes to arguments of a possibly diff command line. Adapt tests/fullheader4/run-test and remove it from XFAIL_TESTS. This fixes twaugh#12.
twaugh
left a comment
There was a problem hiding this comment.
This looks great, thanks! Added a couple of notes, nothing major though.
| } | ||
| if (strncmp(line, "diff", 4) == 0 && isspace(line[4])) { | ||
| size_t args = 0; | ||
| const char *end = line + 5, *begin = end, *ws = end;; |
There was a problem hiding this comment.
There's an extra semi-colon at the end of the line here.
| if (new_prefix_to_add && strncmp (line, "+++", 3) == 0) | ||
| fputs (new_prefix_to_add, stdout); | ||
| } | ||
| if (strncmp(line, "diff", 4) == 0 && isspace(line[4])) { |
There was a problem hiding this comment.
The project style is to have a space between the function name and the opening parenthesis.
| [ -s errors ] && { cat errors; exit 1; } | ||
| cmp output <<"EOF" || exit 1 | ||
| diff --git a/test.txt b/test.txt | ||
| diff --git test.txt test.txt |
|
On Thu, Sep 15, 2016 at 11:17:16AM -0700, thus spake Tim Waugh:
Sure, my bad.
Oh yeah, these escaped my attention.
I'm not 100% sure about the sense of this, as the resulting diff Cheers, Ignacy |
When outputting header lines, apply prefix changes only to lines
starting with "---" and "+++" but also apply these changes to
arguments of a possibly diff command line.
Adapt tests/fullheader4/run-test and remove it from XFAIL_TESTS.
This fixes #12.