@matheusbsbs / matheus-bagliano / commits / 4602c17d89
Fork 0

git-shortlog -e: show e-mail address as well

This option shows the author's email address next to the name. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Dec 7, 2007 at 17:19 UTC 4602c17d8911e14d537f6f87db02faab6e3f5d69
1 file changed +12
builtin-shortlog.c
+12
@@ -11,6 +11,7 @@ static const char shortlog_usage[] =
11 "git-shortlog [-n] [-s] [<commit-id>... ]";
12
13 static char *common_repo_prefix;
14 +static int email;
15
16 static int compare_by_number(const void *a1, const void *a2)
17 {
@@ -57,6 +58,14 @@ static void insert_one_record(struct path_list *list,
58 len--;
59 namebuf[len] = '\0';
60 }
61 + else
62 + len = strlen(namebuf);
63 +
64 + if (email) {
65 + size_t room = sizeof(namebuf) - len - 1;
66 + int maillen = eoemail - boemail + 1;
67 + snprintf(namebuf + len, room, " %.*s", maillen, boemail);
68 + }
69
70 buffer = xstrdup(namebuf);
71 item = path_list_insert(buffer, list);
@@ -219,6 +228,9 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
228 else if (!strcmp(argv[1], "-s") ||
229 !strcmp(argv[1], "--summary"))
230 summary = 1;
231 + else if (!strcmp(argv[1], "-e") ||
232 + !strcmp(argv[1], "--email"))
233 + email = 1;
234 else if (!prefixcmp(argv[1], "-w")) {
235 wrap_lines = 1;
236 parse_wrap_args(argv[1], &in1, &in2, &wrap);