All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/3] notes remove: allow removing more than one
Date: Thu, 19 May 2011 09:31:08 +0200	[thread overview]
Message-ID: <4DD4C73C.7020600@drmicha.warpmail.net> (raw)
In-Reply-To: <7v1uzv9oab.fsf@alter.siamese.dyndns.org>

Junio C Hamano venit, vidit, dixit 19.05.2011 08:50:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
> 
> [jc: cull the part you did not comment on, thanks]
> 
>>> +test_expect_success 'removing more than one' '
>>> +	before=$(git rev-parse --verify refs/notes/commits) &&
>>> +	test_when_finished "git update-ref refs/notes/commits $before" &&
>>> +	git notes remove HEAD^^ HEAD^^^ &&
>>> +	git diff --name-only refs/notes/commits^ refs/notes/commits >actual &&
>>> +	test 2 = $(wc -l <actual) &&
>>> +	git ls-tree -r --name-only refs/notes/commits >actual &&
>>> +	>empty &&
>>> +	test_cmp empty actual
>>> +'
>>
>> You're not really testing that this removes the correct notes. Actually,
>> you're not even testing that this removes only 2 notes when there are
>> more than 2, are you?
> 
> In the test vector, there are only two notes, and I am testing removal of
> multiple.  What do you want me to do?  Test removing one and make sure the
> other one survives ;-)? 

The test has two notes because it was created when remove would remove
one note at a time only, and the test made sure it did not remove the
other one (!).

If you want a meaningful test which tests that "git notes remove A B"
removes exactly 2 notes (not more) you need to add another note first.
Otherwise it could be that your new code simply nukes the notes tree. (I
know it does not, but only by looking at the source; this test does not
check it.)

Checking that it actually removes *those* 2 notes would give extra
credit but may not be necessary (since we know it removes the correct
one in single mode).

> Patches on top of it is very welcome, but I wouldn't bother.

Is that the kind of response you accept from submitters to your (valid)
requests that they provide negative tests in addition to positive ones?

I don't mind helping out with a test patch (later this UTC day) but I'm
concerned about the attitude someone may read into this and may want to
follow as an example. In terms of code-with-test habits, I would claim
that git.git is really an exemplary standard to follow (and to keep).

Cheers,
Michael

  reply	other threads:[~2011-05-19  7:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19  0:14 [PATCH 0/3] "git notes remove" updates Junio C Hamano
2011-05-19  0:14 ` [PATCH 1/3] notes remove: allow removing more than one Junio C Hamano
2011-05-19  6:43   ` Michael J Gruber
2011-05-19  6:50     ` Junio C Hamano
2011-05-19  7:31       ` Michael J Gruber [this message]
2011-05-19 17:44         ` Junio C Hamano
2011-05-19 18:47         ` [PATCH 1/2] fixup! notes remove: --ignore-missing Michael J Gruber
2011-05-19 18:47           ` [PATCH 2/2] fixup! notes remove: --stdin reads from the standard input Michael J Gruber
2011-05-19  0:14 ` [PATCH 2/3] notes remove: --missing-ok Junio C Hamano
2011-05-19  2:00   ` Junio C Hamano
2011-05-19  0:14 ` [PATCH 3/3] notes remove: --stdin reads from the standard input Junio C Hamano
2011-05-19  6:50   ` Michael J Gruber
2011-05-19 10:50   ` Jeff King
2011-05-19 17:55     ` Junio C Hamano
2011-05-19 18:02       ` Jeff King
2011-05-19  2:03 ` [PATCH 4/3] show: --ignore-missing Junio C Hamano
2011-05-19  7:08 ` [PATCH 0/3] "git notes remove" updates Johan Herland

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=4DD4C73C.7020600@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.