Skip to content

Commit b73bdc3

Browse files
dschogitster
authored andcommitted
t1300: --unset-all can leave an empty section behind (bug)
We already have a test demonstrating that removing the last entry from a config section fails to remove the section header of the now-empty section. The same can happen, of course, if we remove the last entries in one fell swoop. This is *also* a bug, and should be fixed at the same time. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 422e8ef commit b73bdc3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

t/t1300-config.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,17 @@ test_expect_failure '--unset last key removes section (except if commented)' '
14721472
test_line_count = 3 .git/config
14731473
'
14741474

1475+
test_expect_failure '--unset-all removes section if empty & uncommented' '
1476+
cat >.git/config <<-\EOF &&
1477+
[section]
1478+
key = value1
1479+
key = value2
1480+
EOF
1481+
1482+
git config --unset-all section.key &&
1483+
test_line_count = 0 .git/config
1484+
'
1485+
14751486
test_expect_failure 'adding a key into an empty section reuses header' '
14761487
cat >.git/config <<-\EOF &&
14771488
[section]

0 commit comments

Comments
 (0)