Re: [PATCH] diff: exit(1) if 'diff --quiet <repo file> <external file>' finds changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tim Henigan <tim.henigan@xxxxxxxxx> writes:

> To obtain full coverage, it seems we need to test:
>     1) git diff --quiet <file in repo> <file outside repo>
>     2) git diff --quiet <file outside repo> <file outside repo>
>
> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]