| ... | ... | @@ -157,7 +157,7 @@ pub fn revListAll(alloc: std.mem.Allocator, dir: nfs.Dir, from: CommitId, sub_pa |
| 157 | 157 | return std.mem.trimEnd(u8, result.stdout, "\n"); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | | pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit { |
| 160 | pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string, mailmap: *const std.hash_map.StringHashMapUnmanaged([]const u8)) !Commit { |
| 161 | 161 | const t = tracer.trace(@src(), "", .{}); |
| 162 | 162 | defer t.end(); |
| 163 | 163 | |
| ... | ... | @@ -184,6 +184,8 @@ pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit { |
| 184 | 184 | if (std.mem.eql(u8, k, "parent")) try parents.append(.{ .id = line[space + 1 ..][0..40] }); |
| 185 | 185 | } |
| 186 | 186 | result.parents = try parents.toOwnedSlice(); |
| 187 | result.author.email = mailmap.get(result.author.email) orelse result.author.email; |
| 188 | result.committer.email = mailmap.get(result.committer.email) orelse result.committer.email; |
| 187 | 189 | result.message = iter.rest(); |
| 188 | 190 | return result; |
| 189 | 191 | } |
| ... | ... | @@ -1093,7 +1095,7 @@ pub const Repository = struct { |
| 1093 | 1095 | if (try r.getObject(id.id, cache_behavior)) |obj| { |
| 1094 | 1096 | if (obj.type == .commit) { |
| 1095 | 1097 | errdefer if (cache_behavior == .no_cache) r.gpa.free(obj.content); |
| 1096 | | const commit = try parseCommit(r.gpa, obj.content); |
| 1098 | const commit = try parseCommit(r.gpa, obj.content, &r.mailmap); |
| 1097 | 1099 | try r.commits.put(r.gpa, id.id, commit); |
| 1098 | 1100 | return .{ id, commit }; |
| 1099 | 1101 | } |