]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Make use of stat.ctime configurable
authorAlex Riesen <raa.lkml@gmail.com>
Mon, 28 Jul 2008 06:31:28 +0000 (08:31 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 29 Jul 2008 06:26:25 +0000 (23:26 -0700)
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>
Documentation/config.txt
Documentation/git-update-index.txt
cache.h
config.c
environment.c
read-cache.c

index 1a13abc92223090c563a19074a29b703758d5286..61c376057c0f2b9510bf6f1b2beb42f9859b7f46 100644 (file)
@@ -117,6 +117,13 @@ core.fileMode::
        the working copy are ignored; useful on broken filesystems like FAT.
        See linkgit:git-update-index[1]. True by default.
 
+core.trustctime::
+       If false, the ctime differences between the index and the
+       working copy are ignored; useful when the inode change time
+       is regularly modified by something outside Git (file system
+       crawlers and some backup systems).
+       See linkgit:git-update-index[1]. True by default.
+
 core.quotepath::
        The commands that output paths (e.g. 'ls-files',
        'diff'), when not given the `-z` option, will quote
index 6b930bc16303e6a17554a551badfe01febaf3ca1..1d9d81a702d26706047ae6ea29b4ca62ebe59460 100644 (file)
@@ -323,6 +323,11 @@ from symbolic link to regular file.
 The command looks at `core.ignorestat` configuration variable.  See
 'Using "assume unchanged" bit' section above.
 
+The command also looks at `core.trustctime` configuration variable.
+It can be useful when the inode change time is regularly modified by
+something outside Git (file system crawlers and backup systems use
+ctime for marking files processed) (see linkgit:git-config[1]).
+
 
 SEE ALSO
 --------
diff --git a/cache.h b/cache.h
index 4b6c0a6c59dc364e4341b580acfe96d6f691eded..2475de9fa837596303284157e08b3080d64351ee 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -423,6 +423,7 @@ extern int delete_ref(const char *, const unsigned char *sha1);
 
 /* Environment bits from configuration mechanism */
 extern int trust_executable_bit;
+extern int trust_ctime;
 extern int quote_path_fully;
 extern int has_symlinks;
 extern int ignore_case;
index 1e066c71e0fbc4b172ef548663e660e636d6a916..53f04a076a7275965090edd4ca2a34652c4f5679 100644 (file)
--- a/config.c
+++ b/config.c
@@ -341,6 +341,10 @@ static int git_default_core_config(const char *var, const char *value)
                trust_executable_bit = git_config_bool(var, value);
                return 0;
        }
+       if (!strcmp(var, "core.trustctime")) {
+               trust_ctime = git_config_bool(var, value);
+               return 0;
+       }
 
        if (!strcmp(var, "core.quotepath")) {
                quote_path_fully = git_config_bool(var, value);
index 4a88a17d54df19af51a4fe0596815badf32fce1f..0c6d11f6a0c6fa5dbab2f36c4b4ad4de5aba4ac9 100644 (file)
@@ -13,6 +13,7 @@ char git_default_email[MAX_GITNAME];
 char git_default_name[MAX_GITNAME];
 int user_ident_explicitly_given;
 int trust_executable_bit = 1;
+int trust_ctime = 1;
 int has_symlinks = 1;
 int ignore_case;
 int assume_unchanged;
index 6c0880337bf6975bcbb3022baa4c7cfd66277d69..1cae361c6c3066e0aedba7872ebda3766aa94a52 100644 (file)
@@ -197,7 +197,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
        }
        if (ce->ce_mtime != (unsigned int) st->st_mtime)
                changed |= MTIME_CHANGED;
-       if (ce->ce_ctime != (unsigned int) st->st_ctime)
+       if (trust_ctime && ce->ce_ctime != (unsigned int) st->st_ctime)
                changed |= CTIME_CHANGED;
 
        if (ce->ce_uid != (unsigned int) st->st_uid ||