aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/git/test-gitcfg.sh
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/git/test-gitcfg.sh')
-rwxr-xr-xdesktop/modules/git/test-gitcfg.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/desktop/modules/git/test-gitcfg.sh b/desktop/modules/git/test-gitcfg.sh
index 328a575..6e1b32c 100755
--- a/desktop/modules/git/test-gitcfg.sh
+++ b/desktop/modules/git/test-gitcfg.sh
@@ -71,6 +71,25 @@ check "add bad key: git's error" 1 "$([[ "$out" == *section* ]] && echo 1)"
check "comment kept" 1 "$(grep -c '^# keep me$' "$GIT_CONFIG_GLOBAL")"
+# A value held twice: --fixed-value would replace or trip on both, so gitcfg
+# refuses rather than silently merging two rows into one.
+printf '[d]\n\tv = a\n\tv = a\n\tv = b\n' >> "$GIT_CONFIG_GLOBAL"
+out="$("$ctl" set d.v a c)"; rc=$?
+check "set duplicate: rc" 1 "$rc"
+check "set duplicate: untouched" "a,a,b" "$(vals d.v)"
+out="$("$ctl" unset d.v a)"; rc=$?
+check "unset duplicate: rc" 1 "$rc"
+check "unset duplicate: says why" 1 "$([[ "$out" == *twice* ]] && echo 1)"
+
+# A file git cannot parse lists nothing on stdout without this, which the
+# page would draw as an empty config.
+cp "$GIT_CONFIG_GLOBAL" "$tmp/good"
+printf '[x\n' >> "$GIT_CONFIG_GLOBAL"
+out="$("$ctl" list)"; rc=$?
+check "list broken file: rc" 1 "$rc"
+check "list broken file: error= line" 1 "$([[ "$out" == error=* ]] && echo 1)"
+cp "$tmp/good" "$GIT_CONFIG_GLOBAL"
+
"$ctl" bogus >/dev/null 2>&1; rc=$?
check "usage: rc" 2 "$rc"