]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-log.c
Merge branch 'jc/maint-diff-quiet'
[git.git] / builtin-log.c
index 3a7957483031758af5c05afc55a499e617557f1c..1d3c5cbf580f3989d9605ed68f80beb050e19d39 100644 (file)
@@ -470,7 +470,7 @@ static int extra_cc_alloc;
 static void add_header(const char *value)
 {
        int len = strlen(value);
-       while (value[len - 1] == '\n')
+       while (len && value[len - 1] == '\n')
                len--;
        if (!strncasecmp(value, "to: ", 4)) {
                ALLOC_GROW(extra_to, extra_to_nr + 1, extra_to_alloc);
@@ -932,7 +932,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
        if (argc > 1)
                die ("unrecognized argument: %s", argv[1]);
 
-       if (!rev.diffopt.output_format)
+       if (!rev.diffopt.output_format
+               || rev.diffopt.output_format == DIFF_FORMAT_PATCH)
                rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH;
 
        if (!DIFF_OPT_TST(&rev.diffopt, TEXT) && !no_binary_diff)