log: add --use-mailmap option
Add the --use-mailmap option to log commands. It allows to display names from mailmap file when displaying logs, whatever the format used. Signed-off-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Antoine Pelisse committed
Jan 5, 2013 at 22:26 UTC
ea57bc0d41b03cc1528be5fafa5eb8bfd4f773cb
2 files changed
+13
-1
Documentation/git-log.txt
+5
@@ -47,6 +47,11 @@ OPTIONS
47
Print out the ref name given on the command line by which each
48
commit was reached.
49
50
+--use-mailmap::
51
+ Use mailmap file to map author and committer names and email
52
+ to canonical real names and email addresses. See
53
+ linkgit:git-shortlog[1].
54
+
55
--full-diff::
56
Without this flag, "git log -p <path>..." shows commits that
57
touch the specified paths, and diffs about the same specified
builtin/log.c
+8
-1
@@ -22,6 +22,7 @@
22
#include "branch.h"
23
#include "streaming.h"
24
#include "version.h"
25
+#include "mailmap.h"
26
27
/* Set a default date-time format for git log ("log.date" config variable) */
28
static const char *default_date_mode = NULL;
@@ -94,11 +95,12 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
95
struct rev_info *rev, struct setup_revision_opt *opt)
96
{
97
struct userformat_want w;
97
- int quiet = 0, source = 0;
98
+ int quiet = 0, source = 0, mailmap = 0;
99
100
const struct option builtin_log_options[] = {
101
OPT_BOOLEAN(0, "quiet", &quiet, N_("suppress diff output")),
102
OPT_BOOLEAN(0, "source", &source, N_("show source")),
103
+ OPT_BOOLEAN(0, "use-mailmap", &mailmap, N_("Use mail map file")),
104
{ OPTION_CALLBACK, 0, "decorate", NULL, NULL, N_("decorate options"),
105
PARSE_OPT_OPTARG, decorate_callback},
106
OPT_END()
@@ -136,6 +138,11 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
138
if (source)
139
rev->show_source = 1;
140
141
+ if (mailmap) {
142
+ rev->mailmap = xcalloc(1, sizeof(struct string_list));
143
+ read_mailmap(rev->mailmap, NULL);
144
+ }
145
+
146
if (rev->pretty_given && rev->commit_format == CMIT_FMT_RAW) {
147
/*
148
* "log --pretty=raw" is special; ignore UI oriented