Subject: [PATCH 10/11] t1312: create read/write test

From: "Derrick Stolee via GitGitGadget" <[email-masked]>
Date: Wed, 04 Feb 2026 14:20:02 +0000

From: Derrick Stolee <[email-masked]>

This new test will be extended in the future to ensure that multiple
commands that execute in order update the configuration state enough to
reflect new written values as we read them in later commands.

Signed-off-by: Derrick Stolee <[email-masked]>
---
 t/t1312-config-batch.sh | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/t/t1312-config-batch.sh b/t/t1312-config-batch.sh
index 40f6f90ef2..11380f4247 100755
--- a/t/t1312-config-batch.sh
+++ b/t/t1312-config-batch.sh
@@ -295,4 +295,31 @@ test_expect_success 'set config by scope with -z' '
 	test_cmp expect-values values
 '
 
+test_expect_success 'read/write interactions in sequence' '
+	test_when_finished git config remove-section test.rw &&
+
+	cat >in <<-\EOF &&
+	get 1 local test.rw.missing
+	set 1 local test.rw.found found
+	get 1 local test.rw.found
+	set 1 local test.rw.found updated
+	get 1 local test.rw.found
+	EOF
+
+	cat >expect <<-\EOF &&
+	get 1 missing test.rw.missing
+	set 1 success local test.rw.found found
+	get 1 found test.rw.found local found
+	set 1 success local test.rw.found updated
+	get 1 found test.rw.found local updated
+	EOF
+
+	git config-batch <in >out 2>err &&
+
+	test_must_be_empty err &&
+	test_cmp expect out &&
+
+	test_cmp_config updated test.rw.found
+'
+
 test_done
-- 
gitgitgadget