X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=combine-diff.c;h=29d0c9cf953fdc13bd44bef451d242c762e1c611;hb=60c0f8462fefed22fc8fb9c4e529665ed8204536;hp=01a8437f5c837f30eb463d19b98774d56f182283;hpb=d5f6a01af0658bc0ec5f068d81ba321be94526d5;p=git.git diff --git a/combine-diff.c b/combine-diff.c index 01a8437f5..29d0c9cf9 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -491,7 +491,11 @@ static void show_parent_lno(struct sline *sline, unsigned long l0, unsigned long static int hunk_comment_line(const char *bol) { - int ch = *bol & 0xff; + int ch; + + if (!bol) + return 0; + ch = *bol & 0xff; return (isalpha(ch) || ch == '_' || ch == '$'); } @@ -737,7 +741,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, int added = 0; int deleted = 0; - if (rev->loginfo) + if (rev->loginfo && !rev->no_commit_id) show_log(rev, opt->msg_sep); dump_quoted_path(dense ? "diff --cc " : "diff --combined ", elem->path, c_meta, c_reset); @@ -815,7 +819,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re if (!line_termination) inter_name_termination = 0; - if (rev->loginfo) + if (rev->loginfo && !rev->no_commit_id) show_log(rev, opt->msg_sep); if (opt->output_format & DIFF_FORMAT_RAW) { @@ -887,15 +891,17 @@ void diff_tree_combined(const unsigned char *sha1, diffopts.output_format = DIFF_FORMAT_NO_OUTPUT; diffopts.recursive = 1; - show_log_first = !!rev->loginfo; + show_log_first = !!rev->loginfo && !rev->no_commit_id; needsep = 0; /* find set of paths that everybody touches */ for (i = 0; i < num_parent; i++) { /* show stat against the first parent even * when doing combined diff. */ - if (i == 0 && opt->output_format & DIFF_FORMAT_DIFFSTAT) - diffopts.output_format = DIFF_FORMAT_DIFFSTAT; + int stat_opt = (opt->output_format & + (DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT)); + if (i == 0 && stat_opt) + diffopts.output_format = stat_opt; else diffopts.output_format = DIFF_FORMAT_NO_OUTPUT; diff_tree_sha1(parent[i], sha1, "", &diffopts); @@ -925,7 +931,8 @@ void diff_tree_combined(const unsigned char *sha1, } needsep = 1; } - else if (opt->output_format & DIFF_FORMAT_DIFFSTAT) + else if (opt->output_format & + (DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT)) needsep = 1; if (opt->output_format & DIFF_FORMAT_PATCH) { if (needsep)