t4202: use test_config/test_unconfig to set/unset git config variables
Instead of using construct such as: test_when_finished "git config --unset <key>" git config <key> <value> uses test_config <key> <value> The latter takes care of removing <key> at the end of the test. Additionally, instead of git config <key> "" or git config --unset <key> uses test_unconfig <key> The latter doesn't failed if <key> is not defined. Tests are modified to assume correct (default) configuration at entry, and to reset the modified configuration variables at the end. Signed-off-by: Yann Droneaud <ydroneaud@opteya.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
ff73aa405f
commit
90e76b7029
@ -419,8 +419,6 @@ test_expect_success 'log --graph with merge' '
|
||||
'
|
||||
|
||||
test_expect_success 'log.decorate configuration' '
|
||||
test_might_fail git config --unset-all log.decorate &&
|
||||
|
||||
git log --oneline >expect.none &&
|
||||
git log --oneline --decorate >expect.short &&
|
||||
git log --oneline --decorate=full >expect.full &&
|
||||
@ -429,8 +427,7 @@ test_expect_success 'log.decorate configuration' '
|
||||
git log --oneline >actual &&
|
||||
test_cmp expect.short actual &&
|
||||
|
||||
git config --unset-all log.decorate &&
|
||||
git config log.decorate true &&
|
||||
test_config log.decorate true &&
|
||||
git log --oneline >actual &&
|
||||
test_cmp expect.short actual &&
|
||||
git log --oneline --decorate=full >actual &&
|
||||
@ -438,8 +435,7 @@ test_expect_success 'log.decorate configuration' '
|
||||
git log --oneline --decorate=no >actual &&
|
||||
test_cmp expect.none actual &&
|
||||
|
||||
git config --unset-all log.decorate &&
|
||||
git config log.decorate no &&
|
||||
test_config log.decorate no &&
|
||||
git log --oneline >actual &&
|
||||
test_cmp expect.none actual &&
|
||||
git log --oneline --decorate >actual &&
|
||||
@ -447,8 +443,7 @@ test_expect_success 'log.decorate configuration' '
|
||||
git log --oneline --decorate=full >actual &&
|
||||
test_cmp expect.full actual &&
|
||||
|
||||
git config --unset-all log.decorate &&
|
||||
git config log.decorate 1 &&
|
||||
test_config log.decorate 1 &&
|
||||
git log --oneline >actual &&
|
||||
test_cmp expect.short actual &&
|
||||
git log --oneline --decorate=full >actual &&
|
||||
@ -456,8 +451,7 @@ test_expect_success 'log.decorate configuration' '
|
||||
git log --oneline --decorate=no >actual &&
|
||||
test_cmp expect.none actual &&
|
||||
|
||||
git config --unset-all log.decorate &&
|
||||
git config log.decorate short &&
|
||||
test_config log.decorate short &&
|
||||
git log --oneline >actual &&
|
||||
test_cmp expect.short actual &&
|
||||
git log --oneline --no-decorate >actual &&
|
||||
@ -465,8 +459,7 @@ test_expect_success 'log.decorate configuration' '
|
||||
git log --oneline --decorate=full >actual &&
|
||||
test_cmp expect.full actual &&
|
||||
|
||||
git config --unset-all log.decorate &&
|
||||
git config log.decorate full &&
|
||||
test_config log.decorate full &&
|
||||
git log --oneline >actual &&
|
||||
test_cmp expect.full actual &&
|
||||
git log --oneline --no-decorate >actual &&
|
||||
@ -474,16 +467,15 @@ test_expect_success 'log.decorate configuration' '
|
||||
git log --oneline --decorate >actual &&
|
||||
test_cmp expect.short actual
|
||||
|
||||
git config --unset-all log.decorate &&
|
||||
test_unconfig log.decorate &&
|
||||
git log --pretty=raw >expect.raw &&
|
||||
git config log.decorate full &&
|
||||
test_config log.decorate full &&
|
||||
git log --pretty=raw >actual &&
|
||||
test_cmp expect.raw actual
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'reflog is expected format' '
|
||||
test_might_fail git config --remove-section log &&
|
||||
git log -g --abbrev-commit --pretty=oneline >expect &&
|
||||
git reflog >actual &&
|
||||
test_cmp expect actual
|
||||
@ -496,10 +488,6 @@ test_expect_success 'whatchanged is expected format' '
|
||||
'
|
||||
|
||||
test_expect_success 'log.abbrevCommit configuration' '
|
||||
test_when_finished "git config --unset log.abbrevCommit" &&
|
||||
|
||||
test_might_fail git config --unset log.abbrevCommit &&
|
||||
|
||||
git log --abbrev-commit >expect.log.abbrev &&
|
||||
git log --no-abbrev-commit >expect.log.full &&
|
||||
git log --pretty=raw >expect.log.raw &&
|
||||
@ -508,7 +496,7 @@ test_expect_success 'log.abbrevCommit configuration' '
|
||||
git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
|
||||
git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
|
||||
|
||||
git config log.abbrevCommit true &&
|
||||
test_config log.abbrevCommit true &&
|
||||
|
||||
git log >actual &&
|
||||
test_cmp expect.log.abbrev actual &&
|
||||
|
Loading…
Reference in New Issue
Block a user