diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-08-28 21:19:16 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-28 21:19:16 -0700 |
commit | f946b465d7fa13a235dd5653d37c7babb1ceb233 (patch) | |
tree | d3a1aa2e6f0779e5440cec0815f0d59d9e31b4d4 /t/test-lib.sh | |
parent | e5cfcb04e0acc5f3b51e6d69487028315b33e4c9 (diff) | |
parent | c9bfb953489e559d513c1627150aa16f8d42d6c5 (diff) | |
download | git-f946b465d7fa13a235dd5653d37c7babb1ceb233.tar.gz git-f946b465d7fa13a235dd5653d37c7babb1ceb233.tar.xz |
Merge branch 'jk/color-and-pager'
* jk/color-and-pager:
want_color: automatically fallback to color.ui
diff: don't load color config in plumbing
config: refactor get_colorbool function
color: delay auto-color decision until point of use
git_config_colorbool: refactor stdout_is_tty handling
diff: refactor COLOR_DIFF from a flag into an int
setup_pager: set GIT_PAGER_IN_USE
t7006: use test_config helpers
test-lib: add helper functions for config
t7006: modernize calls to unset
Conflicts:
builtin/commit.c
parse-options.c
Diffstat (limited to 't/test-lib.sh')
-rw-r--r-- | t/test-lib.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh index e27422217..d7dfc8b0b 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -361,6 +361,24 @@ test_chmod () { git update-index --add "--chmod=$@" } +# Unset a configuration variable, but don't fail if it doesn't exist. +test_unconfig () { + git config --unset-all "$@" + config_status=$? + case "$config_status" in + 5) # ok, nothing to unset + config_status=0 + ;; + esac + return $config_status +} + +# Set git config, automatically unsetting it after the test is over. +test_config () { + test_when_finished "test_unconfig '$1'" && + git config "$@" +} + # Use test_set_prereq to tell that a particular prerequisite is available. # The prerequisite can later be checked for in two ways: # |