t9301: Fix testcase covering up a bug in fast-import's notes fanout handling
commitd1075414dcd48948ecba65ac7bcae23bee73801f
authorJohan Herland <johan@herland.net>
Fri, 25 Nov 2011 00:09:45 +0000 (25 01:09 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 29 Nov 2011 00:36:44 +0000 (28 16:36 -0800)
tree7803d4cf98ddd087ca389682ab625d01613f823d
parentfc14b89a7e6899b8ac3b5751ec2d8c98203ea4c2
t9301: Fix testcase covering up a bug in fast-import's notes fanout handling

There is a bug in fast-import where the fanout levels of an existing notes
tree being loaded into the fast-import machinery is disregarded. Instead, any
tree loaded is assumed to have a fanout level of 0. If the true fanout level
is deeper, any attempt to remove a note from that tree will silently fail
(as the note will not be found at fanout level 0).

However, this bug was covered up by the way in which the t9301 testcase was
written: When generating the fast-import commands to test mass removal of
notes, we appended these commands to an already existing 'input' file which
happened to already contain the fast-import commands used in the previous
subtest to generate the very same notes tree. This would normally be harmless
(but suboptimal) as the notes created were identical to the notes already
present in the notes tree. But the act of repeating all the notes additions
caused the internal fast-import data structures to recalculate the fanout,
instead of hanging on to the initial (incorrect) fanout (that causes the bug
described above). Thus, the subsequent removal of notes in the same 'input'
file would succeed, thereby covering up the bug described above.

This patch creates a new 'input' file instead of appending to the file from
the previous subtest. Thus, we end up properly testing removal of notes that
were added by a previous fast-import command. As a side effect, the notes
removal can no longer refer to commits using the marks set by the previous
fast-import run, instead the commits names must be referenced directly.

The underlying fast-import bug is still present after this patch, but now we
have at least uncovered it. Therefore, the affected subtests are labeled as
expected failures until the underlying bug is fixed.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t9301-fast-import-notes.sh