fix(agent/agentcontainers): respect ignore files (#19016)

Closes https://github.com/coder/coder/issues/19011

We now use
[go-git](https://pkg.go.dev/github.com/go-git/go-git/v5@v5.16.2/plumbing/format/gitignore)'s
`gitignore` plumbing implementation to parse the `.gitignore` files and
match against the patterns generated. We use this to ignore any ignored
files in the git repository.

Unfortunately I've had to slightly re-implement some of the interface
exposed by `go-git` because they use `billy.Filesystem` instead of
`afero.Fs`.
This commit is contained in:
Danielle Maywood
2025-07-24 12:12:05 +01:00
committed by GitHub
parent 5c1bf1d46c
commit 25d70ce7bc
6 changed files with 323 additions and 7 deletions
+6 -1
View File
@@ -122,7 +122,7 @@ require (
github.com/fergusstrange/embedded-postgres v1.31.0
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa
github.com/gen2brain/beeep v0.11.1
github.com/gliderlabs/ssh v0.3.4
github.com/gliderlabs/ssh v0.3.8
github.com/go-chi/chi/v5 v5.2.2
github.com/go-chi/cors v1.2.1
github.com/go-chi/httprate v0.15.0
@@ -484,6 +484,7 @@ require (
github.com/coder/aisdk-go v0.0.9
github.com/coder/preview v1.0.3-0.20250714153828-a737d4750448
github.com/fsnotify/fsnotify v1.9.0
github.com/go-git/go-git/v5 v5.16.2
github.com/mark3labs/mcp-go v0.34.0
)
@@ -512,10 +513,13 @@ require (
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
github.com/esiqveland/notify v0.13.3 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.6.2 // indirect
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
github.com/hashicorp/go-getter v1.7.8 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/jackmordaunt/icns/v3 v3.0.1 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
github.com/moby/sys/user v0.4.0 // indirect
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
@@ -535,5 +539,6 @@ require (
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect
google.golang.org/genai v1.12.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect
)