Skip to content

Commit 7f30e62

Browse files
pks-tgitster
authored andcommitted
t: prepare git config --unset calls for set -e
We have a couple of calls to `git config --unset` that ultimately end up as no-ops as the configuration variables aren't set (anymore) in the first place. These calls are mostly intended to recover unconditionally from tests that may have executed only partially, but they'll ultimately fail during a normal test run. This hasn't been a problem until now as we aren't running tests with `set -e`. This is about to change though, so let's silence the case where we cannot unset the config keys. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent c0b92f0 commit 7f30e62

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

t/t4032-diff-inter-hunk-context.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ f() {
1717

1818
t() {
1919
use_config=
20-
git config --unset diff.interHunkContext
20+
git config --unset diff.interHunkContext || :
2121

2222
case $# in
2323
4) hunks=$4; cmd="diff -U$3";;

t/t7508-status.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,8 +773,8 @@ test_expect_success TTY 'status --porcelain ignores color.status' '
773773
'
774774

775775
# recover unconditionally from color tests
776-
git config --unset color.status
777-
git config --unset color.ui
776+
git config --unset color.status || :
777+
git config --unset color.ui || :
778778

779779
test_expect_success 'status --porcelain respects -b' '
780780

t/t9138-git-svn-authors-prog.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ test_expect_success 'authors-file overrode authors-prog' '
6868
)
6969
'
7070

71-
git --git-dir=x/.git config --unset svn.authorsfile
72-
git --git-dir=x/.git config --unset svn.authorsprog
71+
git --git-dir=x/.git config --unset svn.authorsfile || :
72+
git --git-dir=x/.git config --unset svn.authorsprog || :
7373

7474
test_expect_success 'authors-prog imported user without email' '
7575
svn mkdir -m gg --username gg-hermit "$svnrepo"/gg &&

0 commit comments

Comments
 (0)