From 8c473cecfd8835c2bdf34b323e1b2de620099c04 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 13 Dec 2012 08:04:47 -0500 Subject: mailmap: default mailmap.blob in bare repositories The motivation for mailmap.blob is to let users of bare repositories use the mailmap feature, as they would not have a checkout containing the .mailmap file. We can make it even easier for them by just looking in HEAD:.mailmap by default. We can't know for sure that this is where they would keep a mailmap, of course, but it is the best guess (and it matches the non-bare behavior, which reads from HEAD:.mailmap in the working tree). If it's missing, git will silently ignore the setting. We do not do the same magic in the non-bare case, because: 1. In the common case, HEAD:.mailmap will be the same as the .mailmap in the working tree, which is a no-op. 2. In the uncommon case, the user has modified .mailmap but not yet committed it, and would expect the working tree version to take precedence. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- mailmap.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mailmap.c') diff --git a/mailmap.c b/mailmap.c index 5ffe48a604..b16542febe 100644 --- a/mailmap.c +++ b/mailmap.c @@ -233,7 +233,12 @@ static int read_mailmap_blob(struct string_list *map, int read_mailmap(struct string_list *map, char **repo_abbrev) { int err = 0; + map->strdup_strings = 1; + + if (!git_mailmap_blob && is_bare_repository()) + git_mailmap_blob = "HEAD:.mailmap"; + err |= read_mailmap_file(map, ".mailmap", repo_abbrev); err |= read_mailmap_blob(map, git_mailmap_blob, repo_abbrev); err |= read_mailmap_file(map, git_mailmap_file, repo_abbrev); -- cgit v1.2.1