summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <Johannes.Schindelin@gmx.de>2005-11-20 13:24:18 +0100
committerLibravatar Junio C Hamano <junkio@cox.net>2005-11-20 10:53:06 -0800
commitf98d863d2122e1b8781dfb9889df98876a26f315 (patch)
tree3b688c9ff010bd74cde0027fe63f1d225a53b0ab /t
parentmerge-recursive: Replace 'except:' (diff)
downloadtgif-f98d863d2122e1b8781dfb9889df98876a26f315.tar.xz
git-config-set: support selecting values by non-matching regex
Extend the regex syntax of value_regex so that prepending an exclamation mark means non-match: [core] quetzal = "Dodo" for Brainf*ck quetzal = "T. Rex" for Malbolge quetzal = "cat" You can match the third line with git-config-set --get quetzal '! for ' Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 't')
-rw-r--r--t/t1300-config-set.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/t/t1300-config-set.sh b/t/t1300-config-set.sh
index 717bf4de79..59b6c4c85d 100644
--- a/t/t1300-config-set.sh
+++ b/t/t1300-config-set.sh
@@ -69,6 +69,28 @@ EOF
test_expect_success 'similar section' 'cmp .git/config expect'
+test_expect_success 'replace with non-match' \
+ 'git-config-set core.penguin kingpin !blue'
+
+test_expect_success 'replace with non-match (actually matching)' \
+ 'git-config-set core.penguin "very blue" !kingpin'
+
+cat > expect << EOF
+#
+# This is the config file
+#
+
+[core]
+ penguin = very blue
+ Movie = BadPhysics
+ UPPERCASE = true
+ penguin = kingpin
+[Cores]
+ WhatEver = Second
+EOF
+
+test_expect_success 'non-match result' 'cmp .git/config expect'
+
cat > .git/config << EOF
[beta] ; silly comment # another comment
noIndent= sillyValue ; 'nother silly comment
@@ -173,6 +195,12 @@ EOF
test_expect_success 'multivar' 'cmp .git/config expect'
+test_expect_success 'non-match' \
+ 'git-config-set --get nextsection.nonewline !for'
+
+test_expect_success 'non-match value' \
+ 'test wow = $(git-config-set --get nextsection.nonewline !for)'
+
test_expect_failure 'ambiguous get' \
'git-config-set --get nextsection.nonewline'