Re: [PATCH 3/6] Stop producing index version 2
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Feb 7, 2012, 08:51 UTC
- Message-ID
- <CACsJy8DBenQGrF4-X-rsUmJQUhx6MMQg+8Yrspjuxx6W6L48AQ@mail.gmail.com>
- In-Reply-To
- <CACsJy8Ayqea75xeFKJNm6iT7GSUGDEfvZD17uEv7ihr4SS2LMg@mail.gmail.com>
On Tue, Feb 7, 2012 at 11:50 AM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
Show 7 quoted lines
>> Version 3 was a mistake because of the variable length record sizes. >> Saving 2 bytes on some records that don't use the extended flags makes >> the index file *MUCH* harder to parse. So much so that we should take >> version 3 and kill it, not encourage it as the default! > > Probably too late for that, but it's good to know there are strong > user base for v2.
OK probably not too late. We cannot kill it, but we could deprecate it. We can introduce a mandatory extension to store extra flags. The extension is basically an array of
struct ce_extended_flags {
int ce_index; /* points to istate->cache[ce_index] */
unsigned long flags;
};On reading the extension, extra flags is applied back in mem, the extension is created again when new index is written. There are only two users of index v3: skip-worktree and intent-to-add bits, which are not used often, I think. Still want to kill it?
Switching from sha-1 to crc32 could be done the same way (i.e. new mandatory extension _at the end_ that contains crc32 checksum and skip sha-1 check on reading if it's all zero) if we agree to move to crc32.
-- Duy