Merge branch 'jc/combined'
authorJunio C Hamano <junkio@cox.net>
Thu, 26 Oct 2006 09:07:18 +0000 (02:07 -0700)
committerJunio C Hamano <junkio@cox.net>
Thu, 26 Oct 2006 09:07:18 +0000 (02:07 -0700)
* jc/combined:
combine-diff: honour --no-commit-id
combine-diff: fix hunk_comment_line logic.

1  2 
combine-diff.c
diff --combined combine-diff.c
index 466156fb4dba2e7349fa9aa28a89907c0dbf56ff,8bf99f215c36c701bb3ff2ffc952587b8562c920..29d0c9cf953fdc13bd44bef451d242c762e1c611
@@@ -491,7 -491,11 +491,11 @@@ static void show_parent_lno(struct slin
  
  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 +741,7 @@@ static void show_patch_diff(struct comb
                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 +819,7 @@@ static void show_raw_diff(struct combin
        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,17 -891,15 +891,17 @@@ void diff_tree_combined(const unsigned 
        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);
                        }
                        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)