Re: [PATCH 2/6] read-cache: new extension to mark what file is watched
On Tue, Jan 14, 2014 at 12:02 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 16 quoted lines
> Hi,
>
> Nguyễn Thái Ngọc Duy wrote:
>
>> If an entry is "watched", git lets an external program decide if the
>> entry is modified or not. It's more like --assume-unchanged, but
>> designed to be controlled by machine.
>>
>> We are running out of on-disk ce_flags, so instead of extending
>> on-disk entry format again, "watched" flags are in-core only and
>> stored as extension instead.
>
> Makes sense.
>
> Care to add a brief description of the on-disk format for
> Documetnation/technical/index-format.txt as well?
Sure, in the reroll after I fix inotify bugs that make the test suite fail.
Show 19 quoted lines
>> +static void read_watch_extension(struct index_state *istate, uint8_t *data,
>> + unsigned long sz)
>> +{
>> + int i;
>> + if ((istate->cache_nr + 7) / 8 != sz) {
>> + error("invalid 'WATC' extension");
>> + return;
>> + }
>> + for (i = 0; i < istate->cache_nr; i++)
>> + if (data[i / 8] & (1 << (i % 8)))
>> + istate->cache[i]->ce_flags |= CE_WATCHED;
>> +}
>
> So the WATC section has one bit per index entry, encoding whether that
> entry is WATCHED. Makes sense.
>
> Do I understand correctly that this patch just takes care of the
> bookkeeping for the CE_WATCHED bit and the actual semantics will
> come in a later patch?--
Duy