diff options
author | Jakob Unterwurzacher | 2025-07-09 19:52:07 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2025-07-09 19:52:07 +0200 |
commit | a2efa0e5113b0efc96cac9618dd8d438310b417f (patch) | |
tree | ae6ca1819c59df12a491bc108b7df9dddfdde1c7 /internal/go-git-gitignore/pattern.go | |
parent | d98fe5e4922a409b367a1e0eeec138e7ae598452 (diff) |
go-git-gitignore: simpleNameMatch: bail out on "p.dirOnly && !isDir"
Fixes this test failure:
--- FAIL: TestIssue927Minimal (0.03s)
exclude_test.go:44: File "dir/zzz" is visible, but should be hidden
FAIL
testcases[0] = struct { plaintextnames bool; deterministic_names bool }{plaintextnames:true, deterministic_names:false} failed
exit status 1
FAIL github.com/rfjakob/gocryptfs/v2/tests/reverse 0.577s
Diffstat (limited to 'internal/go-git-gitignore/pattern.go')
-rw-r--r-- | internal/go-git-gitignore/pattern.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/go-git-gitignore/pattern.go b/internal/go-git-gitignore/pattern.go index c80e841..94d585f 100644 --- a/internal/go-git-gitignore/pattern.go +++ b/internal/go-git-gitignore/pattern.go @@ -90,6 +90,13 @@ func (p *pattern) Match(path []string, isDir bool) MatchResult { } func (p *pattern) simpleNameMatch(path []string, isDir bool) bool { + // gocryptfs patch: simple fix for https://github.com/go-git/go-git/issues/1596 + // gocryptfs can get away with this because each parent directory has already been checked + // separately on LOOKUP. + if p.dirOnly && !isDir { + return false + } + for i, name := range path { if match, err := filepath.Match(p.pattern[0], name); err != nil { return false |