diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-09-18 22:57:32 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-09-18 22:57:33 +0400 |
commit | 19230ab8a80d0a78ac396234c557f0dd8d564a04 (patch) | |
tree | a91476706c5d712cf13c476b339889c9db00e99e /mailmap.c | |
parent | d5b99f35bd9102cf25ffb5d438898fa0c625defd (diff) | |
parent | f972a1658a30809db113a3c486b1fe95b56633bf (diff) |
Merge branch 'jk/mailmap-incomplete-line' into maint
* jk/mailmap-incomplete-line:
mailmap: handle mailmap blobs without trailing newlines
Diffstat (limited to 'mailmap.c')
-rw-r--r-- | mailmap.c | 21 |
1 files changed, 9 insertions, 12 deletions
@@ -193,20 +193,17 @@ static int read_mailmap_file(struct string_list *map, const char *filename, return 0; } -static void read_mailmap_buf(struct string_list *map, - const char *buf, unsigned long len, - char **repo_abbrev) +static void read_mailmap_string(struct string_list *map, char *buf, + char **repo_abbrev) { - while (len) { - const char *end = strchrnul(buf, '\n'); - unsigned long linelen = end - buf + 1; - char *line = xmemdupz(buf, linelen); + while (*buf) { + char *end = strchrnul(buf, '\n'); - read_mailmap_line(map, line, repo_abbrev); + if (*end) + *end++ = '\0'; - free(line); - buf += linelen; - len -= linelen; + read_mailmap_line(map, buf, repo_abbrev); + buf = end; } } @@ -230,7 +227,7 @@ static int read_mailmap_blob(struct string_list *map, if (type != OBJ_BLOB) return error("mailmap is not a blob: %s", name); - read_mailmap_buf(map, buf, size, repo_abbrev); + read_mailmap_string(map, buf, repo_abbrev); free(buf); return 0; |