Re: [PATCH 03/32] cache-tree: ignore CE_REMOVE entries in verify_cache()
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Aug 25, 2010, 00:48 UTC
- Message-ID
- <20100825004821.GA10423@burratino>
- In-Reply-To
- <AANLkTi=P-PoBWwDbfGs7v1BTwvJ7uwfe7hd7A+Y7M361@mail.gmail.com>
Nguyen Thai Ngoc Duy wrote:
>> Nguyễn Thái Ngọc Duy wrote:
Show 8 quoted lines
>>> --- a/cache-tree.c
>>> +++ b/cache-tree.c
>>> @@ -156,6 +156,8 @@ static int verify_cache(struct cache_entry **cache,
>>> funny = 0;
>>> for (i = 0; i < entries; i++) {
>>> struct cache_entry *ce = cache[i];
>>> + if (ce->ce_flags & CE_REMOVE)
>>> + continue;[...]
> I was lazy. In patch 26, upload-narrow-merge do three way merge and > drop staged entries within narrow tree (this is at server side, > conflicts within narrow tree will be handled at client side later). > Instead of removing staged entries, I mark them CE_REMOVE.
Ah, ok; so it's to avoid spending time in remove_marked_cache_entries().
I think (though it wouldn't come up in your application) that to keep this and avoid caller confusion one would need something like
if ((cache[i]->ce_flags & CE_REMOVE) || (cache[i+1]->ce_flags & CE_REMOVE)) continue;
in the other loop. I say "something like" because a person could have marked some some but not all stages with CE_REMOVE, causing file/directory conflicts to be missed.
Thanks for the explanation.