Skip to content
  • Duy Nguyen's avatar
    config: correct '**' matching in includeIf patterns · 19e7fdaa
    Duy Nguyen authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    The current wildmatch() call for includeIf's gitdir pattern does not
    pass the WM_PATHNAME flag. Without this flag, '*' is treated _almost_
    the same as '**' (because '*' also matches slashes) with one exception:
    
    '/**/' can match a single slash. The pattern 'foo/**/bar' matches
    'foo/bar'.
    
    But '/*/', which is essentially what wildmatch engine sees without
    WM_PATHNAME, has to match two slashes (and '*' matches nothing). Which
    means 'foo/*/bar' cannot match 'foo/bar'. It can only match 'foo//bar'.
    
    The result of this is the current wildmatch() call works most of the
    time until the user depends on '/**/' matching no path component. And
    also '*' matches slashes while it should not, but people probably
    haven't noticed this yet. The fix is straightforward.
    
    Reported-by: default avatarJason Karns <jason.karns@gmail.com>
    Signed-off-by: default avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    19e7fdaa