Merge branch 'jk/format-patch-am'
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index ba5f7aa2173a7494b56395bfd88ab6228b5ed1fe..8f4815bfd7d798f2a99131cd2e79155e933c7876 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1117,8 +1117,16 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
                        emit_line(ecbdata->opt, plain, reset, line, len);
                        fputs("~\n", ecbdata->opt->file);
                } else {
-                       /* don't print the prefix character */
-                       emit_line(ecbdata->opt, plain, reset, line+1, len-1);
+                       /*
+                        * Skip the prefix character, if any.  With
+                        * diff_suppress_blank_empty, there may be
+                        * none.
+                        */
+                       if (line[0] != '\n') {
+                             line++;
+                             len--;
+                       }
+                       emit_line(ecbdata->opt, plain, reset, line, len);
                }
                return;
        }