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?
[...]
> --- a/cache.h
> +++ b/cache.h
> @@ -168,6 +168,7 @@ struct cache_entry {
>
> /* used to temporarily mark paths matched by pathspecs */
> #define CE_MATCHED (1 << 26)
> +#define CE_WATCHED (1 << 27)
Nit: I'd add a blank line before the definition of CE_WATCHED to make
it clear that the comment doesn't apply to it.
Maybe it belongs with one of the groups before (e.g., UNPACKED +
NEW_SKIP_WORKTREE). I dunno.
> --- a/read-cache.c
> +++ b/read-cache.c
[...]
> @@ -1289,6 +1290,19 @@ static int verify_hdr(struct cache_header *hdr,
> return 0;
> }
>
> +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?
Thanks,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html