diff options
Diffstat (limited to 'revision.c')
| -rw-r--r-- | revision.c | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/revision.c b/revision.c index 3418a1b7f1..14dca903b6 100644 --- a/revision.c +++ b/revision.c @@ -3755,80 +3755,6 @@ int rewrite_parents(struct rev_info *revs, struct commit *commit, return 0; } -/* - * Returns the difference between the new and old length of the ident line. - */ -static ssize_t rewrite_ident_line(const char *person, size_t len, - struct strbuf *buf, - struct string_list *mailmap) -{ - size_t namelen, maillen; - const char *name; - const char *mail; - struct ident_split ident; - - if (split_ident_line(&ident, person, len)) - return 0; - - mail = ident.mail_begin; - maillen = ident.mail_end - ident.mail_begin; - name = ident.name_begin; - namelen = ident.name_end - ident.name_begin; - - if (map_user(mailmap, &mail, &maillen, &name, &namelen)) { - struct strbuf namemail = STRBUF_INIT; - size_t newlen; - - strbuf_addf(&namemail, "%.*s <%.*s>", - (int)namelen, name, (int)maillen, mail); - - strbuf_splice(buf, ident.name_begin - buf->buf, - ident.mail_end - ident.name_begin + 1, - namemail.buf, namemail.len); - newlen = namemail.len; - - strbuf_release(&namemail); - - return newlen - (ident.mail_end - ident.name_begin); - } - - return 0; -} - -static void commit_rewrite_person(struct strbuf *buf, const char **header, - struct string_list *mailmap) -{ - size_t buf_offset = 0; - - if (!mailmap) - return; - - for (;;) { - const char *person, *line; - size_t i; - int found_header = 0; - - line = buf->buf + buf_offset; - if (!*line || *line == '\n') - return; /* End of headers */ - - for (i = 0; header[i]; i++) - if (skip_prefix(line, header[i], &person)) { - const char *endp = strchrnul(person, '\n'); - found_header = 1; - buf_offset += endp - line; - buf_offset += rewrite_ident_line(person, endp - person, buf, mailmap); - break; - } - - if (!found_header) { - buf_offset = strchrnul(line, '\n') - buf->buf; - if (buf->buf[buf_offset] == '\n') - buf_offset++; - } - } -} - static int commit_match(struct commit *commit, struct rev_info *opt) { int retval; |
