Skip to content

Commit 5735dc5

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f2f12d1 commit 5735dc5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mailmap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ int read_mailmap(struct string_list *map, char **repo_abbrev)
250250
git_mailmap_blob = "HEAD:.mailmap";
251251

252252
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);
254255
err |= read_mailmap_file(map, git_mailmap_file, repo_abbrev);
255256
return err;
256257
}

0 commit comments

Comments
 (0)