From: Dmitry Ivankov Date: Sun, 14 Aug 2011 18:32:23 GMT Subject: [PATCH v2 1/2] fast-import: add a test for tree delta base corruption Message-ID: <1313346744-30340-2-git-send-email-divanorama@gmail.com> In-Reply-To: <1313145170-24471-1-git-send-email-divanorama@gmail.com> fast-import is able to write imported tree objects in delta format. It holds a tree structure in memory where each tree entry may have a delta base sha1 assigned. When delta base data is needed it is reconstructed from this in-memory structure. Though sometimes the delta base data doesn't match the delta base sha1 so wrong or even corrupt pack is produced. Add a small test that produces a corrupt pack. It uses just tree copy and file modification commands aside from the very basic commit and blob commands. Signed-off-by: Dmitry Ivankov --- t/t9300-fast-import.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-) diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index f256475..e2b94b5 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -734,6 +734,47 @@ test_expect_success \ git diff-tree --abbrev --raw L^ L >output && test_cmp expect output' +cat >input < 1112912473 -0700 +data < 1112912473 -0700 +data <expect +g/b/f +g/b/h +EOF + +test_expect_failure \ + 'L: nested tree copy does not corrupt deltas' \ + 'git fast-import tmp && + cat tmp | cut -f 2 >actual && + test_cmp expect actual && + git fsck `git rev-parse L2`' + +git update-ref -d refs/heads/L2 + ### ### series M ### -- 1.7.3.4