Re: [PATCHv2 2/3] t3312-notes-empty: Test that 'git notes' removes empty notes by default
- From
Johan Herland <johan@herland.net>
- Date
- Nov 7, 2014, 09:09 UTC
- Message-ID
- <CALKQrgf+0gp6x4oi-jZguz2p-psZVRWPii81u+bz3yHMe=5cSA@mail.gmail.com>
- In-Reply-To
- <xmqqmw85o4lj.fsf@gitster.dls.corp.google.com>
On Wed, Nov 5, 2014 at 8:00 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 10 quoted lines
> Johan Herland <johan@herland.net> writes:
>> +verify_missing() {
>> + git log -1 > actual &&
>
> Hmph, it was unclear what exactly you are trying to check with this
> one and the other "git log -1 >expect_missing".
>
> Perhaps a comment that says "We are interested in the trailing
> 'Notes: ...' in the output" is necessary here, or (probably even
> better) use the --format='%N' to make it crystal clear?I'm rewriting the tests not to use 'git log' at all. We already have other tests that check the formatting of notes, so we really only need to use "git notes list HEAD" in these tests.
Show 6 quoted lines
>> + test_cmp expect_missing actual && >> + ! git notes list HEAD > > Isn't this test_must_fail (i.e. if somebody screws up to make "git > notes list" segfault, the test should fail, not taking the dying > with SEGV as a sign of success)?
Yes, will fix.
Show 35 quoted lines
>> +} >> + >> +for cmd in \ >> + 'add' \ >> + 'add -F /dev/null' \ >> + 'add -m ""' \ >> + 'add -c "$empty_blob"' \ >> + 'add -C "$empty_blob"' \ >> + 'append' \ >> + 'append -F /dev/null' \ >> + 'append -m ""' \ >> + 'append -c "$empty_blob"' \ >> + 'append -C "$empty_blob"' \ >> + 'edit' >> +do >> + test_expect_success "'git notes $cmd' removes empty note" " >> + cleanup_notes && >> + MSG= git notes $cmd && >> + verify_missing >> + " >> +done > > Perhaps just a taste issue, but I would think > > while read cmd > do > ... that test eval with $cmd interpolation ... > done <<-\EOF > add > add -F /dev/null > ... > EOF > > would be easier to maintain and to read, without having to worry > about quoting and backslashing.
Thanks. That's much easier to read. Will fix.
On Wed, Nov 5, 2014 at 7:36 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 6 quoted lines
> By definition, an empty note is empty ;-) and devoid of useful > information other than a single bit, its existence. I would > understand a handful of tests that check "oh by the way, we should > also handle empty ones sensibly", but are you sure that a _new_ > separate test script, not addition to existing test script, is worth > to check _only_ empty notes?
Will move the tests into t3301 in the re-roll.
...Johan
-- Johan Herland, <johan@herland.net> www.herland.net