All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid
@ 2009-04-26 10:55 Robin Rosenberg
  2009-04-26 11:06 ` Robin Rosenberg
  0 siblings, 1 reply; 12+ messages in thread
From: Robin Rosenberg @ 2009-04-26 10:55 UTC (permalink / raw)
  To: junkio; +Cc: git, spearce, Robin Rosenberg

This reason we may want to ignore these fields is that the Java implementation 
of Git cannot set these fields properly. To mark this JGit sets these fields
to to UINT_MAX (all bits set).

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 Documentation/config.txt |    7 +++++++
 cache.h                  |    1 +
 config.c                 |    4 ++++
 environment.c            |    1 +
 read-cache.c             |    8 ++++----
 5 files changed, 17 insertions(+), 4 deletions(-)

In addition to this you may want to set core.trustctime to false

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 3188569..bdf05ba 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -135,6 +135,13 @@ core.trustctime::
 	crawlers and some backup systems).
 	See linkgit:git-update-index[1]. True by default.
 
+core.trustlowlevelstat::
+    If false, differences in the index in the dev, ino, uid and gid
+    fields are ignored. Useful when using git implementations that
+    cannot set these fields correctly, such as Java programs like JGit
+    used by the EGit plugin for Eclipse.
+	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
diff --git a/cache.h b/cache.h
index ab1294d..194021c 100644
--- a/cache.h
+++ b/cache.h
@@ -500,6 +500,7 @@ extern int delete_ref(const char *, const unsigned char *sha1, int delopt);
 /* Environment bits from configuration mechanism */
 extern int trust_executable_bit;
 extern int trust_ctime;
+extern int trust_lowlevelstat;
 extern int quote_path_fully;
 extern int has_symlinks;
 extern int ignore_case;
diff --git a/config.c b/config.c
index 8c1ae59..d8679e7 100644
--- a/config.c
+++ b/config.c
@@ -364,6 +364,10 @@ static int git_default_core_config(const char *var, const char *value)
 		trust_ctime = git_config_bool(var, value);
 		return 0;
 	}
+	if (!strcmp(var, "core.trustlowlevelstat")) {
+		trust_lowlevelstat = git_config_bool(var, value);
+		return 0;
+	}
 
 	if (!strcmp(var, "core.quotepath")) {
 		quote_path_fully = git_config_bool(var, value);
diff --git a/environment.c b/environment.c
index 4696885..194a289 100644
--- a/environment.c
+++ b/environment.c
@@ -14,6 +14,7 @@ char git_default_name[MAX_GITNAME];
 int user_ident_explicitly_given;
 int trust_executable_bit = 1;
 int trust_ctime = 1;
+int trust_lowlevelstat = 1;
 int has_symlinks = 1;
 int ignore_case;
 int assume_unchanged;
diff --git a/read-cache.c b/read-cache.c
index 45083ab..f8f497f 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -210,10 +210,10 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
 		changed |= CTIME_CHANGED;
 #endif
 
-	if ((ce->ce_uid != ~0u && ce->ce_uid != (unsigned int) st->st_uid) ||
-	    (ce->ce_gid != ~0u && ce->ce_gid != (unsigned int) st->st_gid))
+	if ((trust_lowlevelstat && ce->ce_uid != (unsigned int) st->st_uid) ||
+	    (trust_lowlevelstat && ce->ce_gid != (unsigned int) st->st_gid))
 		changed |= OWNER_CHANGED;
-	if (ce->ce_ino != ~0u && ce->ce_ino != (unsigned int) st->st_ino)
+	if (trust_lowlevelstat && ce->ce_ino != (unsigned int) st->st_ino)
 		changed |= INODE_CHANGED;
 
 #ifdef USE_STDEV
@@ -222,7 +222,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
 	 * clients will have different views of what "device"
 	 * the filesystem is on
 	 */
-	if (ce->ce_dev != ~0u && ce->ce_dev != (unsigned int) st->st_dev)
+	if (trust_lowlevelstat && ce->ce_dev != (unsigned int) st->st_dev)
 		changed |= INODE_CHANGED;
 #endif
 
-- 
1.6.3.rc2.1.g4f9e8.dirty

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid
  2009-04-26 10:55 [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid Robin Rosenberg
@ 2009-04-26 11:06 ` Robin Rosenberg
  2009-04-26 12:06   ` [PATCH 1/2] Silence diffs due to use by non-C code Robin Rosenberg
  2009-04-26 18:38   ` [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid Junio C Hamano
  0 siblings, 2 replies; 12+ messages in thread
From: Robin Rosenberg @ 2009-04-26 11:06 UTC (permalink / raw)
  To: junkio; +Cc: git, spearce

söndag 26 april 2009 12:55:17 skrev Robin Rosenberg:
> This reason we may want to ignore these fields is that the Java implementation 
> of Git cannot set these fields properly. To mark this JGit sets these fields
> to to UINT_MAX (all bits set).

Oopps, you won't be able to apply this one, I'll resend a complete patch later. It's probably possible to comment on
the goal of the patch anyway.

-- robin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/2] Silence diffs due to use by non-C code.
  2009-04-26 11:06 ` Robin Rosenberg
@ 2009-04-26 12:06   ` Robin Rosenberg
  2009-04-26 18:38   ` [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid Junio C Hamano
  1 sibling, 0 replies; 12+ messages in thread
From: Robin Rosenberg @ 2009-04-26 12:06 UTC (permalink / raw)
  To: junkio; +Cc: git, spearce, Robin Rosenberg

In particular, some of the stat info, is not available to Java programs.
JGit sets the uid, gid, dev and ino to all ones to indicate this. Recognose
this special value and ignore changes in those values when the on-disk
value has all bits set.
---
 read-cache.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

This patch is needed for previous one to apply. This approach to silencing
index stats diff when JGit has been used does not require special options and
one could perhaps argue that any other language without portable access to
these fields should set the fields just like JGit does.

The the flag approach is selected, then these patches should be squashed
together.

diff --git a/read-cache.c b/read-cache.c
index 3f58711..45083ab 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -210,10 +210,10 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
 		changed |= CTIME_CHANGED;
 #endif
 
-	if (ce->ce_uid != (unsigned int) st->st_uid ||
-	    ce->ce_gid != (unsigned int) st->st_gid)
+	if ((ce->ce_uid != ~0u && ce->ce_uid != (unsigned int) st->st_uid) ||
+	    (ce->ce_gid != ~0u && ce->ce_gid != (unsigned int) st->st_gid))
 		changed |= OWNER_CHANGED;
-	if (ce->ce_ino != (unsigned int) st->st_ino)
+	if (ce->ce_ino != ~0u && ce->ce_ino != (unsigned int) st->st_ino)
 		changed |= INODE_CHANGED;
 
 #ifdef USE_STDEV
@@ -222,7 +222,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
 	 * clients will have different views of what "device"
 	 * the filesystem is on
 	 */
-	if (ce->ce_dev != (unsigned int) st->st_dev)
+	if (ce->ce_dev != ~0u && ce->ce_dev != (unsigned int) st->st_dev)
 		changed |= INODE_CHANGED;
 #endif
 
-- 
1.6.3.rc2.1.g4f9e8.dirty

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid
  2009-04-26 11:06 ` Robin Rosenberg
  2009-04-26 12:06   ` [PATCH 1/2] Silence diffs due to use by non-C code Robin Rosenberg
@ 2009-04-26 18:38   ` Junio C Hamano
  2009-04-26 19:25     ` Linus Torvalds
  1 sibling, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2009-04-26 18:38 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git, spearce

Robin Rosenberg <robin.rosenberg.lists@dewire.com> writes:

> söndag 26 april 2009 12:55:17 skrev Robin Rosenberg:
>> This reason we may want to ignore these fields is that the Java implementation 
>> of Git cannot set these fields properly. To mark this JGit sets these fields
>> to to UINT_MAX (all bits set).
>
> Oopps, you won't be able to apply this one,...

Yeah, I noticed your ~0u hack, but it is clear what is going on in the
patch.

I had a similar patch that disables inum checking in my private tree for
different reasons of my own; the set of fields your patch ignores is a
compatible superset of, and I think makes more sense than, what I was
planning to do, so no objections from me on this _optional_ feature.

It might be easier (with proper re-indentation, which I omitted from this
patch with "diff -w") and more efficient to do this, though...

diff --git a/read-cache.c b/read-cache.c
index 3f58711..03ecd11 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -210,6 +210,8 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
 		changed |= CTIME_CHANGED;
 #endif
 
+	if (trust_lowlevel_stat) {
+
 	if (ce->ce_uid != (unsigned int) st->st_uid ||
 	    ce->ce_gid != (unsigned int) st->st_gid)
 		changed |= OWNER_CHANGED;
@@ -226,6 +228,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
 		changed |= INODE_CHANGED;
 #endif
 
+	}
 	if (ce->ce_size != (unsigned int) st->st_size)
 		changed |= DATA_CHANGED;
 

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid
  2009-04-26 18:38   ` [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid Junio C Hamano
@ 2009-04-26 19:25     ` Linus Torvalds
  2009-04-26 22:02       ` Robin Rosenberg
  2009-04-27  6:55       ` Junio C Hamano
  0 siblings, 2 replies; 12+ messages in thread
From: Linus Torvalds @ 2009-04-26 19:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Robin Rosenberg, Git Mailing List, spearce



On Sun, 26 Apr 2009, Junio C Hamano wrote:
> 
> I had a similar patch that disables inum checking in my private tree for
> different reasons of my own; the set of fields your patch ignores is a
> compatible superset of, and I think makes more sense than, what I was
> planning to do, so no objections from me on this _optional_ feature.

Maybe we should just remove those checks entirely?

I started out wanting to check the stat information as much as possible, 
but realistically, nobody probably really cares. We already effectively 
removed st_dev checking and nsec checks.

And ctime checks can be turned off because they were so annoying for the 
crazy gnome 'beagle' piece-of-sh*t that changes ctime while indexing 
files.

So in the end, maybe we should just agree to only care about mtime and 
inode size. And just remove the rest in the name of least annoyances with 
broken systems.

IOW, maybe we should just do this, and remove over a hundred lines of dead 
code or commentary/config. And never have to worry about these kinds of 
issues with different environments again.

I dunno. This is one of my "throw-away" patches. Apply it or not, I don't 
really care. But if you want to apply it, you can have my sign-off:

	Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

(I'm leaving the fields in the cache-entry, along with the nsec fields, 
but I guess they could be removed too, for yet a few more lines removed)

			Linus

---
 Documentation/config.txt               |    7 -----
 Documentation/git-update-index.txt     |    5 ---
 Documentation/technical/racy-git.txt   |    8 ------
 Makefile                               |   20 ---------------
 builtin-fetch-pack.c                   |    8 +----
 cache.h                                |    1 -
 config.c                               |    4 ---
 configure.ac                           |   10 -------
 contrib/completion/git-completion.bash |    1 -
 environment.c                          |    1 -
 git-compat-util.h                      |   14 ----------
 read-cache.c                           |   43 +++----------------------------
 12 files changed, 7 insertions(+), 115 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 35056e1..c256180 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -128,13 +128,6 @@ core.ignoreCygwinFSTricks::
 	is true, in which case ignoreCygwinFSTricks is ignored as Cygwin's
 	POSIX emulation is required to support core.filemode.
 
-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
diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt
index 25e0bbe..b7ab71b 100644
--- a/Documentation/git-update-index.txt
+++ b/Documentation/git-update-index.txt
@@ -323,11 +323,6 @@ 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/Documentation/technical/racy-git.txt b/Documentation/technical/racy-git.txt
index 48bb97f..dff8ee3 100644
--- a/Documentation/technical/racy-git.txt
+++ b/Documentation/technical/racy-git.txt
@@ -37,14 +37,6 @@ is not useful.  Currently, git compares the file type (regular
 files vs symbolic links) and executable bits (only for regular
 files) from `st_mode` member, `st_mtime` and `st_ctime`
 timestamps, `st_uid`, `st_gid`, `st_ino`, and `st_size` members.
-With a `USE_STDEV` compile-time option, `st_dev` is also
-compared, but this is not enabled by default because this member
-is not stable on network filesystems.  With `USE_NSEC`
-compile-time option, `st_mtim.tv_nsec` and `st_ctim.tv_nsec`
-members are also compared, but this is not enabled by default
-because the value of this member becomes meaningless once the
-inode is evicted from the inode cache on filesystems that do not
-store it on disk.
 
 
 Racy git
diff --git a/Makefile b/Makefile
index 49f36f5..9b27fe2 100644
--- a/Makefile
+++ b/Makefile
@@ -120,21 +120,9 @@ all::
 # that tells runtime paths to dynamic libraries;
 # "-Wl,-rpath=/path/lib" is used instead.
 #
-# Define USE_NSEC below if you want git to care about sub-second file mtimes
-# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
-# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
-# randomly break unless your underlying filesystem supports those sub-second
-# times (my ext3 doesn't).
-#
 # Define USE_ST_TIMESPEC if your "struct stat" uses "st_ctimespec" instead of
 # "st_ctim"
 #
-# Define NO_NSEC if your "struct stat" does not have "st_ctim.tv_nsec"
-# available.  This automatically turns USE_NSEC off.
-#
-# Define USE_STDEV below if you want git to care about the underlying device
-# change being considered an inode change from the update-index perspective.
-#
 # Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
 # field that counts the on-disk footprint in 512-byte blocks.
 #
@@ -766,7 +754,6 @@ ifeq ($(uname_S),AIX)
 	NO_MEMMEM = YesPlease
 	NO_MKDTEMP = YesPlease
 	NO_STRLCPY = YesPlease
-	NO_NSEC = YesPlease
 	FREAD_READS_DIRECTORIES = UnfortunatelyYes
 	INTERNAL_QSORT = UnfortunatelyYes
 	NEEDS_LIBICONV=YesPlease
@@ -832,7 +819,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
 	RUNTIME_PREFIX = YesPlease
 	NO_POSIX_ONLY_PROGRAMS = YesPlease
 	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
-	NO_NSEC = YesPlease
 	USE_WIN32_MMAP = YesPlease
 	UNRELIABLE_FSTAT = UnfortunatelyYes
 	COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/regex -Icompat/fnmatch
@@ -956,15 +942,9 @@ endif
 ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
 	BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
 endif
-ifdef USE_NSEC
-	BASIC_CFLAGS += -DUSE_NSEC
-endif
 ifdef USE_ST_TIMESPEC
 	BASIC_CFLAGS += -DUSE_ST_TIMESPEC
 endif
-ifdef NO_NSEC
-	BASIC_CFLAGS += -DNO_NSEC
-endif
 ifdef NO_C99_FORMAT
 	BASIC_CFLAGS += -DNO_C99_FORMAT
 endif
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 5d134be..c980a48 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -800,15 +800,11 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
 		int fd;
 
 		mtime.sec = st.st_mtime;
-		mtime.nsec = ST_MTIME_NSEC(st);
+		mtime.nsec = 0;
 		if (stat(shallow, &st)) {
 			if (mtime.sec)
 				die("shallow file was removed during fetch");
-		} else if (st.st_mtime != mtime.sec
-#ifdef USE_NSEC
-				|| ST_MTIME_NSEC(st) != mtime.nsec
-#endif
-			  )
+		} else if (st.st_mtime != mtime.sec)
 			die("shallow file was changed during fetch");
 
 		fd = hold_lock_file_for_update(&lock, shallow,
diff --git a/cache.h b/cache.h
index ab1294d..ca0510f 100644
--- a/cache.h
+++ b/cache.h
@@ -499,7 +499,6 @@ extern int delete_ref(const char *, const unsigned char *sha1, int delopt);
 
 /* 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;
diff --git a/config.c b/config.c
index 8c1ae59..d3619ab 100644
--- a/config.c
+++ b/config.c
@@ -360,10 +360,6 @@ 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);
diff --git a/configure.ac b/configure.ac
index 4e728bc..9d49ad1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -225,16 +225,6 @@ GIT_PARSE_WITH(iconv))
 
 ## --enable-FEATURE[=ARG] and --disable-FEATURE
 #
-# Define USE_NSEC below if you want git to care about sub-second file mtimes
-# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
-# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
-# randomly break unless your underlying filesystem supports those sub-second
-# times (my ext3 doesn't).
-#
-# Define USE_STDEV below if you want git to care about the underlying device
-# change being considered an inode change from the update-index perspective.
-
-#
 # Define SHELL_PATH to provide path to shell.
 GIT_ARG_SET_PATH(shell)
 #
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 1a90cb8..1d0402c 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1447,7 +1447,6 @@ _git_config ()
 		core.safecrlf
 		core.sharedRepository
 		core.symlinks
-		core.trustctime
 		core.warnAmbiguousRefs
 		core.whitespace
 		core.worktree
diff --git a/environment.c b/environment.c
index 4696885..a2497b9 100644
--- a/environment.c
+++ b/environment.c
@@ -13,7 +13,6 @@ 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;
diff --git a/git-compat-util.h b/git-compat-util.h
index 785aa31..6678e4d 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -394,20 +394,6 @@ void git_qsort(void *base, size_t nmemb, size_t size,
 # define FORCE_DIR_SET_GID 0
 #endif
 
-#ifdef NO_NSEC
-#undef USE_NSEC
-#define ST_CTIME_NSEC(st) 0
-#define ST_MTIME_NSEC(st) 0
-#else
-#ifdef USE_ST_TIMESPEC
-#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctimespec.tv_nsec))
-#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtimespec.tv_nsec))
-#else
-#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctim.tv_nsec))
-#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtim.tv_nsec))
-#endif
-#endif
-
 #ifdef UNRELIABLE_FSTAT
 #define fstat_is_reliable() 0
 #else
diff --git a/read-cache.c b/read-cache.c
index 3f58711..9a452b0 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -69,8 +69,8 @@ void fill_stat_cache_info(struct cache_entry *ce, struct stat *st)
 {
 	ce->ce_ctime.sec = (unsigned int)st->st_ctime;
 	ce->ce_mtime.sec = (unsigned int)st->st_mtime;
-	ce->ce_ctime.nsec = ST_CTIME_NSEC(*st);
-	ce->ce_mtime.nsec = ST_MTIME_NSEC(*st);
+	ce->ce_ctime.nsec = 0;
+	ce->ce_mtime.nsec = 0;
 	ce->ce_dev = st->st_dev;
 	ce->ce_ino = st->st_ino;
 	ce->ce_uid = st->st_uid;
@@ -200,31 +200,6 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st)
 	}
 	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)
-		changed |= CTIME_CHANGED;
-
-#ifdef USE_NSEC
-	if (ce->ce_mtime.nsec != ST_MTIME_NSEC(*st))
-		changed |= MTIME_CHANGED;
-	if (trust_ctime && 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;
-
-#ifdef USE_STDEV
-	/*
-	 * st_dev breaks on network filesystems where different
-	 * clients will have different views of what "device"
-	 * the filesystem is on
-	 */
-	if (ce->ce_dev != (unsigned int) st->st_dev)
-		changed |= INODE_CHANGED;
-#endif
 
 	if (ce->ce_size != (unsigned int) st->st_size)
 		changed |= DATA_CHANGED;
@@ -242,15 +217,7 @@ static int is_racy_timestamp(const struct index_state *istate, struct cache_entr
 {
 	return (!S_ISGITLINK(ce->ce_mode) &&
 		istate->timestamp.sec &&
-#ifdef USE_NSEC
-		 /* nanosecond timestamped files can also be racy! */
-		(istate->timestamp.sec < ce->ce_mtime.sec ||
-		 (istate->timestamp.sec == ce->ce_mtime.sec &&
-		  istate->timestamp.nsec <= ce->ce_mtime.nsec))
-#else
-		istate->timestamp.sec <= ce->ce_mtime.sec
-#endif
-		 );
+		istate->timestamp.sec <= ce->ce_mtime.sec);
 }
 
 int ie_match_stat(const struct index_state *istate,
@@ -1299,7 +1266,7 @@ int read_index_from(struct index_state *istate, const char *path)
 		dst_offset += ce_size(ce);
 	}
 	istate->timestamp.sec = st.st_mtime;
-	istate->timestamp.nsec = ST_MTIME_NSEC(st);
+	istate->timestamp.nsec = 0;
 
 	while (src_offset <= mmap_size - 20 - 8) {
 		/* After an array of active_nr index entries,
@@ -1564,7 +1531,7 @@ int write_index(struct index_state *istate, int newfd)
 	if (ce_flush(&c, newfd) || fstat(newfd, &st))
 		return -1;
 	istate->timestamp.sec = (unsigned int)st.st_mtime;
-	istate->timestamp.nsec = ST_MTIME_NSEC(st);
+	istate->timestamp.nsec = 0;
 	return 0;
 }
 

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid
  2009-04-26 19:25     ` Linus Torvalds
@ 2009-04-26 22:02       ` Robin Rosenberg
  2009-04-27  6:55       ` Junio C Hamano
  1 sibling, 0 replies; 12+ messages in thread
From: Robin Rosenberg @ 2009-04-26 22:02 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Junio C Hamano, Git Mailing List, spearce

söndag 26 april 2009 21:25:13 skrev Linus Torvalds <torvalds@linux-foundation.org>:
> 
> On Sun, 26 Apr 2009, Junio C Hamano wrote:
> > 
> > I had a similar patch that disables inum checking in my private tree for
> > different reasons of my own; the set of fields your patch ignores is a
> > compatible superset of, and I think makes more sense than, what I was
> > planning to do, so no objections from me on this _optional_ feature.
> 
> Maybe we should just remove those checks entirely?

Blessed-by: Robin Rosenberg <robin.rosenberg@dewire.com>

-- robin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid
  2009-04-26 19:25     ` Linus Torvalds
  2009-04-26 22:02       ` Robin Rosenberg
@ 2009-04-27  6:55       ` Junio C Hamano
  2009-04-27 15:00         ` Linus Torvalds
  1 sibling, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2009-04-27  6:55 UTC (permalink / raw)
  To: Linus Torvalds, Kjetil Barvik; +Cc: Robin Rosenberg, Git Mailing List, spearce

Linus Torvalds <torvalds@linux-foundation.org> writes:

> I started out wanting to check the stat information as much as possible, 
> but realistically, nobody probably really cares. We already effectively 
> removed st_dev checking and nsec checks.

Was ignoring st_dev checking primarily for a work tree over NFS?  I think
ignoring it makes sense.  If st_dev changes, it is likely that somebody
did a "mv" of a whole repository to some other filesystem, or the
filesystem is not giving stable st_dev to us for the whole tree---it is
not like we want to detect a change to a single path that changes its
st_dev and nothing else, as no such change is likely to be useful.

> IOW, maybe we should just do this, and remove over a hundred lines of dead 
> code or commentary/config. And never have to worry about these kinds of 
> issues with different environments again.

I like the end result.

But I am not sure about dropping the nanosecond resolution timestamps.
The area was extended recently in preparation for ext4; we can take
advantage of it to reduce the chance the racy-git avoidance codepath
triggers if we keep it.

    fba2f38 (make USE_NSEC work as expected, 2009-02-19)

    c06ff49 (Record ns-timestamps if possible, but do not use it without
    USE_NSEC, 2009-03-04)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid
  2009-04-27  6:55       ` Junio C Hamano
@ 2009-04-27 15:00         ` Linus Torvalds
  2009-04-27 15:58           ` Kjetil Barvik
  0 siblings, 1 reply; 12+ messages in thread
From: Linus Torvalds @ 2009-04-27 15:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Kjetil Barvik, Robin Rosenberg, Git Mailing List, spearce



On Sun, 26 Apr 2009, Junio C Hamano wrote:
> 
> Was ignoring st_dev checking primarily for a work tree over NFS?

Yes, but I think there were other issues too (like git repositories on 
removable media).

The inode number really has similar concerns - different operating systems 
will use different inode numbers for both NFS and for things like FAT. 
It's not nearly as noticeable, because people don't tend to switch OS's as 
much as they might switch between two machines.

> I like the end result.
> 
> But I am not sure about dropping the nanosecond resolution timestamps.
> The area was extended recently in preparation for ext4; we can take
> advantage of it to reduce the chance the racy-git avoidance codepath
> triggers if we keep it.
> 
>     fba2f38 (make USE_NSEC work as expected, 2009-02-19)
> 
>     c06ff49 (Record ns-timestamps if possible, but do not use it without
>     USE_NSEC, 2009-03-04)

Hey, we can leave the NSEC support in. Admittedly removing that was about 
half the patch, but even with it left in, it would be a cleanup.

		Linus

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid
  2009-04-27 15:00         ` Linus Torvalds
@ 2009-04-27 15:58           ` Kjetil Barvik
  2010-03-14 20:51             ` Robin Rosenberg
  0 siblings, 1 reply; 12+ messages in thread
From: Kjetil Barvik @ 2009-04-27 15:58 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Junio C Hamano, Robin Rosenberg, Git Mailing List, spearce

Linus Torvalds <torvalds@linux-foundation.org> writes:

> On Sun, 26 Apr 2009, Junio C Hamano wrote:
>> I like the end result.
>> 
>> But I am not sure about dropping the nanosecond resolution timestamps.
>> The area was extended recently in preparation for ext4; we can take
>> advantage of it to reduce the chance the racy-git avoidance codepath
>> triggers if we keep it.
>> 
>>     fba2f38 (make USE_NSEC work as expected, 2009-02-19)
>> 
>>     c06ff49 (Record ns-timestamps if possible, but do not use it without
>>     USE_NSEC, 2009-03-04)
>
> Hey, we can leave the NSEC support in. Admittedly removing that was about 
> half the patch, but even with it left in, it would be a cleanup.

  I think we should have the NSEC support, as it is a performance
  impromvent, at least on my laptop.  OK, not a huge improvment, but
  still.

  For git version 1.6.3.rc3 I made a litle test, and the difference was
  the following for the 'git checkout my-v2.6.25' (from my-v2.6.27):

                 for git compiled with    for git compiled without
                 'make USE_NSEC=1 ...':   the 'USE_NSEC=1' part:

   OK open calls:       13872                   14386
   OK close calls:      13872                   14386
   OK mmap2 calls:        102                     649
   OK munmap calls:        61                     608

  so, an improvment of 514 open() and close() calls, and 547 mmap2() and
  munmap() calls, for this particular test on my particular slow laptop
  disk.

  As I wrote in fba2f38 I would guess that the improvment is larger for
  a faster disk, and a SSD disk should be able to see a larger
  improvment that I did above.

  -- kjetil

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid
  2009-04-27 15:58           ` Kjetil Barvik
@ 2010-03-14 20:51             ` Robin Rosenberg
  2010-03-15  6:50               ` Junio C Hamano
  0 siblings, 1 reply; 12+ messages in thread
From: Robin Rosenberg @ 2010-03-14 20:51 UTC (permalink / raw)
  To: Kjetil Barvik
  Cc: Linus Torvalds, Junio C Hamano, Robin Rosenberg,
	Git Mailing List, spearce

måndagen den 27 april 2009 17.58.17 skrev  Kjetil Barvik:
> Linus Torvalds <torvalds@linux-foundation.org> writes:
> > On Sun, 26 Apr 2009, Junio C Hamano wrote:
> >> I like the end result.
> >>
> >> But I am not sure about dropping the nanosecond resolution timestamps.
> >> The area was extended recently in preparation for ext4; we can take
> >> advantage of it to reduce the chance the racy-git avoidance codepath
> >> triggers if we keep it.
> >>
> >>     fba2f38 (make USE_NSEC work as expected, 2009-02-19)
> >>
> >>     c06ff49 (Record ns-timestamps if possible, but do not use it without
> >>     USE_NSEC, 2009-03-04)
> >
> > Hey, we can leave the NSEC support in. Admittedly removing that was about
> > half the patch, but even with it left in, it would be a cleanup.
> 
>   I think we should have the NSEC support, as it is a performance
>   impromvent, at least on my laptop.  OK, not a huge improvment, but
>   still.
> 
>   For git version 1.6.3.rc3 I made a litle test, and the difference was
>   the following for the 'git checkout my-v2.6.25' (from my-v2.6.27):
> 
>                  for git compiled with    for git compiled without
>                  'make USE_NSEC=1 ...':   the 'USE_NSEC=1' part:
> 
>    OK open calls:       13872                   14386
>    OK close calls:      13872                   14386
>    OK mmap2 calls:        102                     649
>    OK munmap calls:        61                     608
> 
>   so, an improvment of 514 open() and close() calls, and 547 mmap2() and
>   munmap() calls, for this particular test on my particular slow laptop
>   disk.
> 
>   As I wrote in fba2f38 I would guess that the improvment is larger for
>   a faster disk, and a SSD disk should be able to see a larger
>   improvment that I did above.
> 
>   -- kjetil

Did something pop up that I don't know of that prevented inclusion of this 
patch, other than the NSEC option, or will it do if just refresh the patch?

-- robin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid
  2010-03-14 20:51             ` Robin Rosenberg
@ 2010-03-15  6:50               ` Junio C Hamano
  2010-03-15  7:41                 ` Alex Riesen
  0 siblings, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2010-03-15  6:50 UTC (permalink / raw)
  To: Robin Rosenberg
  Cc: Kjetil Barvik, Linus Torvalds, Junio C Hamano, Robin Rosenberg,
	Git Mailing List, spearce

Robin Rosenberg <robin.rosenberg@dewire.com> writes:

> Did something pop up that I don't know of that prevented inclusion of this 
> patch, other than the NSEC option, or will it do if just refresh the patch?

I think all of us liked the general direction, and also all of us agreed
that we would want to keep NSEC support that was removed by Linus's patch.

Nobody had time or inclination to update the patch to implement the
consensus (I still had the thread in my inbox, by the way).  So "just
refresh the patch" would be the necessary first step.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and  gid
  2010-03-15  6:50               ` Junio C Hamano
@ 2010-03-15  7:41                 ` Alex Riesen
  0 siblings, 0 replies; 12+ messages in thread
From: Alex Riesen @ 2010-03-15  7:41 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Robin Rosenberg, Kjetil Barvik, Linus Torvalds, Robin Rosenberg,
	Git Mailing List, spearce

On Mon, Mar 15, 2010 at 07:50, Junio C Hamano <gitster@pobox.com> wrote:
> Robin Rosenberg <robin.rosenberg@dewire.com> writes:
>
>> Did something pop up that I don't know of that prevented inclusion of this
>> patch, other than the NSEC option, or will it do if just refresh the patch?
>
> I think all of us liked the general direction, and also all of us agreed
> that we would want to keep NSEC support that was removed by Linus's patch.
>
> Nobody had time or inclination to update the patch to implement the
> consensus (I still had the thread in my inbox, by the way).  So "just
> refresh the patch" would be the necessary first step.

There is an awful lot of "trust-something" variables. Maybe they can be
consolidated into a bitmask/bitfields? And a config option taking a list of
filesystem features which can be trusted for a good measure (preserving
old "trust_something" options, of course).

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-03-15  7:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-26 10:55 [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid Robin Rosenberg
2009-04-26 11:06 ` Robin Rosenberg
2009-04-26 12:06   ` [PATCH 1/2] Silence diffs due to use by non-C code Robin Rosenberg
2009-04-26 18:38   ` [PATCH] Add core.trustlowlevelstat for diffs in dev,ino,uid and gid Junio C Hamano
2009-04-26 19:25     ` Linus Torvalds
2009-04-26 22:02       ` Robin Rosenberg
2009-04-27  6:55       ` Junio C Hamano
2009-04-27 15:00         ` Linus Torvalds
2009-04-27 15:58           ` Kjetil Barvik
2010-03-14 20:51             ` Robin Rosenberg
2010-03-15  6:50               ` Junio C Hamano
2010-03-15  7:41                 ` Alex Riesen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.