From 7dc14e346404f96c5198c8126fd062efffe8c1a4 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 31 Jan 2026 19:33:49 +0100 Subject: pkg/aflow/tool/grepper: add the tool Add a tool that executes git grep with the given expression. It can handle long tail of cases that codesearcher can't handle, while still providing less output than reading whole files. --- pkg/vcs/git_test_util.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'pkg/vcs/git_test_util.go') diff --git a/pkg/vcs/git_test_util.go b/pkg/vcs/git_test_util.go index 012972abc..3f2116a4b 100644 --- a/pkg/vcs/git_test_util.go +++ b/pkg/vcs/git_test_util.go @@ -78,24 +78,24 @@ func (repo *TestRepo) CommitFileChange(branch, change string) { } func (repo *TestRepo) CommitChange(description string) *Commit { - return repo.commitChangeset(description) + return repo.CommitChangeset(description) } -type writeFile struct { +type FileContent struct { File string Content string } -func (wf *writeFile) Apply(repo *TestRepo) error { - err := os.WriteFile(filepath.Join(repo.Dir, wf.File), []byte(wf.Content), 0644) +func (fc *FileContent) Apply(repo *TestRepo) error { + err := os.WriteFile(filepath.Join(repo.Dir, fc.File), []byte(fc.Content), 0644) if err != nil { return err } - repo.Git("add", wf.File) + repo.Git("add", fc.File) return nil } -func (repo *TestRepo) commitChangeset(description string, actions ...writeFile) *Commit { +func (repo *TestRepo) CommitChangeset(description string, actions ...FileContent) *Commit { for i, action := range actions { if err := action.Apply(repo); err != nil { repo.t.Fatalf("failed to apply action %d: %v", i, err) -- cgit mrf-deployment