Merge branch 'jk/test'
authorJunio C Hamano <gitster@pobox.com>
Sun, 22 Jun 2008 21:33:02 +0000 (14:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 22 Jun 2008 21:33:02 +0000 (14:33 -0700)
* jk/test:
enable whitespace checking of test scripts
avoid trailing whitespace in zero-change diffstat lines
avoid whitespace on empty line in automatic usage message
mask necessary whitespace policy violations in test scripts
fix whitespace violations in test scripts

1  2 
diff.c
diff --combined diff.c
index 526249008662d4041e5623914c1a420f3443c4d4,f77f9e944776e8b0bc684b7618227cf437cf6053..44e8790690ebdfa45ff7d6c89ede85e8f4f9e857
--- 1/diff.c
--- 2/diff.c
+++ b/diff.c
@@@ -514,15 -514,9 +514,15 @@@ const char *diff_get_color(int diff_use
  
  static void emit_line(FILE *file, const char *set, const char *reset, const char *line, int len)
  {
 +      int has_trailing_newline = (len > 0 && line[len-1] == '\n');
 +      if (has_trailing_newline)
 +              len--;
 +
        fputs(set, file);
        fwrite(line, len, 1, file);
        fputs(reset, file);
 +      if (has_trailing_newline)
 +              fputc('\n', file);
  }
  
  static void emit_add_line(const char *reset, struct emit_callback *ecbdata, const char *line, int len)
@@@ -928,7 -922,8 +928,8 @@@ static void show_stats(struct diffstat_
                        total = add + del;
                }
                show_name(options->file, prefix, name, len, reset, set);
-               fprintf(options->file, "%5d ", added + deleted);
+               fprintf(options->file, "%5d%s", added + deleted,
+                               added + deleted ? " " : "");
                show_graph(options->file, '+', add, add_c, reset);
                show_graph(options->file, '-', del, del_c, reset);
                fprintf(options->file, "\n");