summaryrefslogtreecommitdiff
path: root/mailmap.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-03-05 22:13:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-03-07 01:19:11 (GMT)
commit5735dc5a0df5de12b28237ff2c41df6df5f67b81 (patch)
tree3cbcf06ddf9bd6f0d8e3979aac1640f5b326c040 /mailmap.c
parentf2f12d169aa607604edbd942675026174f061e3f (diff)
downloadgit-5735dc5a0df5de12b28237ff2c41df6df5f67b81.zip
git-5735dc5a0df5de12b28237ff2c41df6df5f67b81.tar.gz
git-5735dc5a0df5de12b28237ff2c41df6df5f67b81.tar.bz2
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>
Diffstat (limited to 'mailmap.c')
-rw-r--r--mailmap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mailmap.c b/mailmap.c
index f4a0f1c..9726237 100644
--- a/mailmap.c
+++ b/mailmap.c
@@ -250,7 +250,8 @@ int read_mailmap(struct string_list *map, char **repo_abbrev)
git_mailmap_blob = "HEAD:.mailmap";
err |= read_mailmap_file(map, ".mailmap", repo_abbrev);
- err |= read_mailmap_blob(map, git_mailmap_blob, repo_abbrev);
+ 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);
return err;
}