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

[PATCH] add test for git-config --remove-section

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 1, 2007, 22:41 UTC
Message-ID
<Pine.LNX.4.63.0703012338370.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<81b0412b0703011351ldd903a8od2e4f76aded31519@mail.gmail.com>

This adds a simple test if a section is properly removed, even if the section header is repeated in the config.

Not-yet-Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Waits-for-ack-by: Paolo Bonzini <bonzini@gnu.org>
---
	On Thu, 1 Mar 2007, Alex Riesen wrote:
	> On 3/1/07, Paolo Bonzini <bonzini@gnu.org> wrote:
	> > As per the subject.  The existing --rename-section option is
	> > undocumented, while --remove-section is added by this patch 
	> > based on the code I had written for the "git branch" patch.
	> 
	> You desperately need tests for this code.
	Something like this? Totally untested (of course)...
 t/t1300-repo-config.sh |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 3753e9f..6b15a3e 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -391,6 +391,22 @@ EOF
 
 test_expect_success "rename succeeded" "diff -u expect .git/config"
 
+test_expect_success "remove section" "git config --remove-section branch.zwei"
+
+cat > expect << EOF
+# Hallo
+	#Bello
+[branch "zwei"]
+	x = 1
+[branch "zwei"]
+	y = 1
+[branch "drei"]
+weird
+EOF
+
+test_expect_success "section was removed properly" \
+	"diff -u expect .git/config"
+
 test_expect_success numbers '
 
 	git-config kilo.gram 1k &&
Previous: Alex RiesenNext: Paolo Bonzini
Message 3 of 12 in “Add git-config --remove-section, document --rename-section”
  1. Add git-config --remove-section, document --rename-sectionPaolo Bonzini, Mar 1, 2007
  2. Alex RiesenMar 1, 2007
  3. add test for git-config --remove-sectionJohannes Schindelin, Mar 1, 2007
  4. Paolo BonziniMar 2, 2007
  5. Johannes SchindelinMar 1, 2007
  6. Paolo BonziniMar 2, 2007
  7. Johannes SchindelinMar 2, 2007
  8. Paolo BonziniMar 2, 2007
  9. Johannes SchindelinMar 2, 2007
  10. Paolo BonziniMar 2, 2007
  11. git-config: document --rename-section, provide --remove-sectionJohannes Schindelin, Mar 2, 2007
  12. Paolo BonziniMar 3, 2007

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.