On Sun, Jul 7, 2013 at 3:11 PM, Thomas Gummerer <t.gummerer@xxxxxxxxx> wrote: > +== File entry (fileentries) > + > + File entries are sorted in ascending order on the name field, after the > + respective offset given by the directory entries. All file names are > + prefix compressed, meaning the file name is relative to the directory. > + > + filename (variable length, nul terminated). The exact encoding is > + undefined, but the filename cannot contain a NUL byte (iow, the same > + encoding as a UNIX pathname). > + > + flags (16-bits): 'flags' field split into (high to low bits) > + > + assumevalid (1-bit): assume-valid flag > + > + intenttoadd (1-bit): intent-to-add flag, used by "git add -N". > + Extended flag in index v3. > + > + stage (2-bit): stage of the file during merge > + > + skipworktree (1-bit): skip-worktree flag, used by sparse checkout. > + Extended flag in index v3. > + > + smudged (1-bit): indicates if the file is racily smudged. > + > + 10-bit unused, must be zero [6] > + > + mode (16-bits): file mode, split into (high to low bits) > + > + objtype (4-bits): object type > + valid values in binary are 1000 (regular file), 1010 (symbolic > + link) and 1110 (gitlink) > + > + 3-bit unused > + > + permission (9-bits): unix permission. Only 0755 and 0644 are valid > + for regular files. Symbolic links and gitlinks have value 0 in > + this field. > + > + mtimes (32-bits): mtime seconds, the last time a file's data changed > + this is stat(2) data > + > + mtimens (32-bits): mtime nanosecond fractions > + this is stat(2) data > + > + file size (32-bits): The on-disk size, trucated to 32-bit. > + this is stat(2) data > + > + statcrc (32-bits): crc32 checksum over ctime seconds, ctime > + nanoseconds, ino, dev, uid, gid (All stat(2) data > + except mtime and file size). If the statcrc is 0 it will > + be ignored. [7] > + > + objhash (160-bits): SHA-1 for the represented object > + > + entrycrc (32-bits): crc32 checksum for the file entry. The crc code > + includes the offset to the offset to the file, relative to the > + beginning of the file. Question about the possibility of updating index file directly. If git updates a few fields of an entry (but not entrycrc yet) and crashes, the entry would become corrupt because its entrycrc does not match the content. What do we do? Do we need to save a copy of the entry somewhere in the index file (maybe in the conflict data section), so that the reader can recover the index? Losing the index because of bugs is big deal in my opinion. pre-v5 never faces this because we keep the original copy til the end. Maybe entrycrc should not cover stat fields and statcrc. It would make refreshing safer. If the above happens during refresh, only statcrc is corrupt and we can just refresh the entry. entrycrc still says the other fields are good (and they are). -- Duy -- 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