X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ftest-lib.sh;h=bdd9513b84301275330d3dd7e49af05081ef9cd7;hb=8f41c07f90da5e314cbc428f1e3e936563f7f39d;hp=e27422217db28f0c6693deb0d9c093ba89a72dda;hpb=7abd8fb36d90cc68d471a04b59846d7816609116;p=git.git diff --git a/t/test-lib.sh b/t/test-lib.sh index e27422217..bdd9513b8 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: # @@ -932,6 +950,8 @@ then do make_valgrind_symlink $file done + # special-case the mergetools loadables + make_symlink "$GIT_BUILD_DIR"/mergetools "$GIT_VALGRIND/bin/mergetools" OLDIFS=$IFS IFS=: for path in $PATH