Skip to content
  • Junio C Hamano's avatar
    mailmap: do not lose single-letter names · 8c381151
    Junio C Hamano authored
    
    
    In parse_name_and_email() function, there is this line:
    
    	*name = (nstart < nend ? nstart : NULL);
    
    When the function is given a buffer "A <A@example.org> <old@x.z>",
    nstart scans from the beginning of the buffer, skipping whitespaces
    (there isn't any, so nstart points at the buffer), while nend starts
    from one byte before the first '<' and skips whitespaces backwards
    and stops at the first non-whitespace (i.e. it hits "A" at the
    beginning of the buffer).  nstart == nend in this case for a
    single-letter name, and an off-by-one error makes it fail to pick up
    the name, which makes the entry equivalent to
    
    	<A@example.org> <old@x.z>
    
    without the name.
    
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    Signed-off-by: default avatarEric Sunshine <sunshine@sunshineco.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    8c381151