From f653aee5a37b909e772d612eb7e226f09fd2f3d3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 23 Jul 2007 12:58:27 +0100 Subject: Teach "git stripspace" the --strip-comments option With --strip-comments (or short -s), git stripspace now removes lines beginning with a '#', too. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- builtin-stripspace.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'builtin-stripspace.c') diff --git a/builtin-stripspace.c b/builtin-stripspace.c index 55716873d..916355ca5 100644 --- a/builtin-stripspace.c +++ b/builtin-stripspace.c @@ -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); -- cgit v1.2.1