All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann Droneaud <ydroneaud@opteya.com>
To: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Cc: Yann Droneaud <ydroneaud@opteya.com>
Subject: [PATCH 07/15] t4202: use test_config/test_unconfig to set/unset git config variables
Date: Sun, 24 Mar 2013 22:06:06 +0100	[thread overview]
Message-ID: <f8332db5794d0f4accc7c4a0b4c0e5b106eda493.1364158574.git.ydroneaud@opteya.com> (raw)
In-Reply-To: <cover.1364158574.git.ydroneaud@opteya.com>
In-Reply-To: <cover.1364158574.git.ydroneaud@opteya.com>

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>
---
 t/t4202-log.sh | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index fa686b8..9243a97 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -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 &&
-- 
1.7.11.7

  parent reply	other threads:[~2013-03-24 21:07 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-19 14:55 git merge <tag> behavior Yann Droneaud
2013-03-19 16:19 ` Junio C Hamano
2013-03-19 17:54   ` Re* " Junio C Hamano
2013-04-01 19:57     ` [PATCH 0/3] Merging an annotated tag object Junio C Hamano
2013-04-01 19:57       ` [PATCH 1/3] merge: a random object may not necssarily be a commit Junio C Hamano
2013-04-01 22:51         ` Yann Droneaud
2013-04-02  5:30         ` Jeff King
2013-04-02 15:02           ` Junio C Hamano
2013-04-02 15:03             ` Jeff King
2013-04-01 19:57       ` [PATCH 2/3] t6200: use test_config/test_unconfig Junio C Hamano
2013-04-01 19:57       ` [PATCH 3/3] t6200: test message for merging of an annotated tag Junio C Hamano
2013-03-20 17:53   ` [PATCH] Documentation: merging a tag is a special case Yann Droneaud
2013-03-20 18:54     ` Jonathan Nieder
2013-03-20 19:07     ` Junio C Hamano
2013-03-21 19:50       ` Junio C Hamano
2013-03-21 19:56         ` Jonathan Nieder
2013-03-21 20:10           ` Junio C Hamano
2013-03-21 20:39             ` Jonathan Nieder
2013-03-21 21:47             ` Yann Droneaud
2013-03-21 21:57               ` [PATCH v2] " Yann Droneaud
2013-03-21 22:41                 ` Jonathan Nieder
2013-03-20 18:04   ` git merge <tag> behavior Yann Droneaud
2013-03-20 18:12     ` Yann Droneaud
2013-03-20 18:46       ` Junio C Hamano
2013-03-21 20:31 ` Max Nanasy
2013-03-22  9:16   ` Yann Droneaud
2013-03-22 10:09     ` [PATCH] t7600: test merge configuration override Yann Droneaud
2013-03-22 14:47       ` Junio C Hamano
2013-03-24 21:05       ` [PATCH 00/15] Use test_config Yann Droneaud
2013-03-24 21:06         ` [PATCH 01/15] t4018: remove test_config implementation Yann Droneaud
2013-03-24 21:06         ` [PATCH 02/15] t7810: " Yann Droneaud
2013-03-24 21:06         ` [PATCH 03/15] t7811: " Yann Droneaud
2013-03-24 21:06         ` [PATCH 04/15] t3400: use test_config to set/unset git config variables Yann Droneaud
2013-03-24 21:06         ` [PATCH 05/15] t4304: " Yann Droneaud
2013-03-24 21:06         ` [PATCH 06/15] t4034: use test_config/test_unconfig " Yann Droneaud
2013-03-24 21:06         ` Yann Droneaud [this message]
2013-03-24 21:06         ` [PATCH 08/15] t5520: use test_config " Yann Droneaud
2013-03-24 21:06         ` [PATCH 09/15] t5541: " Yann Droneaud
2013-03-24 21:06         ` [PATCH 10/15] t7500: " Yann Droneaud
2013-03-24 21:06         ` [PATCH 11/15] t7502: " Yann Droneaud
2013-03-24 21:06         ` [PATCH 12/15] t7508: " Yann Droneaud
2013-03-24 21:06         ` [PATCH 13/15] t7600: " Yann Droneaud
2013-03-24 21:06         ` [PATCH 14/15] t9500: " Yann Droneaud
2013-03-24 21:06         ` [PATCH 15/15] t7502: remove clear_config Yann Droneaud
2013-03-27 15:04           ` Junio C Hamano
2013-03-27 15:05         ` [PATCH 00/15] Use test_config Junio C Hamano
2013-03-27 16:19           ` Yann Droneaud
2013-03-22 15:23     ` git merge <tag> behavior Junio C Hamano
2013-03-22 10:57 ` [PATCH] t7600: merge tag shoud create a merge commit y
2013-03-22 14:48   ` Junio C Hamano
2013-03-22 14:56     ` Yann Droneaud
2013-03-22 15:05       ` Jeff King
2013-03-22 10:57 ` y

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f8332db5794d0f4accc7c4a0b4c0e5b106eda493.1364158574.git.ydroneaud@opteya.com \
    --to=ydroneaud@opteya.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.