From 7512c95fa3f4b4e4ccdf452024f314a9a3c3b60f Mon Sep 17 00:00:00 2001 From: Bernhard Guillon Date: Mon, 6 Jul 2026 21:21:53 +0200 Subject: Add sync and gitignore tests, fix loadGitignore bug - Added gitignore_test.go: comprehensive tests for go-gitignore patterns - Verified: *, **, [], negation, anchored patterns, comments - Documented limitation: ? wildcard not supported by go-gitignore - Added sync_test.go: integration tests for initial sync - Tests: basic files, gitignore excludes, negation, double-star, directory patterns, symlinks, permissions, dry-run, .git skip, nested gitignore, complex combined patterns - Fixed gitignore.go: use CompileIgnoreFile instead of passing entire file content as single string to CompileIgnoreLines --- gitignore.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'gitignore.go') diff --git a/gitignore.go b/gitignore.go index f6816bd..80d14a6 100644 --- a/gitignore.go +++ b/gitignore.go @@ -10,13 +10,9 @@ import ( func loadGitignore(hostDir string) (*ignore.GitIgnore, error) { gitignorePath := filepath.Join(hostDir, ".gitignore") - data, err := os.ReadFile(gitignorePath) - if err != nil { - if os.IsNotExist(err) { - return ignore.CompileIgnoreLines(), nil - } - return nil, err + if _, err := os.Stat(gitignorePath); os.IsNotExist(err) { + return ignore.CompileIgnoreLines(), nil } - return ignore.CompileIgnoreLines(string(data)), nil + return ignore.CompileIgnoreFile(gitignorePath) } -- cgit v1.2.3