From: Daniel Barkalow <barkalow@iabervon.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH] Use diff_tree() directly in making cover letter
Date: Thu, 28 Feb 2008 12:14:13 -0500 (EST) [thread overview]
Message-ID: <alpine.LNX.1.00.0802281213140.19665@iabervon.org> (raw)
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
builtin-log.c | 25 +++++++++++--------------
1 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index 836b61e..bbadbc0 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");
}
--
1.5.4.3.328.gcaed
next reply other threads:[~2008-02-28 17:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-28 17:14 Daniel Barkalow [this message]
2008-02-28 17:38 ` [PATCH] Use diff_tree() directly in making cover letter Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.1.00.0802281213140.19665@iabervon.org \
--to=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).