summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1e5aaa6)
raw | patch | inline | side by side (parent: 1e5aaa6)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Mon, 14 Jul 2008 18:08:52 +0000 (19:08 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 15 Jul 2008 14:37:00 +0000 (07:37 -0700) |
With this patch, the user can override the default setting, to print
the commit messages using a user format instead of the onelines of the
commits. Example:
$ git shortlog --pretty='format:%s (%h)' <commit>..
Note that shortlog will only respect a user format setting, as the other
formats do not make much sense.
Wished for by Andrew Morton.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
the commit messages using a user format instead of the onelines of the
commits. Example:
$ git shortlog --pretty='format:%s (%h)' <commit>..
Note that shortlog will only respect a user format setting, as the other
formats do not make much sense.
Wished for by Andrew Morton.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-shortlog.c | patch | blob | history | |
shortlog.h | patch | blob | history |
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 01362022c0990cc785d7bcc77f21802c5e75b3e2..f8bcbfce4009337c4aea0b923a620fc4697e4df3 100644 (file)
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
if (!author)
die("Missing author: %s",
sha1_to_hex(commit->object.sha1));
+ if (log->user_format) {
+ struct strbuf buf = STRBUF_INIT;
+
+ pretty_print_commit(CMIT_FMT_USERFORMAT, commit, &buf,
+ DEFAULT_ABBREV, "", "", DATE_NORMAL, 0);
+ insert_one_record(log, author, buf.buf);
+ strbuf_release(&buf);
+ return;
+ }
if (*buffer)
buffer++;
insert_one_record(log, author, !*buffer ? "<none>" : buffer);
usage_with_options(shortlog_usage, options);
}
+ log.user_format = rev.commit_format == CMIT_FMT_USERFORMAT;
+
/* assume HEAD if from a tty */
if (!nongit && !rev.pending.nr && isatty(0))
add_head_to_pending(&rev);
diff --git a/shortlog.h b/shortlog.h
index 31ff491b7448f69385cddb640819e7ea14e2fb3e..6608ee80b08881146b2678dba3120a036b69cc28 100644 (file)
--- a/shortlog.h
+++ b/shortlog.h
int wrap;
int in1;
int in2;
+ int user_format;
char *common_repo_prefix;
int email;