git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Tim Henigan <tim.henigan@gmail.com>
Date
Jun 18, 2012, 17:51 UTC
Message-ID
<CAFouetjkSQuY6pyFdiVsM5tUnEiFK6uWTqDO38uhwUjaDVre1w@mail.gmail.com>
In-Reply-To
<7vipes9w0p.fsf@alter.siamese.dyndns.org>
On Fri, Jun 15, 2012 at 4:10 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> Tim Henigan <tim.henigan@gmail.com> 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 <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.

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?
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 12 in “diff: exit(1) if 'diff --quiet <repo file> <external file>' finds changes”
  1. diff: exit(1) if 'diff --quiet <repo file> <external file>' finds changesTim Henigan, Jun 15, 2012
  2. Jeff KingJun 15, 2012
  3. Jeff KingJun 15, 2012
  4. Junio C HamanoJun 15, 2012
  5. Jeff KingJun 15, 2012
  6. Tim HeniganJun 15, 2012
  7. Junio C HamanoJun 15, 2012
  8. Jeff KingJun 15, 2012
  9. Junio C HamanoJun 15, 2012
  10. Junio C HamanoJun 15, 2012
  11. Tim HeniganJun 18, 2012
  12. Junio C HamanoJun 18, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.