aboutsummaryrefslogtreecommitdiff
path: root/test-match-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-02-05 17:31:51 -0800
committerJunio C Hamano <gitster@pobox.com>2012-02-06 14:00:06 -0800
commitf026358ef20e0c252388a41fcc8eff125b00927c (patch)
tree29a1010d3bbc0c021385d528d469ffac64dc39ff /test-match-trees.c
parent04f6785a089e552585ba022f9d9054eca385ca67 (diff)
downloadgit-f026358ef20e0c252388a41fcc8eff125b00927c.tar.gz
git-f026358ef20e0c252388a41fcc8eff125b00927c.tar.xz
mailmap: always return a plain mail address from map_user()
The callers of map_user() give email and name to it, and expect to get the up-to-date email and/or name to be used in their output. The function rewrites the given buffers in place. To optimize the majority of cases, the function returns 0 when it did not do anything, and it returns 1 when the caller should use the updated contents. The 'email' input to the function is terminated by '>' or a NUL (whichever comes first) for historical reasons, but when a rewrite happens, the value is replaced with the mailbox inside the <> pair. However, it failed to meet this expectation when it only rewrote the name part without rewriting the email part, and the email in the input was terminated by '>'. This causes an extra '>' to appear in the output of "blame -e", because the caller does send in '>'-terminated email, and when the function returned 1 to tell it that rewriting happened, it appends '>' that is necessary when the email part was rewritten. The patch looks bigger than it actually is, because this change makes a variable that points at the end of the email part in the input 'p' live much longer than it used to, deserving a more descriptive name. Noticed and diagnosed by Felipe Contreras and Jeff King. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'test-match-trees.c')
0 files changed, 0 insertions, 0 deletions