t: use nongit() function where applicable

Many tests want to run a command outside of any git repo;
with the nongit() function this is now a one-liner. It saves
a few lines, but more importantly, it's immediately obvious
what the code is trying to accomplish.

This doesn't convert every such case in the test suite; it
just covers those that want to do a one-off command. Other
cases, such as the ones in t4035, are part of a larger
scheme of outside-repo files, and it's less confusing for
them to stay consistent with the surrounding tests.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2016-12-15 21:31:59 -05:00
committed by Junio C Hamano
parent 7176a31444
commit a3c45d1260
3 changed files with 5 additions and 29 deletions

View File

@ -17,25 +17,12 @@ case "$GIT_SVN_LC_ALL" in
;;
esac
deepdir=nothing-above
ceiling=$PWD
test_expect_success 'git svn --version works anywhere' '
mkdir -p "$deepdir" && (
GIT_CEILING_DIRECTORIES="$ceiling" &&
export GIT_CEILING_DIRECTORIES &&
cd "$deepdir" &&
git svn --version
)
nongit git svn --version
'
test_expect_success 'git svn help works anywhere' '
mkdir -p "$deepdir" && (
GIT_CEILING_DIRECTORIES="$ceiling" &&
export GIT_CEILING_DIRECTORIES &&
cd "$deepdir" &&
git svn help
)
nongit git svn help
'
test_expect_success \