aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/vcs/git_test_util.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2026-01-31 19:33:49 +0100
committerDmitry Vyukov <dvyukov@google.com>2026-02-02 13:17:18 +0000
commit7dc14e346404f96c5198c8126fd062efffe8c1a4 (patch)
tree3ee44a2a23316f72c872269ed44d05495b68012e /pkg/vcs/git_test_util.go
parent20cefcc6e2f69cc6637dabd153f20c51ac6737d8 (diff)
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.
Diffstat (limited to 'pkg/vcs/git_test_util.go')
-rw-r--r--pkg/vcs/git_test_util.go12
1 files changed, 6 insertions, 6 deletions
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)