Add a test-case for git-apply trying to add an ending line
[gitweb.git] / diff-tree.c
index e5787985373739dee8dd8874ea9f8f6ff073af27..69bb74b3100d598c938fa01f1111deb85abcfac0 100644 (file)
@@ -71,6 +71,7 @@ int main(int argc, const char **argv)
        nr_sha1 = 0;
        init_revisions(opt);
        opt->abbrev = 0;
+       opt->diff = 1;
        argc = setup_revisions(argc, argv, opt, NULL);
 
        while (--argc > 0) {
@@ -137,7 +138,10 @@ int main(int argc, const char **argv)
                opt->diffopt.setup |= (DIFF_SETUP_USE_SIZE_CACHE |
                                       DIFF_SETUP_USE_CACHE);
        while (fgets(line, sizeof(line), stdin))
-               diff_tree_stdin(line);
+               if (line[0] == '\n')
+                       fflush(stdout);
+               else
+                       diff_tree_stdin(line);
 
        return 0;
 }