Nguyễn Thái Ngọc Duy wrote: > Index in narrow repos is not a full index and should not be used > to create commits without modification (to be explained later on). [...] > +++ b/read-cache.c > @@ -25,8 +25,9 @@ static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int reall > */ > > #define CACHE_EXT(s) ( (s[0]<<24)|(s[1]<<16)|(s[2]<<8)|(s[3]) ) > -#define CACHE_EXT_TREE 0x54524545 /* "TREE" */ > +#define CACHE_EXT_TREE 0x54524545 /* "TREE" */ > #define CACHE_EXT_RESOLVE_UNDO 0x52455543 /* "REUC" */ > +#define CACHE_EXT_NARROW 0x4e415257 /* "NARW" */ Just curious: why aren't we using #define CACHE_EXT_TREE CACHE_EXT("TREE") #define CACHE_EXT_RESOLVE_UNDO CACHE_EXT("REUC") #define CACHE_EXT_NARROW CACHE_EXT("NARW") Are they invalid case labels? I think non-optional extensions might need to be lowercase ("narw") though I am not sure. > @@ -1168,7 +1169,9 @@ static int verify_hdr(struct cache_header *hdr, unsigned long size) > > if (hdr->hdr_signature != htonl(CACHE_SIGNATURE)) > return error("bad signature"); > - if (hdr->hdr_version != htonl(2) && hdr->hdr_version != htonl(3)) > + if (hdr->hdr_version != htonl(2) && > + hdr->hdr_version != htonl(3) && > + hdr->hdr_version != htonl(4)) > return error("bad index version"); [...] > @@ -1568,7 +1584,11 @@ int write_index(struct index_state *istate, int newfd) [...] > + if (get_narrow_prefix() && ver < 4) > + ver = 4; /* narrow-unaware git should to touch this index */ > + > + hdr.hdr_version = htonl(ver); > hdr.hdr_entries = htonl(entries - removed); > > git_SHA1_Init(&c); Oh, or you can do this. :) Thanks for a pleasant read. Looks good so far, though I didn't read the tests. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html