From: Junio C Hamano Date: Tue, 19 Mar 2013 19:15:14 +0000 (-0700) Subject: Merge branch 'nd/doc-index-format' X-Git-Tag: v1.8.3-rc0~223 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/865e99b5fde9a9128b34b6f3805f726c7a3b1b13?ds=inline;hp=-c Merge branch 'nd/doc-index-format' Update the index format documentation to mention the v4 format. * nd/doc-index-format: update-index: list supported idx versions and their features read-cache.c: use INDEX_FORMAT_{LB,UB} in verify_hdr() index-format.txt: mention of v4 is missing in some places --- 865e99b5fde9a9128b34b6f3805f726c7a3b1b13 diff --combined Documentation/git-update-index.txt index 77a912d4ea,dd36d13285..c92775829b --- a/Documentation/git-update-index.txt +++ b/Documentation/git-update-index.txt @@@ -82,10 -82,10 +82,10 @@@ OPTION When these flags are specified, the object names recorded for the paths are not updated. Instead, these options set and unset the "assume unchanged" bit for the - paths. When the "assume unchanged" bit is on, git stops + paths. When the "assume unchanged" bit is on, Git stops checking the working tree files for possible modifications, so you need to manually unset the bit to - tell git when you change the working tree file. This is + tell Git when you change the working tree file. This is sometimes helpful when working with a big project on a filesystem that has very slow lstat(2) system call (e.g. cifs). @@@ -145,7 -145,15 +145,15 @@@ you will need to handle the situation m --index-version :: Write the resulting index out in the named on-disk format version. - The current default version is 2. + Supported versions are 2, 3 and 4. The current default version is 2 + or 3, depending on whether extra features are used, such as + `git add -N`. + + + Version 4 performs a simple pathname compression that reduces index + size by 30%-50% on large repositories, which results in faster load + time. Version 4 is relatively young (first released in in 1.8.0 in + October 2012). Other Git implementations such as JGit and libgit2 + may not support it yet. -z:: Only meaningful with `--stdin` or `--index-info`; paths are @@@ -253,18 -261,18 +261,18 @@@ $ git ls-files - Using ``assume unchanged'' bit ------------------------------ -Many operations in git depend on your filesystem to have an +Many operations in Git depend on your filesystem to have an efficient `lstat(2)` implementation, so that `st_mtime` information for working tree files can be cheaply checked to see if the file contents have changed from the version recorded in the index file. Unfortunately, some filesystems have inefficient `lstat(2)`. If your filesystem is one of them, you can set "assume unchanged" bit to paths you have not changed to -cause git not to do this check. Note that setting this bit on a -path does not mean git will check the contents of the file to -see if it has changed -- it makes git to omit any checking and +cause Git not to do this check. Note that setting this bit on a +path does not mean Git will check the contents of the file to +see if it has changed -- it makes Git to omit any checking and assume it has *not* changed. When you make changes to working -tree files, you have to explicitly tell git about it by dropping +tree files, you have to explicitly tell Git about it by dropping "assume unchanged" bit, either before or after you modify them. In order to set "assume unchanged" bit, use `--assume-unchanged` @@@ -274,7 -282,7 +282,7 @@@ have the "assume unchanged" bit set, us The command looks at `core.ignorestat` configuration variable. When this is true, paths updated with `git update-index paths...` and -paths updated with other git commands that update both index and +paths updated with other Git commands that update both index and working tree (e.g. 'git apply --index', 'git checkout-index -u', and 'git read-tree -u') are automatically marked as "assume unchanged". Note that "assume unchanged" bit is *not* set if diff --combined Documentation/technical/index-format.txt index 27c716b15f,dcd51b97d9..0810251f5a --- a/Documentation/technical/index-format.txt +++ b/Documentation/technical/index-format.txt @@@ -1,7 -1,7 +1,7 @@@ -GIT index format +Git index format ================ -== The git index file has the following format +== The Git index file has the following format All binary numbers are in network byte order. Version 2 is described here unless stated otherwise. @@@ -12,7 -12,7 +12,7 @@@ The signature is { 'D', 'I', 'R', 'C' } (stands for "dircache") 4-byte version number: - The current supported versions are 2 and 3. + The current supported versions are 2, 3 and 4. 32-bit number of index entries. @@@ -21,9 -21,9 +21,9 @@@ - Extensions Extensions are identified by signature. Optional extensions can - be ignored if GIT does not understand them. + be ignored if Git does not understand them. - GIT currently supports cached tree and resolve undo extensions. + Git currently supports cached tree and resolve undo extensions. 4-byte extension signature. If the first byte is 'A'..'Z' the extension is optional and can be ignored. @@@ -93,8 -93,8 +93,8 @@@ 12-bit name length if the length is less than 0xFFF; otherwise 0xFFF is stored in this field. - (Version 3) A 16-bit field, only applicable if the "extended flag" - above is 1, split into (high to low bits). + (Version 3 or later) A 16-bit field, only applicable if the + "extended flag" above is 1, split into (high to low bits). 1-bit reserved for future diff --combined read-cache.c index 827ae55c50,5cddbc325f..670a06bc79 --- a/read-cache.c +++ b/read-cache.c @@@ -197,25 -197,21 +197,25 @@@ static int ce_match_stat_basic(struct c } if (ce->ce_mtime.sec != (unsigned int)st->st_mtime) changed |= MTIME_CHANGED; - if (trust_ctime && ce->ce_ctime.sec != (unsigned int)st->st_ctime) + if (trust_ctime && check_stat && + ce->ce_ctime.sec != (unsigned int)st->st_ctime) changed |= CTIME_CHANGED; #ifdef USE_NSEC - if (ce->ce_mtime.nsec != ST_MTIME_NSEC(*st)) + if (check_stat && ce->ce_mtime.nsec != ST_MTIME_NSEC(*st)) changed |= MTIME_CHANGED; - if (trust_ctime && ce->ce_ctime.nsec != ST_CTIME_NSEC(*st)) + if (trust_ctime && check_stat && + ce->ce_ctime.nsec != ST_CTIME_NSEC(*st)) changed |= CTIME_CHANGED; #endif - if (ce->ce_uid != (unsigned int) st->st_uid || - ce->ce_gid != (unsigned int) st->st_gid) - changed |= OWNER_CHANGED; - if (ce->ce_ino != (unsigned int) st->st_ino) - changed |= INODE_CHANGED; + if (check_stat) { + if (ce->ce_uid != (unsigned int) st->st_uid || + ce->ce_gid != (unsigned int) st->st_gid) + changed |= OWNER_CHANGED; + if (ce->ce_ino != (unsigned int) st->st_ino) + changed |= INODE_CHANGED; + } #ifdef USE_STDEV /* @@@ -223,8 -219,8 +223,8 @@@ * clients will have different views of what "device" * the filesystem is on */ - if (ce->ce_dev != (unsigned int) st->st_dev) - changed |= INODE_CHANGED; + if (check_stat && ce->ce_dev != (unsigned int) st->st_dev) + changed |= INODE_CHANGED; #endif if (ce->ce_size != (unsigned int) st->st_size) @@@ -1260,7 -1256,7 +1260,7 @@@ static int verify_hdr(struct cache_head if (hdr->hdr_signature != htonl(CACHE_SIGNATURE)) return error("bad signature"); hdr_version = ntohl(hdr->hdr_version); - if (hdr_version < 2 || 4 < hdr_version) + if (hdr_version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < hdr_version) return error("bad index version %d", hdr_version); git_SHA1_Init(&c); git_SHA1_Update(&c, hdr, size - 20);