From f762271dbfc121eaac7eb59c0beb01620a09118f Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Fri, 30 Jan 2026 17:10:01 +0100 Subject: test: Make gitCmd accept an stdin []byte --- testutil_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'testutil_test.go') diff --git a/testutil_test.go b/testutil_test.go index bca6db14..4ccfc840 100644 --- a/testutil_test.go +++ b/testutil_test.go @@ -17,10 +17,13 @@ func setupWorkDir(t *testing.T) (string, func()) { return workDir, func() { _ = os.RemoveAll(workDir) } } -func gitCmd(t *testing.T, dir string, args ...string) string { +func gitCmd(t *testing.T, dir string, stdin []byte, args ...string) string { t.Helper() cmd := exec.Command("git", args...) cmd.Dir = dir + if stdin != nil { + cmd.Stdin = bytes.NewReader(stdin) + } cmd.Env = append(os.Environ(), "GIT_CONFIG_GLOBAL=/dev/null", "GIT_CONFIG_SYSTEM=/dev/null", -- cgit v1.3.1-10-gc9f91