From: Jeff King Date: Sun, 11 Mar 2007 16:34:13 GMT Subject: Re: [PATCH] fast-import: use binary search in tree_content_remove Message-ID: <20070311163412.GB7110@coredump.intra.peff.net> In-Reply-To: <20070311033833.GB10781@spearce.org> On Sat, Mar 10, 2007 at 10:38:33PM -0500, Shawn O. Pearce wrote: > Well, its not necessary for you, as you aren't trying to remove > something from your huge tree. ;-) Heh, I meant necessary as in "Oops, I probably just completely broke fast-import". But I see I managed to do that anyway. :) > Your patch is fine. fast-import takes an "optimization" here and > does not bother to actually delete entries from a tree until *after* OK, that was my reading, as well; thanks for confirming. > Jeff King's recent changes to sort trees by strictly name (and binary > search to locate an entry) works OK up until we have to write a > tree out that uses the funny name/mode sorting that native Git uses: And here is a test that I believe triggers the problem (fails with my patches, succeeds with your fix): diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 2e1a09f..2ec68b0 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -501,4 +501,54 @@ test_expect_success \ 'test `git-rev-parse --verify branch^1` \ = `git-rev-parse --verify K^1`' +### +### series L +### + +cat >input < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data <expect <output && + diff -u expect output' + test_done > I'm plastering over the problem by resorting a tree strictly by > name after it has been written out and the deleted entries have > been filtered out. I wonder if we could make this a bit cleaner by actually using the git sort in the first place. I will take a look... -Peff