mailmap: do not resolve blobs in a non-repository

The mailmap code may be triggered outside of a repository by git-shortlog. There is no point in looking up a name like "HEAD:.mailmap" there; without a repository, we have no refs. This is unlikely to matter much in practice for the current code, as we would simply fail to find the ref. But as the refs code learns about new backends, this is more important; without a repository, we do not even know which backend to look at. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Mar 5, 2016 at 17:13 UTC 5735dc5a0df5de12b28237ff2c41df6df5f67b81
1 file changed +2 -1
mailmap.c
+2 -1
@@ -250,7 +250,8 @@ int read_mailmap(struct string_list *map, char **repo_abbrev)
250 git_mailmap_blob = "HEAD:.mailmap";
251
252 err |= read_mailmap_file(map, ".mailmap", repo_abbrev);
253 - err |= read_mailmap_blob(map, git_mailmap_blob, repo_abbrev);
253 + if (startup_info->have_repository)
254 + err |= read_mailmap_blob(map, git_mailmap_blob, repo_abbrev);
255 err |= read_mailmap_file(map, git_mailmap_file, repo_abbrev);
256 return err;
257 }