Prevent send-pack from segfaulting when a branch doesn't match
[gitweb.git] / builtin-stripspace.c
index 55716873dc4f4a8baa5f2b37d6dca1de488b38e4..916355ca5d04ec571d4100c98b969b693c830a18 100644 (file)
@@ -76,6 +76,11 @@ int cmd_stripspace(int argc, const char **argv, const char *prefix)
 {
        char *buffer;
        unsigned long size;
+       int strip_comments = 0;
+
+       if (argc > 1 && (!strcmp(argv[1], "-s") ||
+                               !strcmp(argv[1], "--strip-comments")))
+               strip_comments = 1;
 
        size = 1024;
        buffer = xmalloc(size);
@@ -84,7 +89,7 @@ int cmd_stripspace(int argc, const char **argv, const char *prefix)
                die("could not read the input");
        }
 
-       size = stripspace(buffer, size, 0);
+       size = stripspace(buffer, size, strip_comments);
        write_or_die(1, buffer, size);
        if (size)
                putc('\n', stdout);