From b505ac2fe010fcc24b774c313d33dc099214e8ed Mon Sep 17 00:00:00 2001 From: Bernhard Guillon Date: Mon, 6 Jul 2026 21:15:17 +0200 Subject: Initial project scaffolding - main.go: CLI entry point with flag parsing - gitignore.go: .gitignore loading and parsing - sync.go: initial sync with manifest tracking - watcher.go: fsnotify-based file watcher with debouncing - Dockerfile: multi-stage build for Alpine runtime --- gitignore.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gitignore.go (limited to 'gitignore.go') diff --git a/gitignore.go b/gitignore.go new file mode 100644 index 0000000..f6816bd --- /dev/null +++ b/gitignore.go @@ -0,0 +1,22 @@ +package main + +import ( + "os" + "path/filepath" + + ignore "github.com/sabhiram/go-gitignore" +) + +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 + } + + return ignore.CompileIgnoreLines(string(data)), nil +} -- cgit v1.2.3