Re: [PATCHv3 5/6] fast-export: Fix output order of D/F changes
- From
Elijah Newren <newren@gmail.com>
- Date
- Jul 8, 2010, 04:36 UTC
- Message-ID
- <AANLkTiklqqxUhTBd4In-VQed_SMQ6X0nk2j2ysE20bmD@mail.gmail.com>
- In-Reply-To
- <7vy6dnrmvu.fsf@alter.siamese.dyndns.org>
On Wed, Jul 7, 2010 at 3:40 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 22 quoted lines
> newren@gmail.com writes: > >> From: Elijah Newren <newren@gmail.com> >> >> The fast-import stream format requires incremental changes which take place >> immediately, meaning that for D->F conversions all files below the relevant >> directory must be deleted before the resulting file of the same name is >> created. Reversing the order can result in fast-import silently deleting >> the file right after creating it, resulting in the file missing from the >> resulting repository. >> >> We correct the order by instructing the diff_tree machinery to compare >> entries using df_name_compare instead of base_name_compare. > > I am not so sure about this one. > > You can be walking two trees, one of which has "b-1" (blob), "b-2" (blob) > and then "b" (tree), while the other one has "b" (blob), "b-1" (blob) and > then "b-2" (blob). The patch tells the machinery that "b" (tree) sorts > just like "b" (blob) only during comparison, but the actual data stream it > is walking is sorted differently. Without some form of lookahead, can you > reliably "correct the order"?
Doh! Yep, you're right. My patch would not handle that case correctly. I'll dig further.