summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/blame.c2
-rw-r--r--builtin/check-mailmap.c2
-rw-r--r--builtin/commit.c2
-rw-r--r--builtin/log.c2
-rw-r--r--builtin/shortlog.c16
-rw-r--r--mailmap.c48
-rw-r--r--mailmap.h2
-rw-r--r--pretty.c2
-rw-r--r--shortlog.h1
9 files changed, 21 insertions, 56 deletions
diff --git a/builtin/blame.c b/builtin/blame.c
index 6f7e32411a..712ae8e742 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1151,7 +1151,7 @@ parse_done:
sb.xdl_opts = xdl_opts;
sb.no_whole_file_rename = no_whole_file_rename;
- read_mailmap(&mailmap, NULL);
+ read_mailmap(&mailmap);
sb.found_guilty_entry = &found_guilty_entry;
sb.found_guilty_entry_data = π
diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c
index cdce144f3b..7dc47e4793 100644
--- a/builtin/check-mailmap.c
+++ b/builtin/check-mailmap.c
@@ -47,7 +47,7 @@ int cmd_check_mailmap(int argc, const char **argv, const char *prefix)
if (argc == 0 && !use_stdin)
die(_("no contacts specified"));
- read_mailmap(&mailmap, NULL);
+ read_mailmap(&mailmap);
for (i = 0; i < argc; ++i)
check_mailmap(&mailmap, argv[i]);
diff --git a/builtin/commit.c b/builtin/commit.c
index 505fe60956..739110c5a7 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1039,7 +1039,7 @@ static const char *find_author_by_nickname(const char *name)
av[++ac] = NULL;
setup_revisions(ac, av, &revs, NULL);
revs.mailmap = &mailmap;
- read_mailmap(revs.mailmap, NULL);
+ read_mailmap(revs.mailmap);
if (prepare_revision_walk(&revs))
die(_("revision walk setup failed"));
diff --git a/builtin/log.c b/builtin/log.c
index bd6ff4f9f9..4ee81bc976 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -230,7 +230,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
if (mailmap) {
rev->mailmap = xcalloc(1, sizeof(struct string_list));
- read_mailmap(rev->mailmap, NULL);
+ read_mailmap(rev->mailmap);
}
if (rev->pretty_given && rev->commit_format == CMIT_FMT_RAW) {
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index c52e4ccd19..e7c21ab620 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -61,8 +61,7 @@ static void insert_one_record(struct shortlog *log,
if (log->summary)
item->util = (void *)(UTIL_TO_INT(item) + 1);
else {
- const char *dot3 = log->common_repo_prefix;
- char *buffer, *p;
+ char *buffer;
struct strbuf subject = STRBUF_INIT;
const char *eol;
@@ -82,17 +81,6 @@ static void insert_one_record(struct shortlog *log,
format_subject(&subject, oneline, " ");
buffer = strbuf_detach(&subject, NULL);
- if (dot3) {
- int dot3len = strlen(dot3);
- if (dot3len > 5) {
- while ((p = strstr(buffer, dot3)) != NULL) {
- int taillen = strlen(p) - dot3len;
- memcpy(p, "/.../", 5);
- memmove(p + 5, p + dot3len, taillen + 1);
- }
- }
- }
-
if (item->util == NULL)
item->util = xcalloc(1, sizeof(struct string_list));
string_list_append(item->util, buffer);
@@ -342,7 +330,7 @@ void shortlog_init(struct shortlog *log)
{
memset(log, 0, sizeof(*log));
- read_mailmap(&log->mailmap, &log->common_repo_prefix);
+ read_mailmap(&log->mailmap);
log->list.strdup_strings = 1;
log->wrap = DEFAULT_WRAPLEN;
diff --git a/mailmap.c b/mailmap.c
index 962fd86d6d..eb77c6e77c 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -143,31 +143,13 @@ static char *parse_name_and_email(char *buffer, char **name,
return (*right == '\0' ? NULL : right);
}
-static void read_mailmap_line(struct string_list *map, char *buffer,
- char **repo_abbrev)
+static void read_mailmap_line(struct string_list *map, char *buffer)
{
char *name1 = NULL, *email1 = NULL, *name2 = NULL, *email2 = NULL;
- if (buffer[0] == '#') {
- static const char abbrev[] = "# repo-abbrev:";
- int abblen = sizeof(abbrev) - 1;
- int len = strlen(buffer);
- if (!repo_abbrev)
- return;
-
- if (len && buffer[len - 1] == '\n')
- buffer[--len] = 0;
- if (!strncmp(buffer, abbrev, abblen)) {
- char *cp;
-
- free(*repo_abbrev);
-
- for (cp = buffer + abblen; isspace(*cp); cp++)
- ; /* nothing */
- *repo_abbrev = xstrdup(cp);
- }
+ if (buffer[0] == '#')
return;
- }
+
if ((name2 = parse_name_and_email(buffer, &name1, &email1, 0)) != NULL)
parse_name_and_email(name2, &name2, &email2, 1);
@@ -175,8 +157,7 @@ static void read_mailmap_line(struct string_list *map, char *buffer,
add_mapping(map, name1, email1, name2, email2);
}
-static int read_mailmap_file(struct string_list *map, const char *filename,
- char **repo_abbrev)
+static int read_mailmap_file(struct string_list *map, const char *filename)
{
char buffer[1024];
FILE *f;
@@ -192,13 +173,12 @@ static int read_mailmap_file(struct string_list *map, const char *filename,
}
while (fgets(buffer, sizeof(buffer), f) != NULL)
- read_mailmap_line(map, buffer, repo_abbrev);
+ read_mailmap_line(map, buffer);
fclose(f);
return 0;
}
-static void read_mailmap_string(struct string_list *map, char *buf,
- char **repo_abbrev)
+static void read_mailmap_string(struct string_list *map, char *buf)
{
while (*buf) {
char *end = strchrnul(buf, '\n');
@@ -206,14 +186,12 @@ static void read_mailmap_string(struct string_list *map, char *buf,
if (*end)
*end++ = '\0';
- read_mailmap_line(map, buf, repo_abbrev);
+ read_mailmap_line(map, buf);
buf = end;
}
}
-static int read_mailmap_blob(struct string_list *map,
- const char *name,
- char **repo_abbrev)
+static int read_mailmap_blob(struct string_list *map, const char *name)
{
struct object_id oid;
char *buf;
@@ -231,13 +209,13 @@ static int read_mailmap_blob(struct string_list *map,
if (type != OBJ_BLOB)
return error("mailmap is not a blob: %s", name);
- read_mailmap_string(map, buf, repo_abbrev);
+ read_mailmap_string(map, buf);
free(buf);
return 0;
}
-int read_mailmap(struct string_list *map, char **repo_abbrev)
+int read_mailmap(struct string_list *map)
{
int err = 0;
@@ -247,10 +225,10 @@ int read_mailmap(struct string_list *map, char **repo_abbrev)
if (!git_mailmap_blob && is_bare_repository())
git_mailmap_blob = "HEAD:.mailmap";
- err |= read_mailmap_file(map, ".mailmap", repo_abbrev);
+ err |= read_mailmap_file(map, ".mailmap");
if (startup_info->have_repository)
- err |= read_mailmap_blob(map, git_mailmap_blob, repo_abbrev);
- err |= read_mailmap_file(map, git_mailmap_file, repo_abbrev);
+ err |= read_mailmap_blob(map, git_mailmap_blob);
+ err |= read_mailmap_file(map, git_mailmap_file);
return err;
}
diff --git a/mailmap.h b/mailmap.h
index d0e65646cb..7e99fccb46 100644
--- a/mailmap.h
+++ b/mailmap.h
@@ -3,7 +3,7 @@
struct string_list;
-int read_mailmap(struct string_list *map, char **repo_abbrev);
+int read_mailmap(struct string_list *map);
void clear_mailmap(struct string_list *map);
int map_user(struct string_list *map,
diff --git a/pretty.c b/pretty.c
index 05eef7fda0..3922f6f9f2 100644
--- a/pretty.c
+++ b/pretty.c
@@ -679,7 +679,7 @@ static int mailmap_name(const char **email, size_t *email_len,
static struct string_list *mail_map;
if (!mail_map) {
mail_map = xcalloc(1, sizeof(*mail_map));
- read_mailmap(mail_map, NULL);
+ read_mailmap(mail_map);
}
return mail_map->nr && map_user(mail_map, email, email_len, name, name_len);
}
diff --git a/shortlog.h b/shortlog.h
index 64be879b24..3f7e9aabca 100644
--- a/shortlog.h
+++ b/shortlog.h
@@ -23,7 +23,6 @@ struct shortlog {
} groups;
struct string_list trailers;
- char *common_repo_prefix;
int email;
struct string_list mailmap;
FILE *file;