Merge branch 'nd/format-patch-cover-letter-stat-width'
authorJunio C Hamano <gitster@pobox.com>
Mon, 19 Nov 2018 07:24:40 +0000 (16:24 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 19 Nov 2018 07:24:40 +0000 (16:24 +0900)
"git format-patch --stat=<width>" can be used to specify the width
used by the diffstat (shown in the cover letter).

* nd/format-patch-cover-letter-stat-width:
format-patch: respect --stat in cover letter's diffstat

1  2 
builtin/log.c
diff --cc builtin/log.c
index 9f2d9872946dfd7fe527a7f3822d9be23aa5ec83,e0ae6aad4356dcdd1995853498aa43b9f24ab96d..0fe6f9ba1e94ec496f2e083ca964592272d898f2
@@@ -1004,26 -998,6 +1004,24 @@@ static char *find_branch_name(struct re
        return branch;
  }
  
-       opts.stat_width = MAIL_DEFAULT_WRAP;
 +static void show_diffstat(struct rev_info *rev,
 +                        struct commit *origin, struct commit *head)
 +{
 +      struct diff_options opts;
 +
 +      memcpy(&opts, &rev->diffopt, sizeof(opts));
 +      opts.output_format = DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
 +      diff_setup_done(&opts);
 +
 +      diff_tree_oid(get_commit_tree_oid(origin),
 +                    get_commit_tree_oid(head),
 +                    "", &opts);
 +      diffcore_std(&opts);
 +      diff_flush(&opts);
 +
 +      fprintf(rev->diffopt.file, "\n");
 +}
 +
  static void make_cover_letter(struct rev_info *rev, int use_stdout,
                              struct commit *origin,
                              int nr, struct commit **list,