summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-05-26 22:27:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-05-26 22:47:20 (GMT)
commit8b8a53744f60274ef07e3a2a51995129c8d42f38 (patch)
tree003d6020e014d51269a9b299f5a829b70194227e /builtin
parent5b38456ec7bd0229bb35146ab8a905c4b63daeec (diff)
downloadgit-8b8a53744f60274ef07e3a2a51995129c8d42f38.zip
git-8b8a53744f60274ef07e3a2a51995129c8d42f38.tar.gz
git-8b8a53744f60274ef07e3a2a51995129c8d42f38.tar.bz2
pretty: add pp_commit_easy function for simple callers
Many callers don't actually care about the pretty print context at all; let's just give them a simple way of pretty-printing a commit without having to create a context struct. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/branch.c4
-rw-r--r--builtin/checkout.c3
-rw-r--r--builtin/log.c4
-rw-r--r--builtin/shortlog.c3
-rw-r--r--builtin/show-branch.c3
5 files changed, 5 insertions, 12 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index 9e546e4..d8f1522 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -436,9 +436,7 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,
commit = item->commit;
if (commit && !parse_commit(commit)) {
- struct pretty_print_context ctx = {0};
- pretty_print_commit(CMIT_FMT_ONELINE, commit,
- &subject, &ctx);
+ pp_commit_easy(CMIT_FMT_ONELINE, commit, &subject);
sub = subject.buf;
}
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 757f9a0..c1759dc 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -300,9 +300,8 @@ static void show_local_changes(struct object *head, struct diff_options *opts)
static void describe_detached_head(char *msg, struct commit *commit)
{
struct strbuf sb = STRBUF_INIT;
- struct pretty_print_context ctx = {0};
parse_commit(commit);
- pretty_print_commit(CMIT_FMT_ONELINE, commit, &sb, &ctx);
+ pp_commit_easy(CMIT_FMT_ONELINE, commit, &sb);
fprintf(stderr, "%s %s... %s\n", msg,
find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV), sb.buf);
strbuf_release(&sb);
diff --git a/builtin/log.c b/builtin/log.c
index d8c6c28..cedfdb6 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1439,9 +1439,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
if (verbose) {
struct strbuf buf = STRBUF_INIT;
- struct pretty_print_context ctx = {0};
- pretty_print_commit(CMIT_FMT_ONELINE, commit,
- &buf, &ctx);
+ pp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);
printf("%c %s %s\n", sign,
find_unique_abbrev(commit->object.sha1, abbrev),
buf.buf);
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 1a21e4b..90877b5 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -141,9 +141,8 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
const char *author = NULL, *buffer;
struct strbuf buf = STRBUF_INIT;
struct strbuf ufbuf = STRBUF_INIT;
- struct pretty_print_context ctx = {0};
- pretty_print_commit(CMIT_FMT_RAW, commit, &buf, &ctx);
+ pp_commit_easy(CMIT_FMT_RAW, commit, &buf);
buffer = buf.buf;
while (*buffer && *buffer != '\n') {
const char *eol = strchr(buffer, '\n');
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index da69581..a5fc2aa 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -293,8 +293,7 @@ static void show_one_commit(struct commit *commit, int no_name)
struct commit_name *name = commit->util;
if (commit->object.parsed) {
- struct pretty_print_context ctx = {0};
- pretty_print_commit(CMIT_FMT_ONELINE, commit, &pretty, &ctx);
+ pp_commit_easy(CMIT_FMT_ONELINE, commit, &pretty);
pretty_str = pretty.buf;
}
if (!prefixcmp(pretty_str, "[PATCH] "))