git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tim Henigan <tim.henigan@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [PATCH] diff: exit(1) if 'diff --quiet <repo file> <external file>' finds changes
Date: Mon, 18 Jun 2012 13:51:51 -0400	[thread overview]
Message-ID: <CAFouetjkSQuY6pyFdiVsM5tUnEiFK6uWTqDO38uhwUjaDVre1w@mail.gmail.com> (raw)
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:
> 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?

  reply	other threads:[~2012-06-18 17:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-15 17:31 [PATCH] diff: exit(1) if 'diff --quiet <repo file> <external file>' finds changes Tim Henigan
2012-06-15 18:40 ` Jeff King
2012-06-15 19:13   ` Jeff King
2012-06-15 18:45 ` Junio C Hamano
2012-06-15 19:37   ` Jeff King
2012-06-15 19:56     ` Tim Henigan
2012-06-15 20:08       ` Junio C Hamano
2012-06-15 20:24         ` Jeff King
2012-06-15 20:44           ` Junio C Hamano
2012-06-15 20:10       ` Junio C Hamano
2012-06-18 17:51         ` Tim Henigan [this message]
2012-06-18 18:00           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFouetjkSQuY6pyFdiVsM5tUnEiFK6uWTqDO38uhwUjaDVre1w@mail.gmail.com \
    --to=tim.henigan@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).