aboutsummaryrefslogtreecommitdiff
path: root/internal/testgit/config.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-06-06 17:45:29 +0000
committerGravatar Runxi Yu2026-06-06 17:45:29 +0000
commit2c79eaae593f5669f5f596337f5ac98492cc1127 (patch)
tree7b6dccf1689110a7d865b8a46f9d72b3ac058f6d /internal/testgit/config.go
parentinternal/testgit: hash-object and command (diff)
testgit: Add config support
Diffstat (limited to 'internal/testgit/config.go')
-rw-r--r--internal/testgit/config.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/testgit/config.go b/internal/testgit/config.go
new file mode 100644
index 00000000..2bbadb74
--- /dev/null
+++ b/internal/testgit/config.go
@@ -0,0 +1,25 @@
+package testgit
+
+import "testing"
+
+func (repo *Repo) ConfigGet(tb testing.TB, key string) (string, error) {
+ tb.Helper()
+
+ return String(repo.Run(tb, nil, "git", "config", "--get", "--end-of-options", key))
+}
+
+func (repo *Repo) ConfigSet(tb testing.TB, key, value string) error {
+ tb.Helper()
+
+ _, err := repo.Run(tb, nil, "git", "config", "--end-of-options", key, value)
+
+ return err
+}
+
+func (repo *Repo) ConfigAdd(tb testing.TB, key, value string) error {
+ tb.Helper()
+
+ _, err := repo.Run(tb, nil, "git", "config", "--add", "--end-of-options", key, value)
+
+ return err
+}