Nguyễn Thái Ngọc Duy schrieb: > +/* Extended flags in ondisk_cache_entry_extended */ > +#define CE_EXTENDED2 (0x80000000) > +#define CE_EXTENDED_MASK (CE_EXTENDED2) Wouldn't it be better, from a maintainance point of view, to have #define CE_EXTENDED_MASK 0xffff0000 right from the beginning? > @@ -1143,19 +1144,29 @@ static void convert_from_disk(struct ondisk_cache_entry *ondisk, struct cache_en > /* On-disk flags are just 16 bits */ > ce->ce_flags = ntohs(ondisk->flags); > > - /* For future extension: we do not understand this entry yet */ > - if (ce->ce_flags & CE_EXTENDED) > - die("Unknown index entry format"); > hashcpy(ce->sha1, ondisk->sha1); > > len = ce->ce_flags & CE_NAMEMASK; > + > + if (ce->ce_flags & CE_EXTENDED) { > + struct ondisk_cache_entry_extended *ondisk2; > + ondisk2 = (struct ondisk_cache_entry_extended *)ondisk; > + ce->ce_flags |= (ntohs(ondisk2->flags2) << 16) & CE_EXTENDED_MASK; > + /* For future extension: we do not understand the last bit yet */ > + if (ce->ce_flags & CE_EXTENDED2) > + die("Unknown index entry format"); At this point, we do not understand the CE_EXTENDED2 flag; but we do not understand any of the other 15 extended flags, either. So, you should error out if *any* of them is non-zero. > + name = ondisk2->name; > + } > + else > + name = ondisk->name; -- Hannes -- 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