From: Tim Henigan Date: Mon, 18 Jun 2012 17:51:51 GMT Subject: Re: [PATCH] diff: exit(1) if 'diff --quiet ' finds changes Message-ID: In-Reply-To: <7vipes9w0p.fsf@alter.siamese.dyndns.org> On Fri, Jun 15, 2012 at 4:10 PM, Junio C Hamano wrote: > Tim Henigan writes: > >> I will send v2 with the change to 'diff-no-index.c' suggested by >> Junio.  I will also include the 'test_expect_code' improvement >> suggested by Jeff. > > Also the test script shouldn't be just testing a simplest case, I > would think. > > For example, comparing two files with "a b c" and "a  b c" in them > with "--quiet" should yield "They are different!" while running the > same comparison with "--quiet -w" should say "They are the same!", > no? 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. So, I am thinking of adding 't/t4054-diff-outside-repo.sh' that does the following: 1) setup (includes a cd into the repo directory) 2) git diff --quiet, one outside repo, matching files 3) git diff --quiet, one outside repo, different files 4) git diff --quiet, one outside repo, ignore trailing whitespace 5) git diff --quiet, one outside repo, ignore all whitespace 6) git diff --quiet, both outside repo, matching files 7) git diff --quiet, both outside repo, different files 8) git diff --quiet, both outside repo, ignore trailing whitespace 9) git diff --quiet, both outside repo, ignore all whitespace 10) cleanup (cd back to $HOME test directory) Does this sound reasonable?