diff options
author | Daniel Barkalow <barkalow@iabervon.org> | 2008-02-28 12:14:13 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-02-29 00:00:29 -0800 |
commit | 39fe578bdcc318308bc5d75efa04bd4bfc3a4f23 (patch) | |
tree | e9dd1c4d192cee8e7b8a788f7a2924f608a38c99 /builtin-log.c | |
parent | 00183cbb3d0f60852d7286e766c9b631c0c1f952 (diff) | |
download | git-39fe578bdcc318308bc5d75efa04bd4bfc3a4f23.tar.gz |
Use diff_tree() directly in making cover letter
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-log.c')
-rw-r--r-- | builtin-log.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/builtin-log.c b/builtin-log.c index 836b61ec57..bbadbc0de2 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -647,8 +647,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, int nr, struct commit **list, struct commit *head) { const char *committer; - const char *origin_sha1, *head_sha1; - const char *argv[7]; + char *head_sha1; const char *subject_start = NULL; const char *body = "*** SUBJECT HERE ***\n\n*** BLURB HERE ***\n"; const char *msg; @@ -657,6 +656,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, struct strbuf sb; int i; const char *encoding = "utf-8"; + struct diff_options opts; if (rev->commit_format != CMIT_FMT_EMAIL) die("Cover letter needs email format"); @@ -694,20 +694,17 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, if (!origin) return; - origin_sha1 = sha1_to_hex(origin->object.sha1); + diff_setup(&opts); + opts.output_format |= DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT; - argv[0] = "diff"; - argv[1] = "--stat"; - argv[2] = "--summary"; - argv[3] = head_sha1; - argv[4] = "--not"; - argv[5] = origin_sha1; - argv[6] = "--"; - argv[7] = NULL; - fflush(stdout); - run_command_v_opt(argv, RUN_GIT_CMD); + diff_setup_done(&opts); + + diff_tree_sha1(origin->tree->object.sha1, + head->tree->object.sha1, + "", &opts); + diffcore_std(&opts); + diff_flush(&opts); - fflush(stdout); printf("\n"); } |