Re: [PATCH 2/2] reset: support "--mixed --intent-to-add" mode
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Feb 5, 2014, 23:48 UTC
- Message-ID
- <CACsJy8Aj-5MzRjDxfWkOVtqxjo+w7v6uEjGfGAj_9s59t5eiYA@mail.gmail.com>
- In-Reply-To
- <xmqqbnyl5sde.fsf@gitster.dls.corp.google.com>
On Thu, Feb 6, 2014 at 1:25 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 5 quoted lines
>> Yes, indeed. I wonder why your new test did not notice it, though >> ;-) > > ... and the answer turns out to be that it was not testing the right > thing. On top of that faulty version, this will fix it.
Yes, write-tree should test that well.
> Your suggestion to move CE_INTENT_TO_ADD to mark-intent-to-add makes > sense but a caller needs to be adjusted to drop the duplicated flag > manipulation.
No no. I found that duplicate, but I did not suggest removing it because it is needed there..
Show 9 quoted lines
> @@ -613,8 +614,6 @@ int add_to_index(struct index_state *istate, const char *path, struct stat *st, > ce->ce_namelen = namelen; > if (!intent_only) > fill_stat_cache_info(ce, st); > - else > - ce->ce_flags |= CE_INTENT_TO_ADD; > > if (trust_executable_bit && has_symlinks) > ce->ce_mode = create_ce_mode(st_mode);
A few lines down, there's ie_match_stat() call that will check CE_INTENT_TO_ADD and returns "changed" immediately without looking at stat data. If stat info is used, it may (not so sure) return "not changed", the exit path is taken and mark_intent_to_add() is ignored.
-- Duy