From: Junio C Hamano Date: Mon, 18 Jun 2012 18:00:31 GMT Subject: Re: [PATCH] diff: exit(1) if 'diff --quiet ' finds changes Message-ID: <7v1ulc4i0w.fsf@alter.siamese.dyndns.org> In-Reply-To: Tim Henigan writes: > To obtain full coverage, it seems we need to test: > 1) git diff --quiet > 2) git diff --quiet > > for each of the following options: > a) no additional options > b) --ignore-space-at-eol > c) --ignore-all-space > > These seem like the only diff options that should be tested...am I > missing anything? > > Because some of the tests require one directory that is a repo and one > directory that is not, it seems best to create a new test file with > $TEST_NO_CREATE_REPO set. Then the setup function can create both the > repo and the plain directory. It is probably overkill to add a new test that only to add 3 (the "two paths outside repo" among the 6 = 2 * 3 combinations above). Inside t4035, you could dig new directory two levels deep, chdir to it and set GIT_CEILING_DIRECTORY to its first level and run test, no? Something along these lines (the diff invoked would obviously be not between foo and bar)... t/t4035-diff-quiet.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/t/t4035-diff-quiet.sh b/t/t4035-diff-quiet.sh index cdb9202..e7065cc 100755 --- a/t/t4035-diff-quiet.sh +++ b/t/t4035-diff-quiet.sh @@ -77,4 +77,16 @@ test_expect_success 'git diff-index --cached HEAD' ' } ' +test_expect_success 'git diff-no-index outside repository' ' + mkdir -p not/here && + ( + cd not/here && + GIT_CEILING_DIRECTORIES=$TRASH_DIRECTORY/not && + export GIT_CEILING_DIRECTORIES && + echo foo >foo && + echo bar >bar && + git diff foo bar + ) +' + test_done