From eddeb4d7a760a93712b7fdff5b46c2d92d0bc012 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sat, 25 Oct 2008 03:30:37 +0200 Subject: [PATCH] Add tests for .git/config file section counts git creates empty duplicate sections in the .git/config file. Such config files look very strange even if they do not confuse git's built-in parser. This commit just adds the tests for the issue - there is no code to actually avoid creating these empty duplicate sections yet. --- t/t1304-repo-config-sections.sh | 48 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-) create mode 100755 t/t1304-repo-config-sections.sh diff --git a/t/t1304-repo-config-sections.sh b/t/t1304-repo-config-sections.sh new file mode 100755 index 0000000..baafd8f --- /dev/null +++ b/t/t1304-repo-config-sections.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Copyright (c) 2005 Johannes Schindelin +# Copyright (c) 2008 Hans Ulrich Niedermann +# + +test_description='Test git config section creation' + +. ./test-lib.sh + +test -f .git/config && rm .git/config + +git config m4rker.foo v1 + +cat > expect << EOF +[m4rker] + foo = v1 +EOF + +test_expect_success 'first value sets up section' 'cmp .git/config expect' + +git config --unset m4rker.foo + +cat > expect << EOF +[m4rker] +EOF + +test_expect_success 'after unset empty section remains' 'cmp .git/config expect' + +git config m4rker.foo v2 + +cat > expect << EOF +[m4rker] + foo = v2 +EOF + +test_expect_success 'second value results in single section' 'cmp .git/config expect' + +cat > expect << EOF +[m4rker] +[m4rker] + foo = v2 +EOF + +test_expect_failure 'second value results in one empty plus one used section' 'if cmp .git/config expect; then return 1; else return 0; fi' + +test_done + -- 1.6.0.3