aboutsummaryrefslogtreecommitdiff
path: root/t/t1300-repo-config.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-12-16 15:14:14 +0100
committerJunio C Hamano <junkio@cox.net>2006-12-16 13:28:20 -0800
commit0667fcfb6271e9e1ea032a0e3a7d74c9d6a5fa8a (patch)
tree56b2353219b7d37819c93714618caaa344635904 /t/t1300-repo-config.sh
parentb1bfcae438adb485bb66e2f59396373809e346e6 (diff)
downloadgit-0667fcfb6271e9e1ea032a0e3a7d74c9d6a5fa8a.tar.gz
git-0667fcfb6271e9e1ea032a0e3a7d74c9d6a5fa8a.tar.xz
add a function to rename sections in the config
Given a config like this: # A config [very.interesting.section] not The command $ git repo-config --rename-section very.interesting.section bla.1 will lead to this config: # A config [bla "1"] not Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 't/t1300-repo-config.sh')
-rwxr-xr-xt/t1300-repo-config.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 16cd64261..e48a4ecdc 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -343,5 +343,53 @@ EOF
test_expect_success '--set in alternative GIT_CONFIG' 'cmp other-config expect'
+cat > .git/config << EOF
+# Hallo
+ #Bello
+[branch "eins"]
+ x = 1
+[branch.eins]
+ y = 1
+ [branch "1 234 blabl/a"]
+weird
+EOF
+
+test_expect_success "rename section" \
+ "git-repo-config --rename-section branch.eins branch.zwei"
+
+cat > expect << EOF
+# Hallo
+ #Bello
+[branch "zwei"]
+ x = 1
+[branch "zwei"]
+ y = 1
+ [branch "1 234 blabl/a"]
+weird
+EOF
+
+test_expect_success "rename succeeded" "diff -u expect .git/config"
+
+test_expect_failure "rename non-existing section" \
+ 'git-repo-config --rename-section branch."world domination" branch.drei'
+
+test_expect_success "rename succeeded" "diff -u expect .git/config"
+
+test_expect_success "rename another section" \
+ 'git-repo-config --rename-section branch."1 234 blabl/a" branch.drei'
+
+cat > expect << EOF
+# Hallo
+ #Bello
+[branch "zwei"]
+ x = 1
+[branch "zwei"]
+ y = 1
+[branch "drei"]
+weird
+EOF
+
+test_expect_success "rename succeeded" "diff -u expect .git/config"
+
test_done