{"thread":{"id":"19066","subject":"Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid","startedAt":"2009-04-26T10:55:17Z","lastAt":"2010-03-15T07:41:04Z","messageCount":12,"participants":["Junio C Hamano","Robin Rosenberg","Linus Torvalds","Kjetil Barvik","Alex Riesen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"112395","messageId":"1240743317-10117-1-git-send-email-robin.rosenberg@dewire.com","threadId":"19066","inReplyTo":null,"subject":"[PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2009-04-26T10:55:17Z","receivedAt":"2009-04-26T10:55:17Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"This reason we may want to ignore these fields is that the Java implementation \nof Git cannot set these fields properly. To mark this JGit sets these fields\nto to UINT_MAX (all bits set).\n\nSigned-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n---\n Documentation/config.txt |    7 +++++++\n cache.h                  |    1 +\n config.c                 |    4 ++++\n environment.c            |    1 +\n read-cache.c             |    8 ++++----\n 5 files changed, 17 insertions(+), 4 deletions(-)\n\nIn addition to this you may want to set core.trustctime to false\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 3188569..bdf05ba 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -135,6 +135,13 @@ core.trustctime::\n \tcrawlers and some backup systems).\n \tSee linkgit:git-update-index[1]. True by default.\n \n+core.trustlowlevelstat::\n+    If false, differences in the index in the dev, ino, uid and gid\n+    fields are ignored. Useful when using git implementations that\n+    cannot set these fields correctly, such as Java programs like JGit\n+    used by the EGit plugin for Eclipse.\n+\tSee linkgit:git-update-index[1]. True by default.\n+\n core.quotepath::\n \tThe commands that output paths (e.g. 'ls-files',\n \t'diff'), when not given the `-z` option, will quote\ndiff --git a/cache.h b/cache.h\nindex ab1294d..194021c 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -500,6 +500,7 @@ extern int delete_ref(const char *, const unsigned char *sha1, int delopt);\n /* Environment bits from configuration mechanism */\n extern int trust_executable_bit;\n extern int trust_ctime;\n+extern int trust_lowlevelstat;\n extern int quote_path_fully;\n extern int has_symlinks;\n extern int ignore_case;\ndiff --git a/config.c b/config.c\nindex 8c1ae59..d8679e7 100644\n--- a/config.c\n+++ b/config.c\n@@ -364,6 +364,10 @@ static int git_default_core_config(const char *var, const char *value)\n \t\ttrust_ctime = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n+\tif (!strcmp(var, \"core.trustlowlevelstat\")) {\n+\t\ttrust_lowlevelstat = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n \n \tif (!strcmp(var, \"core.quotepath\")) {\n \t\tquote_path_fully = git_config_bool(var, value);\ndiff --git a/environment.c b/environment.c\nindex 4696885..194a289 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -14,6 +14,7 @@ char git_default_name[MAX_GITNAME];\n int user_ident_explicitly_given;\n int trust_executable_bit = 1;\n int trust_ctime = 1;\n+int trust_lowlevelstat = 1;\n int has_symlinks = 1;\n int ignore_case;\n int assume_unchanged;\ndiff --git a/read-cache.c b/read-cache.c\nindex 45083ab..f8f497f 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -210,10 +210,10 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)\n \t\tchanged |= CTIME_CHANGED;\n #endif\n \n-\tif ((ce->ce_uid != ~0u && ce->ce_uid != (unsigned int) st->st_uid) ||\n-\t    (ce->ce_gid != ~0u && ce->ce_gid != (unsigned int) st->st_gid))\n+\tif ((trust_lowlevelstat && ce->ce_uid != (unsigned int) st->st_uid) ||\n+\t    (trust_lowlevelstat && ce->ce_gid != (unsigned int) st->st_gid))\n \t\tchanged |= OWNER_CHANGED;\n-\tif (ce->ce_ino != ~0u && ce->ce_ino != (unsigned int) st->st_ino)\n+\tif (trust_lowlevelstat && ce->ce_ino != (unsigned int) st->st_ino)\n \t\tchanged |= INODE_CHANGED;\n \n #ifdef USE_STDEV\n@@ -222,7 +222,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)\n \t * clients will have different views of what \"device\"\n \t * the filesystem is on\n \t */\n-\tif (ce->ce_dev != ~0u && ce->ce_dev != (unsigned int) st->st_dev)\n+\tif (trust_lowlevelstat && ce->ce_dev != (unsigned int) st->st_dev)\n \t\tchanged |= INODE_CHANGED;\n #endif\n \n-- \n1.6.3.rc2.1.g4f9e8.dirty\n"},{"id":"112396","messageId":"200904261306.15448.robin.rosenberg.lists@dewire.com","threadId":"19066","inReplyTo":"1240743317-10117-1-git-send-email-robin.rosenberg@dewire.com","subject":"Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2009-04-26T11:06:15Z","receivedAt":"2009-04-26T11:06:15Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"söndag 26 april 2009 12:55:17 skrev Robin Rosenberg:\n> This reason we may want to ignore these fields is that the Java implementation \n> of Git cannot set these fields properly. To mark this JGit sets these fields\n> to to UINT_MAX (all bits set).\n\nOopps, you won't be able to apply this one, I'll resend a complete patch later. It's probably possible to comment on\nthe goal of the patch anyway.\n\n-- robin\n"},{"id":"112390","messageId":"1240747579-13843-1-git-send-email-robin.rosenberg@dewire.com","threadId":"19066","inReplyTo":"200904261306.15448.robin.rosenberg.lists@dewire.com","subject":"[PATCH 1/2] Silence diffs due to use by non-C code.","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2009-04-26T12:06:19Z","receivedAt":"2009-04-26T12:06:19Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"In particular, some of the stat info, is not available to Java programs.\nJGit sets the uid, gid, dev and ino to all ones to indicate this. Recognose\nthis special value and ignore changes in those values when the on-disk\nvalue has all bits set.\n---\n read-cache.c |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\nThis patch is needed for previous one to apply. This approach to silencing\nindex stats diff when JGit has been used does not require special options and\none could perhaps argue that any other language without portable access to\nthese fields should set the fields just like JGit does.\n\nThe the flag approach is selected, then these patches should be squashed\ntogether.\n\ndiff --git a/read-cache.c b/read-cache.c\nindex 3f58711..45083ab 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -210,10 +210,10 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)\n \t\tchanged |= CTIME_CHANGED;\n #endif\n \n-\tif (ce->ce_uid != (unsigned int) st->st_uid ||\n-\t    ce->ce_gid != (unsigned int) st->st_gid)\n+\tif ((ce->ce_uid != ~0u && ce->ce_uid != (unsigned int) st->st_uid) ||\n+\t    (ce->ce_gid != ~0u && ce->ce_gid != (unsigned int) st->st_gid))\n \t\tchanged |= OWNER_CHANGED;\n-\tif (ce->ce_ino != (unsigned int) st->st_ino)\n+\tif (ce->ce_ino != ~0u && ce->ce_ino != (unsigned int) st->st_ino)\n \t\tchanged |= INODE_CHANGED;\n \n #ifdef USE_STDEV\n@@ -222,7 +222,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)\n \t * clients will have different views of what \"device\"\n \t * the filesystem is on\n \t */\n-\tif (ce->ce_dev != (unsigned int) st->st_dev)\n+\tif (ce->ce_dev != ~0u && ce->ce_dev != (unsigned int) st->st_dev)\n \t\tchanged |= INODE_CHANGED;\n #endif\n \n-- \n1.6.3.rc2.1.g4f9e8.dirty\n"},{"id":"112371","messageId":"7vocujjm5r.fsf@gitster.siamese.dyndns.org","threadId":"19066","inReplyTo":"200904261306.15448.robin.rosenberg.lists@dewire.com","subject":"Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-04-26T18:38:08Z","receivedAt":"2009-04-26T18:38:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Robin Rosenberg <robin.rosenberg.lists@dewire.com> writes:\n\n> söndag 26 april 2009 12:55:17 skrev Robin Rosenberg:\n>> This reason we may want to ignore these fields is that the Java implementation \n>> of Git cannot set these fields properly. To mark this JGit sets these fields\n>> to to UINT_MAX (all bits set).\n>\n> Oopps, you won't be able to apply this one,...\n\nYeah, I noticed your ~0u hack, but it is clear what is going on in the\npatch.\n\nI had a similar patch that disables inum checking in my private tree for\ndifferent reasons of my own; the set of fields your patch ignores is a\ncompatible superset of, and I think makes more sense than, what I was\nplanning to do, so no objections from me on this _optional_ feature.\n\nIt might be easier (with proper re-indentation, which I omitted from this\npatch with \"diff -w\") and more efficient to do this, though...\n\ndiff --git a/read-cache.c b/read-cache.c\nindex 3f58711..03ecd11 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -210,6 +210,8 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)\n \t\tchanged |= CTIME_CHANGED;\n #endif\n \n+\tif (trust_lowlevel_stat) {\n+\n \tif (ce->ce_uid != (unsigned int) st->st_uid ||\n \t    ce->ce_gid != (unsigned int) st->st_gid)\n \t\tchanged |= OWNER_CHANGED;\n@@ -226,6 +228,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)\n \t\tchanged |= INODE_CHANGED;\n #endif\n \n+\t}\n \tif (ce->ce_size != (unsigned int) st->st_size)\n \t\tchanged |= DATA_CHANGED;\n \n"},{"id":"112369","messageId":"alpine.LFD.2.00.0904261159190.7331@localhost.localdomain","threadId":"19066","inReplyTo":"7vocujjm5r.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2009-04-26T19:25:13Z","receivedAt":"2009-04-26T19:25:13Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 26 Apr 2009, Junio C Hamano wrote:\n> \n> I had a similar patch that disables inum checking in my private tree for\n> different reasons of my own; the set of fields your patch ignores is a\n> compatible superset of, and I think makes more sense than, what I was\n> planning to do, so no objections from me on this _optional_ feature.\n\nMaybe we should just remove those checks entirely?\n\nI started out wanting to check the stat information as much as possible, \nbut realistically, nobody probably really cares. We already effectively \nremoved st_dev checking and nsec checks.\n\nAnd ctime checks can be turned off because they were so annoying for the \ncrazy gnome 'beagle' piece-of-sh*t that changes ctime while indexing \nfiles.\n\nSo in the end, maybe we should just agree to only care about mtime and \ninode size. And just remove the rest in the name of least annoyances with \nbroken systems.\n\nIOW, maybe we should just do this, and remove over a hundred lines of dead \ncode or commentary/config. And never have to worry about these kinds of \nissues with different environments again.\n\nI dunno. This is one of my \"throw-away\" patches. Apply it or not, I don't \nreally care. But if you want to apply it, you can have my sign-off:\n\n\tSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>\n\n(I'm leaving the fields in the cache-entry, along with the nsec fields, \nbut I guess they could be removed too, for yet a few more lines removed)\n\n\t\t\tLinus\n\n---\n Documentation/config.txt               |    7 -----\n Documentation/git-update-index.txt     |    5 ---\n Documentation/technical/racy-git.txt   |    8 ------\n Makefile                               |   20 ---------------\n builtin-fetch-pack.c                   |    8 +----\n cache.h                                |    1 -\n config.c                               |    4 ---\n configure.ac                           |   10 -------\n contrib/completion/git-completion.bash |    1 -\n environment.c                          |    1 -\n git-compat-util.h                      |   14 ----------\n read-cache.c                           |   43 +++----------------------------\n 12 files changed, 7 insertions(+), 115 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 35056e1..c256180 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -128,13 +128,6 @@ core.ignoreCygwinFSTricks::\n \tis true, in which case ignoreCygwinFSTricks is ignored as Cygwin's\n \tPOSIX emulation is required to support core.filemode.\n \n-core.trustctime::\n-\tIf false, the ctime differences between the index and the\n-\tworking copy are ignored; useful when the inode change time\n-\tis regularly modified by something outside Git (file system\n-\tcrawlers and some backup systems).\n-\tSee linkgit:git-update-index[1]. True by default.\n-\n core.quotepath::\n \tThe commands that output paths (e.g. 'ls-files',\n \t'diff'), when not given the `-z` option, will quote\ndiff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt\nindex 25e0bbe..b7ab71b 100644\n--- a/Documentation/git-update-index.txt\n+++ b/Documentation/git-update-index.txt\n@@ -323,11 +323,6 @@ from symbolic link to regular file.\n The command looks at `core.ignorestat` configuration variable.  See\n 'Using \"assume unchanged\" bit' section above.\n \n-The command also looks at `core.trustctime` configuration variable.\n-It can be useful when the inode change time is regularly modified by\n-something outside Git (file system crawlers and backup systems use\n-ctime for marking files processed) (see linkgit:git-config[1]).\n-\n \n SEE ALSO\n --------\ndiff --git a/Documentation/technical/racy-git.txt b/Documentation/technical/racy-git.txt\nindex 48bb97f..dff8ee3 100644\n--- a/Documentation/technical/racy-git.txt\n+++ b/Documentation/technical/racy-git.txt\n@@ -37,14 +37,6 @@ is not useful.  Currently, git compares the file type (regular\n files vs symbolic links) and executable bits (only for regular\n files) from `st_mode` member, `st_mtime` and `st_ctime`\n timestamps, `st_uid`, `st_gid`, `st_ino`, and `st_size` members.\n-With a `USE_STDEV` compile-time option, `st_dev` is also\n-compared, but this is not enabled by default because this member\n-is not stable on network filesystems.  With `USE_NSEC`\n-compile-time option, `st_mtim.tv_nsec` and `st_ctim.tv_nsec`\n-members are also compared, but this is not enabled by default\n-because the value of this member becomes meaningless once the\n-inode is evicted from the inode cache on filesystems that do not\n-store it on disk.\n \n \n Racy git\ndiff --git a/Makefile b/Makefile\nindex 49f36f5..9b27fe2 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -120,21 +120,9 @@ all::\n # that tells runtime paths to dynamic libraries;\n # \"-Wl,-rpath=/path/lib\" is used instead.\n #\n-# Define USE_NSEC below if you want git to care about sub-second file mtimes\n-# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and\n-# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely\n-# randomly break unless your underlying filesystem supports those sub-second\n-# times (my ext3 doesn't).\n-#\n # Define USE_ST_TIMESPEC if your \"struct stat\" uses \"st_ctimespec\" instead of\n # \"st_ctim\"\n #\n-# Define NO_NSEC if your \"struct stat\" does not have \"st_ctim.tv_nsec\"\n-# available.  This automatically turns USE_NSEC off.\n-#\n-# Define USE_STDEV below if you want git to care about the underlying device\n-# change being considered an inode change from the update-index perspective.\n-#\n # Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks\n # field that counts the on-disk footprint in 512-byte blocks.\n #\n@@ -766,7 +754,6 @@ ifeq ($(uname_S),AIX)\n \tNO_MEMMEM = YesPlease\n \tNO_MKDTEMP = YesPlease\n \tNO_STRLCPY = YesPlease\n-\tNO_NSEC = YesPlease\n \tFREAD_READS_DIRECTORIES = UnfortunatelyYes\n \tINTERNAL_QSORT = UnfortunatelyYes\n \tNEEDS_LIBICONV=YesPlease\n@@ -832,7 +819,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tRUNTIME_PREFIX = YesPlease\n \tNO_POSIX_ONLY_PROGRAMS = YesPlease\n \tNO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease\n-\tNO_NSEC = YesPlease\n \tUSE_WIN32_MMAP = YesPlease\n \tUNRELIABLE_FSTAT = UnfortunatelyYes\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch\n@@ -956,15 +942,9 @@ endif\n ifdef NO_ST_BLOCKS_IN_STRUCT_STAT\n \tBASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT\n endif\n-ifdef USE_NSEC\n-\tBASIC_CFLAGS += -DUSE_NSEC\n-endif\n ifdef USE_ST_TIMESPEC\n \tBASIC_CFLAGS += -DUSE_ST_TIMESPEC\n endif\n-ifdef NO_NSEC\n-\tBASIC_CFLAGS += -DNO_NSEC\n-endif\n ifdef NO_C99_FORMAT\n \tBASIC_CFLAGS += -DNO_C99_FORMAT\n endif\ndiff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c\nindex 5d134be..c980a48 100644\n--- a/builtin-fetch-pack.c\n+++ b/builtin-fetch-pack.c\n@@ -800,15 +800,11 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,\n \t\tint fd;\n \n \t\tmtime.sec = st.st_mtime;\n-\t\tmtime.nsec = ST_MTIME_NSEC(st);\n+\t\tmtime.nsec = 0;\n \t\tif (stat(shallow, &st)) {\n \t\t\tif (mtime.sec)\n \t\t\t\tdie(\"shallow file was removed during fetch\");\n-\t\t} else if (st.st_mtime != mtime.sec\n-#ifdef USE_NSEC\n-\t\t\t\t|| ST_MTIME_NSEC(st) != mtime.nsec\n-#endif\n-\t\t\t  )\n+\t\t} else if (st.st_mtime != mtime.sec)\n \t\t\tdie(\"shallow file was changed during fetch\");\n \n \t\tfd = hold_lock_file_for_update(&lock, shallow,\ndiff --git a/cache.h b/cache.h\nindex ab1294d..ca0510f 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -499,7 +499,6 @@ extern int delete_ref(const char *, const unsigned char *sha1, int delopt);\n \n /* Environment bits from configuration mechanism */\n extern int trust_executable_bit;\n-extern int trust_ctime;\n extern int quote_path_fully;\n extern int has_symlinks;\n extern int ignore_case;\ndiff --git a/config.c b/config.c\nindex 8c1ae59..d3619ab 100644\n--- a/config.c\n+++ b/config.c\n@@ -360,10 +360,6 @@ static int git_default_core_config(const char *var, const char *value)\n \t\ttrust_executable_bit = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n-\tif (!strcmp(var, \"core.trustctime\")) {\n-\t\ttrust_ctime = git_config_bool(var, value);\n-\t\treturn 0;\n-\t}\n \n \tif (!strcmp(var, \"core.quotepath\")) {\n \t\tquote_path_fully = git_config_bool(var, value);\ndiff --git a/configure.ac b/configure.ac\nindex 4e728bc..9d49ad1 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -225,16 +225,6 @@ GIT_PARSE_WITH(iconv))\n \n ## --enable-FEATURE[=ARG] and --disable-FEATURE\n #\n-# Define USE_NSEC below if you want git to care about sub-second file mtimes\n-# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and\n-# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely\n-# randomly break unless your underlying filesystem supports those sub-second\n-# times (my ext3 doesn't).\n-#\n-# Define USE_STDEV below if you want git to care about the underlying device\n-# change being considered an inode change from the update-index perspective.\n-\n-#\n # Define SHELL_PATH to provide path to shell.\n GIT_ARG_SET_PATH(shell)\n #\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 1a90cb8..1d0402c 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1447,7 +1447,6 @@ _git_config ()\n \t\tcore.safecrlf\n \t\tcore.sharedRepository\n \t\tcore.symlinks\n-\t\tcore.trustctime\n \t\tcore.warnAmbiguousRefs\n \t\tcore.whitespace\n \t\tcore.worktree\ndiff --git a/environment.c b/environment.c\nindex 4696885..a2497b9 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -13,7 +13,6 @@ char git_default_email[MAX_GITNAME];\n char git_default_name[MAX_GITNAME];\n int user_ident_explicitly_given;\n int trust_executable_bit = 1;\n-int trust_ctime = 1;\n int has_symlinks = 1;\n int ignore_case;\n int assume_unchanged;\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 785aa31..6678e4d 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -394,20 +394,6 @@ void git_qsort(void *base, size_t nmemb, size_t size,\n # define FORCE_DIR_SET_GID 0\n #endif\n \n-#ifdef NO_NSEC\n-#undef USE_NSEC\n-#define ST_CTIME_NSEC(st) 0\n-#define ST_MTIME_NSEC(st) 0\n-#else\n-#ifdef USE_ST_TIMESPEC\n-#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctimespec.tv_nsec))\n-#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtimespec.tv_nsec))\n-#else\n-#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctim.tv_nsec))\n-#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtim.tv_nsec))\n-#endif\n-#endif\n-\n #ifdef UNRELIABLE_FSTAT\n #define fstat_is_reliable() 0\n #else\ndiff --git a/read-cache.c b/read-cache.c\nindex 3f58711..9a452b0 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -69,8 +69,8 @@ void fill_stat_cache_info(struct cache_entry *ce, struct stat *st)\n {\n \tce->ce_ctime.sec = (unsigned int)st->st_ctime;\n \tce->ce_mtime.sec = (unsigned int)st->st_mtime;\n-\tce->ce_ctime.nsec = ST_CTIME_NSEC(*st);\n-\tce->ce_mtime.nsec = ST_MTIME_NSEC(*st);\n+\tce->ce_ctime.nsec = 0;\n+\tce->ce_mtime.nsec = 0;\n \tce->ce_dev = st->st_dev;\n \tce->ce_ino = st->st_ino;\n \tce->ce_uid = st->st_uid;\n@@ -200,31 +200,6 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)\n \t}\n \tif (ce->ce_mtime.sec != (unsigned int)st->st_mtime)\n \t\tchanged |= MTIME_CHANGED;\n-\tif (trust_ctime && ce->ce_ctime.sec != (unsigned int)st->st_ctime)\n-\t\tchanged |= CTIME_CHANGED;\n-\n-#ifdef USE_NSEC\n-\tif (ce->ce_mtime.nsec != ST_MTIME_NSEC(*st))\n-\t\tchanged |= MTIME_CHANGED;\n-\tif (trust_ctime && ce->ce_ctime.nsec != ST_CTIME_NSEC(*st))\n-\t\tchanged |= CTIME_CHANGED;\n-#endif\n-\n-\tif (ce->ce_uid != (unsigned int) st->st_uid ||\n-\t    ce->ce_gid != (unsigned int) st->st_gid)\n-\t\tchanged |= OWNER_CHANGED;\n-\tif (ce->ce_ino != (unsigned int) st->st_ino)\n-\t\tchanged |= INODE_CHANGED;\n-\n-#ifdef USE_STDEV\n-\t/*\n-\t * st_dev breaks on network filesystems where different\n-\t * clients will have different views of what \"device\"\n-\t * the filesystem is on\n-\t */\n-\tif (ce->ce_dev != (unsigned int) st->st_dev)\n-\t\tchanged |= INODE_CHANGED;\n-#endif\n \n \tif (ce->ce_size != (unsigned int) st->st_size)\n \t\tchanged |= DATA_CHANGED;\n@@ -242,15 +217,7 @@ static int is_racy_timestamp(const struct index_state *istate, struct cache_entr\n {\n \treturn (!S_ISGITLINK(ce->ce_mode) &&\n \t\tistate->timestamp.sec &&\n-#ifdef USE_NSEC\n-\t\t /* nanosecond timestamped files can also be racy! */\n-\t\t(istate->timestamp.sec < ce->ce_mtime.sec ||\n-\t\t (istate->timestamp.sec == ce->ce_mtime.sec &&\n-\t\t  istate->timestamp.nsec <= ce->ce_mtime.nsec))\n-#else\n-\t\tistate->timestamp.sec <= ce->ce_mtime.sec\n-#endif\n-\t\t );\n+\t\tistate->timestamp.sec <= ce->ce_mtime.sec);\n }\n \n int ie_match_stat(const struct index_state *istate,\n@@ -1299,7 +1266,7 @@ int read_index_from(struct index_state *istate, const char *path)\n \t\tdst_offset += ce_size(ce);\n \t}\n \tistate->timestamp.sec = st.st_mtime;\n-\tistate->timestamp.nsec = ST_MTIME_NSEC(st);\n+\tistate->timestamp.nsec = 0;\n \n \twhile (src_offset <= mmap_size - 20 - 8) {\n \t\t/* After an array of active_nr index entries,\n@@ -1564,7 +1531,7 @@ int write_index(struct index_state *istate, int newfd)\n \tif (ce_flush(&c, newfd) || fstat(newfd, &st))\n \t\treturn -1;\n \tistate->timestamp.sec = (unsigned int)st.st_mtime;\n-\tistate->timestamp.nsec = ST_MTIME_NSEC(st);\n+\tistate->timestamp.nsec = 0;\n \treturn 0;\n }\n \n"},{"id":"112360","messageId":"200904270002.42489.robin.rosenberg.lists@dewire.com","threadId":"19066","inReplyTo":"alpine.LFD.2.00.0904261159190.7331@localhost.localdomain","subject":"Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2009-04-26T22:02:42Z","receivedAt":"2009-04-26T22:02:42Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"söndag 26 april 2009 21:25:13 skrev Linus Torvalds <torvalds@linux-foundation.org>:\n> \n> On Sun, 26 Apr 2009, Junio C Hamano wrote:\n> > \n> > I had a similar patch that disables inum checking in my private tree for\n> > different reasons of my own; the set of fields your patch ignores is a\n> > compatible superset of, and I think makes more sense than, what I was\n> > planning to do, so no objections from me on this _optional_ feature.\n> \n> Maybe we should just remove those checks entirely?\n\nBlessed-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n\n-- robin\n"},{"id":"112345","messageId":"7vab628u23.fsf@gitster.siamese.dyndns.org","threadId":"19066","inReplyTo":"alpine.LFD.2.00.0904261159190.7331@localhost.localdomain","subject":"Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-04-27T06:55:16Z","receivedAt":"2009-04-27T06:55:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> I started out wanting to check the stat information as much as possible, \n> but realistically, nobody probably really cares. We already effectively \n> removed st_dev checking and nsec checks.\n\nWas ignoring st_dev checking primarily for a work tree over NFS?  I think\nignoring it makes sense.  If st_dev changes, it is likely that somebody\ndid a \"mv\" of a whole repository to some other filesystem, or the\nfilesystem is not giving stable st_dev to us for the whole tree---it is\nnot like we want to detect a change to a single path that changes its\nst_dev and nothing else, as no such change is likely to be useful.\n\n> IOW, maybe we should just do this, and remove over a hundred lines of dead \n> code or commentary/config. And never have to worry about these kinds of \n> issues with different environments again.\n\nI like the end result.\n\nBut I am not sure about dropping the nanosecond resolution timestamps.\nThe area was extended recently in preparation for ext4; we can take\nadvantage of it to reduce the chance the racy-git avoidance codepath\ntriggers if we keep it.\n\n    fba2f38 (make USE_NSEC work as expected, 2009-02-19)\n\n    c06ff49 (Record ns-timestamps if possible, but do not use it without\n    USE_NSEC, 2009-03-04)\n"},{"id":"112421","messageId":"alpine.LFD.2.00.0904270757410.22156@localhost.localdomain","threadId":"19066","inReplyTo":"7vab628u23.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2009-04-27T15:00:38Z","receivedAt":"2009-04-27T15:00:38Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 26 Apr 2009, Junio C Hamano wrote:\n> \n> Was ignoring st_dev checking primarily for a work tree over NFS?\n\nYes, but I think there were other issues too (like git repositories on \nremovable media).\n\nThe inode number really has similar concerns - different operating systems \nwill use different inode numbers for both NFS and for things like FAT. \nIt's not nearly as noticeable, because people don't tend to switch OS's as \nmuch as they might switch between two machines.\n\n> I like the end result.\n> \n> But I am not sure about dropping the nanosecond resolution timestamps.\n> The area was extended recently in preparation for ext4; we can take\n> advantage of it to reduce the chance the racy-git avoidance codepath\n> triggers if we keep it.\n> \n>     fba2f38 (make USE_NSEC work as expected, 2009-02-19)\n> \n>     c06ff49 (Record ns-timestamps if possible, but do not use it without\n>     USE_NSEC, 2009-03-04)\n\nHey, we can leave the NSEC support in. Admittedly removing that was about \nhalf the patch, but even with it left in, it would be a cleanup.\n\n\t\tLinus\n"},{"id":"112428","messageId":"86skjudr6u.fsf@broadpark.no","threadId":"19066","inReplyTo":"alpine.LFD.2.00.0904270757410.22156@localhost.localdomain","subject":"Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid","fromName":"Kjetil Barvik","fromEmail":"barvik@broadpark.no","sentAt":"2009-04-27T15:58:17Z","receivedAt":"2009-04-27T15:58:17Z","isPatch":true,"sender":{"key":"barvik@broadpark.no","avatar":null},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> On Sun, 26 Apr 2009, Junio C Hamano wrote:\n>> I like the end result.\n>> \n>> But I am not sure about dropping the nanosecond resolution timestamps.\n>> The area was extended recently in preparation for ext4; we can take\n>> advantage of it to reduce the chance the racy-git avoidance codepath\n>> triggers if we keep it.\n>> \n>>     fba2f38 (make USE_NSEC work as expected, 2009-02-19)\n>> \n>>     c06ff49 (Record ns-timestamps if possible, but do not use it without\n>>     USE_NSEC, 2009-03-04)\n>\n> Hey, we can leave the NSEC support in. Admittedly removing that was about \n> half the patch, but even with it left in, it would be a cleanup.\n\n  I think we should have the NSEC support, as it is a performance\n  impromvent, at least on my laptop.  OK, not a huge improvment, but\n  still.\n\n  For git version 1.6.3.rc3 I made a litle test, and the difference was\n  the following for the 'git checkout my-v2.6.25' (from my-v2.6.27):\n\n                 for git compiled with    for git compiled without\n                 'make USE_NSEC=1 ...':   the 'USE_NSEC=1' part:\n\n   OK open calls:       13872                   14386\n   OK close calls:      13872                   14386\n   OK mmap2 calls:        102                     649\n   OK munmap calls:        61                     608\n\n  so, an improvment of 514 open() and close() calls, and 547 mmap2() and\n  munmap() calls, for this particular test on my particular slow laptop\n  disk.\n\n  As I wrote in fba2f38 I would guess that the improvment is larger for\n  a faster disk, and a SSD disk should be able to see a larger\n  improvment that I did above.\n\n  -- kjetil\n"},{"id":"136778","messageId":"201003142151.29969.robin.rosenberg@dewire.com","threadId":"19066","inReplyTo":"86skjudr6u.fsf@broadpark.no","subject":"Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2010-03-14T20:51:29Z","receivedAt":"2010-03-14T20:51:29Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"måndagen den 27 april 2009 17.58.17 skrev  Kjetil Barvik:\n> Linus Torvalds <torvalds@linux-foundation.org> writes:\n> > On Sun, 26 Apr 2009, Junio C Hamano wrote:\n> >> I like the end result.\n> >>\n> >> But I am not sure about dropping the nanosecond resolution timestamps.\n> >> The area was extended recently in preparation for ext4; we can take\n> >> advantage of it to reduce the chance the racy-git avoidance codepath\n> >> triggers if we keep it.\n> >>\n> >>     fba2f38 (make USE_NSEC work as expected, 2009-02-19)\n> >>\n> >>     c06ff49 (Record ns-timestamps if possible, but do not use it without\n> >>     USE_NSEC, 2009-03-04)\n> >\n> > Hey, we can leave the NSEC support in. Admittedly removing that was about\n> > half the patch, but even with it left in, it would be a cleanup.\n> \n>   I think we should have the NSEC support, as it is a performance\n>   impromvent, at least on my laptop.  OK, not a huge improvment, but\n>   still.\n> \n>   For git version 1.6.3.rc3 I made a litle test, and the difference was\n>   the following for the 'git checkout my-v2.6.25' (from my-v2.6.27):\n> \n>                  for git compiled with    for git compiled without\n>                  'make USE_NSEC=1 ...':   the 'USE_NSEC=1' part:\n> \n>    OK open calls:       13872                   14386\n>    OK close calls:      13872                   14386\n>    OK mmap2 calls:        102                     649\n>    OK munmap calls:        61                     608\n> \n>   so, an improvment of 514 open() and close() calls, and 547 mmap2() and\n>   munmap() calls, for this particular test on my particular slow laptop\n>   disk.\n> \n>   As I wrote in fba2f38 I would guess that the improvment is larger for\n>   a faster disk, and a SSD disk should be able to see a larger\n>   improvment that I did above.\n> \n>   -- kjetil\n\nDid something pop up that I don't know of that prevented inclusion of this \npatch, other than the NSEC option, or will it do if just refresh the patch?\n\n-- robin\n"},{"id":"136796","messageId":"7v1vfm9iyp.fsf@alter.siamese.dyndns.org","threadId":"19066","inReplyTo":"201003142151.29969.robin.rosenberg@dewire.com","subject":"Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-15T06:50:38Z","receivedAt":"2010-03-15T06:50:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Robin Rosenberg <robin.rosenberg@dewire.com> writes:\n\n> Did something pop up that I don't know of that prevented inclusion of this \n> patch, other than the NSEC option, or will it do if just refresh the patch?\n\nI think all of us liked the general direction, and also all of us agreed\nthat we would want to keep NSEC support that was removed by Linus's patch.\n\nNobody had time or inclination to update the patch to implement the\nconsensus (I still had the thread in my inbox, by the way).  So \"just\nrefresh the patch\" would be the necessary first step.\n"},{"id":"136797","messageId":"81b0412b1003150041n5938556bqc127939622bfdb57@mail.gmail.com","threadId":"19066","inReplyTo":"7v1vfm9iyp.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2010-03-15T07:41:04Z","receivedAt":"2010-03-15T07:41:04Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On Mon, Mar 15, 2010 at 07:50, Junio C Hamano <gitster@pobox.com> wrote:\n> Robin Rosenberg <robin.rosenberg@dewire.com> writes:\n>\n>> Did something pop up that I don't know of that prevented inclusion of this\n>> patch, other than the NSEC option, or will it do if just refresh the patch?\n>\n> I think all of us liked the general direction, and also all of us agreed\n> that we would want to keep NSEC support that was removed by Linus's patch.\n>\n> Nobody had time or inclination to update the patch to implement the\n> consensus (I still had the thread in my inbox, by the way).  So \"just\n> refresh the patch\" would be the necessary first step.\n\nThere is an awful lot of \"trust-something\" variables. Maybe they can be\nconsolidated into a bitmask/bitfields? And a config option taking a list of\nfilesystem features which can be trusted for a good measure (preserving\nold \"trust_something\" options, of course).\n"}]}