aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/vcs/git_test.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2026-01-06 19:10:53 +0100
committerAleksandr Nogikh <nogikh@google.com>2026-01-09 14:28:59 +0000
commita45480436715f68eac7cc949da964ee2b73ef172 (patch)
treea78ef367de0d6ccd99e45571eee6029d7c5dedae /pkg/vcs/git_test.go
parent9ee25c60da3366005e31dedd1574732f63338151 (diff)
pkg/vcs: extend ParseGitDiff
Return not just the modified files, but also their blob hashes.
Diffstat (limited to 'pkg/vcs/git_test.go')
-rw-r--r--pkg/vcs/git_test.go27
1 files changed, 22 insertions, 5 deletions
diff --git a/pkg/vcs/git_test.go b/pkg/vcs/git_test.go
index 40207898c..f2d761713 100644
--- a/pkg/vcs/git_test.go
+++ b/pkg/vcs/git_test.go
@@ -455,7 +455,7 @@ func TestGitFetchShortHash(t *testing.T) {
}
func TestParseGitDiff(t *testing.T) {
- files := ParseGitDiff([]byte(`diff --git a/a.txt b/a.txt
+ list := ParseGitDiff([]byte(`diff --git a/a.txt b/a.txt
index 4c5fd91..8fe1e32 100644
--- a/a.txt
+++ b/a.txt
@@ -469,9 +469,26 @@ index 0000000..f8a9677
+++ b/b.txt
@@ -0,0 +1 @@
+Second file.
-diff --git a/c/c.txt b/c/c.txt
-new file mode 100644
-index 0000000..e69de29
+diff --git a/c.txt b/c.txt
+deleted file mode 100644
+index f70f10e..0000000
+--- a/c.txt
++++ /dev/null
+@@ -1 +0,0 @@
+-A
`))
- assert.ElementsMatch(t, files, []string{"a.txt", "b.txt", "c/c.txt"})
+ assert.Equal(t, list, []ModifiedFile{
+ {
+ Name: `a.txt`,
+ LeftHash: `4c5fd91`,
+ },
+ {
+ Name: `b.txt`,
+ LeftHash: `0000000`,
+ },
+ {
+ Name: `c.txt`,
+ LeftHash: `f70f10e`,
+ },
+ })
}