Skip to content
  • Duy Nguyen's avatar
    wildmatch: fix "**" special case · 3a078dec
    Duy Nguyen authored and Junio C Hamano's avatar Junio C Hamano committed
    "**" is adjusted to only be effective when surrounded by slashes, in
    40bbee0a
    
     (wildmatch: adjust "**" behavior - 2012-10-15). Except that
    the commit did it wrong:
    
    1. when it checks for "the preceding slash unless ** is at the
       beginning", it compares to wrong pointer. It should have compared
       to the beginning of the pattern, not the text.
    
    2. prev_p points to the character before "**", not the first "*". The
       correct comparison must be "prev_p < pattern" or
       "prev_p + 1 == pattern", not "prev_p == pattern".
    
    3. The pattern must be surrounded by slashes unless it's at the
       beginning or the end of the pattern. We do two checks: one for the
       preceding slash and one the trailing slash. Both checks must be
       met. The use of "||" is wrong.
    
    This patch fixes all above.
    
    Signed-off-by: default avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    3a078dec