Skip to content
  • René Scharfe's avatar
    pickaxe: count regex matches only once · 50fd6997
    René Scharfe authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When --pickaxe-regex is used, forward past the end of matches instead of
    advancing to the byte after their start.  This way matches count only
    once, even if the regular expression matches their tail -- like in the
    fixed-string fork of the code.
    
    E.g.: /.*/ used to count the number of bytes instead of the number of
    lines.  /aa/ resulted in a count of two in "aaa" instead of one.
    
    Also document the fact that regexec() needs a NUL-terminated string as
    its second argument by adding an assert().
    
    Signed-off-by: default avatarRene Scharfe <rene.scharfe@lsrfire.ath.cx>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    50fd6997