git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Failing test; renaming sections can lose assignments on the same line

From
Alex Vandiver <alex@chmrr.net>
Date
Jul 8, 2009, 20:40 UTC
Message-ID
<1247085641-14772-1-git-send-email-alex@chmrr.net>
Signed-off-by: Alex Vandiver <alex@chmrr.net>
---
I noticed the following bug recently:
    echo "[foo] x = 1" > testfile
    git config --file=testfile --rename-section foo bar
    cat testfile
    # [bar]

This is at least a failing test, and I'll look at how complex the fix is when I get a few spare tuits.

 t/t1300-repo-config.sh |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 43ea283..4d576c6 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -460,6 +460,27 @@ EOF
 test_expect_success "rename succeeded" "test_cmp expect .git/config"
 
 cat >> .git/config << EOF
+[branch "vier"] z = 1
+EOF
+
+test_expect_success "rename a section with a var on the same line" \
+	'git config --rename-section branch.vier branch.zwei'
+
+cat > expect << EOF
+# Hallo
+	#Bello
+[branch "zwei"]
+	x = 1
+[branch "zwei"]
+	y = 1
+[branch "drei"]
+weird
+[branch "zwei"] z = 1
+EOF
+
+test_expect_success "rename succeeded" "test_cmp expect .git/config"
+
+cat >> .git/config << EOF
   [branch "zwei"] a = 1 [branch "vier"]
 EOF
 
-- 
1.6.3.3.473.gb74fc4.dirty
Message 1 of 1 in “Failing test; renaming sections can lose assignments on the same line”
  1. Failing test; renaming sections can lose assignments on the same lineAlex Vandiver, Jul 8, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.