In addition to fixing obvious command line parsing bugs in the
previous round, this changes the following:
* Adds "--whitespace=strip". This applies after stripping the
new trailing whitespaces introduced to the patch.
* The output error message format is changed to say
"patch-filename:linenumber:contents of the line". This makes
it similar to typical compiler error message format, and
helps C-x ` (next-error) in Emacs compilation buffer.
* --whitespace=error and --whitespace=warn do not stop at the
first error. We might want to limit the output to say first
20 such lines to prevent cluttering, but on the other hand if
you are willing to hand-fix after inspecting them, getting
everything with a single run might be easier to work with.
After all, somebody has to do the clean-up work somewhere.
Signed-off-by: Junio C Hamano <junkio@cox.net>
* For "diff-stat" like behaviour, we keep track of the biggest change
@ -823,19 +826,17 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
@@ -823,19 +826,17 @@ static int parse_fragment(char *line, unsigned long size, struct patch *patch, s
case '+':
/*
* We know len is at least two, since we have a '+' and
* we checked that the last character was a '\n' above
* we checked that the last character was a '\n' above.
* That is, an addition of an empty line would check
* the '+' here. Sneaky...
*/
if (isspace(line[len-2])) {
switch (new_whitespace) {
case nowarn:
break;
case warn_on_whitespace:
new_whitespace = nowarn; /* Just once */
error("Added whitespace at end of line at line %d", linenr);
break;
case error_on_whitespace:
die("Added whitespace at end of line at line %d", linenr);