Make use of stat.ctime configurable
A new configuration variable 'core.trustctime' is introduced to allow ignoring st_ctime information when checking if paths in the working tree has changed, because there are situations where it produces too much false positives. Like when file system crawlers keep changing it when scanning and using the ctime for marking scanned files. The default is to notice ctime changes. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alex Riesen committed
Jul 28, 2008 at 08:31 UTC
1ce4790bf5eeceb212f003fffcb36069c0ebb45e
6 files changed
+19
-1
Documentation/config.txt
+7
@@ -117,6 +117,13 @@ core.fileMode::
117
the working copy are ignored; useful on broken filesystems like FAT.
118
See linkgit:git-update-index[1]. True by default.
119
120
+core.trustctime::
121
+ If false, the ctime differences between the index and the
122
+ working copy are ignored; useful when the inode change time
123
+ is regularly modified by something outside Git (file system
124
+ crawlers and some backup systems).
125
+ See linkgit:git-update-index[1]. True by default.
126
+
127
core.quotepath::
128
The commands that output paths (e.g. 'ls-files',
129
'diff'), when not given the `-z` option, will quote
Documentation/git-update-index.txt
+5
@@ -323,6 +323,11 @@ from symbolic link to regular file.
323
The command looks at `core.ignorestat` configuration variable. See
324
'Using "assume unchanged" bit' section above.
325
326
+The command also looks at `core.trustctime` configuration variable.
327
+It can be useful when the inode change time is regularly modified by
328
+something outside Git (file system crawlers and backup systems use
329
+ctime for marking files processed) (see linkgit:git-config[1]).
330
+
331
332
SEE ALSO
333
--------
cache.h
+1
@@ -423,6 +423,7 @@ extern int delete_ref(const char *, const unsigned char *sha1);
423
424
/* Environment bits from configuration mechanism */
425
extern int trust_executable_bit;
426
+extern int trust_ctime;
427
extern int quote_path_fully;
428
extern int has_symlinks;
429
extern int ignore_case;
config.c
+4
@@ -341,6 +341,10 @@ static int git_default_core_config(const char *var, const char *value)
341
trust_executable_bit = git_config_bool(var, value);
342
return 0;
343
}
344
+ if (!strcmp(var, "core.trustctime")) {
345
+ trust_ctime = git_config_bool(var, value);
346
+ return 0;
347
+ }
348
349
if (!strcmp(var, "core.quotepath")) {
350
quote_path_fully = git_config_bool(var, value);
environment.c
+1
@@ -13,6 +13,7 @@ char git_default_email[MAX_GITNAME];
13
char git_default_name[MAX_GITNAME];
14
int user_ident_explicitly_given;
15
int trust_executable_bit = 1;
16
+int trust_ctime = 1;
17
int has_symlinks = 1;
18
int ignore_case;
19
int assume_unchanged;
read-cache.c
+1
-1
@@ -197,7 +197,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
197
}
198
if (ce->ce_mtime != (unsigned int) st->st_mtime)
199
changed |= MTIME_CHANGED;
200
- if (ce->ce_ctime != (unsigned int) st->st_ctime)
200
+ if (trust_ctime && ce->ce_ctime != (unsigned int) st->st_ctime)
201
changed |= CTIME_CHANGED;
202
203
if (ce->ce_uid != (unsigned int) st->st_uid ||