diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-04-03 02:10:53 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-03 02:10:53 +0400 |
commit | 66bea733f3e08e4aacacedcc7b6e46d202bdc7f8 (patch) | |
tree | 48a7b2bac559d787b8b5ad743f8da1b1d9e8b8a9 /t | |
parent | 68ef16b8488da1a9eed241340af194979d328ba7 (diff) | |
parent | 53ca053b3062e985f6270570b42471fbeb2dd6a5 (diff) |
Merge branch 'jk/config-with-empty-section'
Document that "git config --unset" does not remove an empty section
head after removing the last variable in a section, and adding a
new variable does not try to reuse a leftover empty section head.
* jk/config-with-empty-section:
t1300: document some aesthetic failures of the config editor
Diffstat (limited to 't')
-rwxr-xr-x | t/t1300-repo-config.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 3c96fda548..c4a7d84f46 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -1087,4 +1087,39 @@ test_expect_success 'barf on incomplete string' ' grep " line 3 " error ' +# good section hygiene +test_expect_failure 'unsetting the last key in a section removes header' ' + cat >.git/config <<-\EOF && + # some generic comment on the configuration file itself + # a comment specific to this "section" section. + [section] + # some intervening lines + # that should also be dropped + + key = value + # please be careful when you update the above variable + EOF + + cat >expect <<-\EOF && + # some generic comment on the configuration file itself + EOF + + git config --unset section.key && + test_cmp expect .git/config +' + +test_expect_failure 'adding a key into an empty section reuses header' ' + cat >.git/config <<-\EOF && + [section] + EOF + + q_to_tab >expect <<-\EOF && + [section] + Qkey = value + EOF + + git config section.key value + test_cmp expect .git/config +' + test_done |