{"thread":{"id":"32275","subject":"[PATCH] Perform minimal stat comparison when some stat fields are not set","startedAt":"2012-12-05T21:20:25Z","lastAt":"2013-05-07T20:29:21Z","messageCount":29,"participants":["Robin Rosenberg","Junio C Hamano","Johannes Sixt","Ramsay Jones","Torsten Bögershausen","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"204537","messageId":"1354742425-71417-1-git-send-email-robin.rosenberg@dewire.com","threadId":"32275","inReplyTo":null,"subject":"[PATCH] Perform minimal stat comparison when some stat fields are not set","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2012-12-05T21:20:25Z","receivedAt":"2012-12-05T21:20:25Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"At least JGit does sets uid, gid, ctime, ino and dev fields to zero\non update. To Git this looks like the stat data does not match and\na full file compare will be forced even it size and mtime match. This\nis in practice unnecessary. Sense JGit's presence by checking if ino\nand dev is zero.\n\nSigned-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n---\n read-cache.c | 21 +++++++++++++--------\n 1 file changed, 13 insertions(+), 8 deletions(-)\n\ndiff --git a/read-cache.c b/read-cache.c\nindex fda78bc..6f13a22 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -197,21 +197,26 @@ 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+\n+\tint minimal_stat = (ce->ce_ino == 0 && ce->ce_dev == 0);\n+\n+\tif (trust_ctime && !minimal_stat && 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+\tif (trust_ctime && !minimal_stat && 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+\tif (!minimal_stat) {\n+\t\tif (ce->ce_uid != (unsigned int) st->st_uid ||\n+\t\t\tce->ce_gid != (unsigned int) st->st_gid)\n+\t\t\tchanged |= OWNER_CHANGED;\n+\t\tif (ce->ce_ino != 0 && ce->ce_ino != (unsigned int) st->st_ino)\n+\t\t\tchanged |= INODE_CHANGED;\n+\t}\n \n #ifdef USE_STDEV\n \t/*\n@@ -219,7 +224,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 (!minimal_stat && ce->ce_dev != (unsigned int) st->st_dev)\n \t\tchanged |= INODE_CHANGED;\n #endif\n \n-- \n1.8.0.msysgit.0.dirty\n"},{"id":"204544","messageId":"7vhao0jc98.fsf@alter.siamese.dyndns.org","threadId":"32275","inReplyTo":"1354742425-71417-1-git-send-email-robin.rosenberg@dewire.com","subject":"Re: [PATCH] Perform minimal stat comparison when some stat fields are not set","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-12-05T23:43:47Z","receivedAt":"2012-12-05T23:43:47Z","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> At least JGit does sets uid, gid, ctime, ino and dev fields to zero\n> on update. To Git this looks like the stat data does not match and\n> a full file compare will be forced even it size and mtime match. This\n> is in practice unnecessary. Sense JGit's presence by checking if ino\n> and dev is zero.\n>\n> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n> ---\n>  read-cache.c | 21 +++++++++++++--------\n>  1 file changed, 13 insertions(+), 8 deletions(-)\n>\n> diff --git a/read-cache.c b/read-cache.c\n> index fda78bc..6f13a22 100644\n> --- a/read-cache.c\n> +++ b/read-cache.c\n> @@ -197,21 +197,26 @@ 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> +\n> +\tint minimal_stat = (ce->ce_ino == 0 && ce->ce_dev == 0);\n\ndecl-after-stmt.\n\nBesides, is it sane to do this unconditionally to affect people who\ndo not use JGit?\n"},{"id":"204549","messageId":"805916413.19333293.1354756160521.JavaMail.root@dewire.com","threadId":"32275","inReplyTo":"7vhao0jc98.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Perform minimal stat comparison when some stat fields are not set","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2012-12-06T01:09:20Z","receivedAt":"2012-12-06T01:09:20Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"\n\n----- Ursprungligt meddelande -----\n> Robin Rosenberg <robin.rosenberg@dewire.com> writes:\n> \n> > At least JGit does sets uid, gid, ctime, ino and dev fields to zero\n> > on update. To Git this looks like the stat data does not match and\n> > a full file compare will be forced even it size and mtime match.\n> > This\n> > is in practice unnecessary. Sense JGit's presence by checking if\n> > ino\n> > and dev is zero.\n> >\n> > Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n> > ---\n> >  read-cache.c | 21 +++++++++++++--------\n> >  1 file changed, 13 insertions(+), 8 deletions(-)\n> >\n> > diff --git a/read-cache.c b/read-cache.c\n> > index fda78bc..6f13a22 100644\n> > --- a/read-cache.c\n> > +++ b/read-cache.c\n> > @@ -197,21 +197,26 @@ static int ce_match_stat_basic(struct\n> > 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\n> > int)st->st_ctime)\n> > +\n> > +\tint minimal_stat = (ce->ce_ino == 0 && ce->ce_dev == 0);\n> \n> decl-after-stmt.\n\nOk, btw. Which C version do we adhere to? C99 is quite old by now.\n\n> Besides, is it sane to do this unconditionally to affect people who\n> do not use JGit?\n> \n\nWould a config option like core.minstat be better? The name would imply no dynamic detection.\n\n- robin\n"},{"id":"204553","messageId":"50C0475F.1030206@viscovery.net","threadId":"32275","inReplyTo":"805916413.19333293.1354756160521.JavaMail.root@dewire.com","subject":"Re: [PATCH] Perform minimal stat comparison when some stat fields are not set","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2012-12-06T07:21:03Z","receivedAt":"2012-12-06T07:21:03Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 12/6/2012 2:09, schrieb Robin Rosenberg:\n>> Robin Rosenberg <robin.rosenberg@dewire.com> writes:\n>>> At least JGit does sets uid, gid, ctime, ino and dev fields to zero\n>>> on update. To Git this looks like the stat data does not match and\n>>> a full file compare will be forced even it size and mtime match.\n>>> This\n>>> is in practice unnecessary. Sense JGit's presence by checking if\n>>> ino\n>>> and dev is zero.\n\nIs this meant to better support C git and JGit working on the same repository?\n\nMinGW git sets these two stat fields to zero as well. But we have less of\nan interoparability problem between different git implementations in\npractice on Windows, I think.\n\n>> Besides, is it sane to do this unconditionally to affect people who\n>> do not use JGit?\n> \n> Would a config option like core.minstat be better? The name would imply no dynamic detection.\n\nA configuration option is the way to go. We already have core.trustctime,\ncore.symlinks, core.filemode, core.ignoreCygwinFSTricks.\n\nBut your new mode is not \"minimal\". In some implementations or on some\nfilesystems, even more bits of stat information could be meaningless\n(think of atime, rdev, nlink, uid, gid). Perhaps core.trustdevandino? Or\nan enumeration core.ignoreCacheStat=ctime,dev,ino?\n\n-- Hannes\n"},{"id":"204558","messageId":"578723621.19434897.1354792587152.JavaMail.root@dewire.com","threadId":"32275","inReplyTo":"50C0475F.1030206@viscovery.net","subject":"Re: [PATCH] Perform minimal stat comparison when some stat fields are not set","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2012-12-06T11:16:27Z","receivedAt":"2012-12-06T11:16:27Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"\n\n----- Ursprungligt meddelande -----\n> Am 12/6/2012 2:09, schrieb Robin Rosenberg:\n> >> Robin Rosenberg <robin.rosenberg@dewire.com> writes:\n> >>> At least JGit does sets uid, gid, ctime, ino and dev fields to\n> >>> zero\n> >>> on update. To Git this looks like the stat data does not match\n> >>> and\n> >>> a full file compare will be forced even it size and mtime match.\n> >>> This\n> >>> is in practice unnecessary. Sense JGit's presence by checking if\n> >>> ino\n> >>> and dev is zero.\n> \n> Is this meant to better support C git and JGit working on the same\n> repository?\n> \n> MinGW git sets these two stat fields to zero as well. But we have\n> less of\n> an interoparability problem between different git implementations in\n> practice on Windows, I think.\n\nIt is purely for performance in some situations.\n\n> >> Besides, is it sane to do this unconditionally to affect people\n> >> who\n> >> do not use JGit?\n> > \n> > Would a config option like core.minstat be better? The name would\n> > imply no dynamic detection.\n> \n> A configuration option is the way to go. We already have\n> core.trustctime,\n> core.symlinks, core.filemode, core.ignoreCygwinFSTricks.\n> \n> But your new mode is not \"minimal\". In some implementations or on\n> some\n> filesystems, even more bits of stat information could be meaningless\n> (think of atime, rdev, nlink, uid, gid). Perhaps core.trustdevandino?\n\nI already excluded uid and gid so the only thing left is mtime and size.\nI can't see any reason for anyone to look at atime (somebody read the file,\nso what?), ok for rdev and nlink, but we don not look at them my patch\ndoes not avoid looking at them.\n\n> Or\n> an enumeration core.ignoreCacheStat=ctime,dev,ino?\n\nThat would mean only one configuration option. Good.\n\n-- robin\n"},{"id":"206842","messageId":"1358197878-36736-1-git-send-email-robin.rosenberg@dewire.com","threadId":"32275","inReplyTo":"50C0475F.1030206@viscovery.net","subject":"[PATCH v2] Make git selectively and conditionally ignore certain stat fields","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2013-01-14T21:11:18Z","receivedAt":"2013-01-14T21:11:18Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"Specifically the fields uid, gid, ctime, ino and dev are set to zero\nby JGit. Any stat checking by git will then need to check content,\nwhich may be very slow, particularly on Windows. Since mtime and size\nis typically enough we should allow the user to tell git to avoid\nchecking these fields if they are set to zero in the index.\n\nThis change introduces a core.ignorezerostat config option where the\nuser can list the fields to ignore using the names above.\n\nSigned-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n---\n Documentation/config.txt |  9 +++++++++\n cache.h                  |  8 ++++++++\n config.c                 | 25 +++++++++++++++++++++++++\n environment.c            |  1 +\n read-cache.c             | 24 +++++++++++++++---------\n 5 files changed, 58 insertions(+), 9 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex d5809e0..7f34c94 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -235,6 +235,15 @@ core.trustctime::\n \tcrawlers and some backup systems).\n \tSee linkgit:git-update-index[1]. True by default.\n \n+core.ignorezerostat::\n+\tAffects the interpretation of some fields in the index. If\n+\tunset has no effect. When set to a comma separated list of fields,\n+\teach of the fields in the index will be excluded from comparison with\n+\tworking tree if the index value is zero. The following fields\n+\tare recognzed: `uid', `gid', `ctime', `ino' and `dev'. When ctime is ignored\n+\tthe setting of 'core.trustctime' is overridden by by this config\n+\tvalue.\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 c257953..524e49a 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -536,6 +536,14 @@ 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 check_nonzero_stat;\n+#define CHECK_NONZERO_STAT_UID (1<<0)\n+#define CHECK_NONZERO_STAT_GID (1<<1)\n+#define CHECK_NONZERO_STAT_CTIME (1<<2)\n+#define CHECK_NONZERO_STAT_INO (1<<3)\n+#define CHECK_NONZERO_STAT_DEV (1<<4)\n+#define CHECK_NONZERO_STAT_MASK ((1<<5)-1)\n+\n extern int quote_path_fully;\n extern int has_symlinks;\n extern int minimum_abbrev, default_abbrev;\ndiff --git a/config.c b/config.c\nindex 7b444b6..79485cd 100644\n--- a/config.c\n+++ b/config.c\n@@ -566,6 +566,31 @@ 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.ignorezerostat\")) {\n+\t\tchar *copy, *tok;\n+\t\tgit_config_string(&copy, \"core.ignorezerostat\", value);\n+\t\tcheck_nonzero_stat = CHECK_NONZERO_STAT_MASK;\n+\t\ttok = strtok(value, \",\");\n+\t\twhile (tok) {\n+\t\t\tif (strcasecmp(tok, \"uid\") == 0)\n+\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_UID;\n+\t\t\telse if (strcasecmp(tok, \"gid\") == 0)\n+\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_GID;\n+\t\t\telse if (strcasecmp(tok, \"ctime\") == 0) {\n+\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_CTIME;\n+\t\t\t\ttrust_ctime = 0;\n+\t\t\t} else if (strcasecmp(tok, \"ino\") == 0)\n+\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_INO;\n+\t\t\telse if (strcasecmp(tok, \"dev\") == 0)\n+\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_DEV;\n+\t\t\telse\n+\t\t\t\tdie_bad_config(var);\n+\t\t\ttok = strtok(NULL, \",\");\n+\t\t}\n+\t\tif (check_nonzero_stat >= CHECK_NONZERO_STAT_MASK)\n+\t\t\tdie_bad_config(var);\n+\t\tfree(copy);\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 85edd7f..e90b52f 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -13,6 +13,7 @@\n \n int trust_executable_bit = 1;\n int trust_ctime = 1;\n+int check_nonzero_stat = CHECK_NONZERO_STAT_MASK;\n int has_symlinks = 1;\n int minimum_abbrev = 4, default_abbrev = 7;\n int ignore_case;\ndiff --git a/read-cache.c b/read-cache.c\nindex fda78bc..f7fe15d 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -197,8 +197,9 @@ 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+\tif ((trust_ctime || ((check_nonzero_stat&CHECK_NONZERO_STAT_CTIME) && ce->ce_ctime.sec)))\n+\t\tif (ce->ce_ctime.sec != (unsigned int)st->st_ctime)\n+\t\t\tchanged |= CTIME_CHANGED;\n \n #ifdef USE_NSEC\n \tif (ce->ce_mtime.nsec != ST_MTIME_NSEC(*st))\n@@ -207,11 +208,15 @@ 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-\t\tchanged |= OWNER_CHANGED;\n-\tif (ce->ce_ino != (unsigned int) st->st_ino)\n-\t\tchanged |= INODE_CHANGED;\n+\tif ((check_nonzero_stat&CHECK_NONZERO_STAT_UID) || ce->ce_uid)\n+\t\tif (ce->ce_uid != (unsigned int) st->st_uid)\n+\t\t\tchanged |= OWNER_CHANGED;\n+\tif ((check_nonzero_stat&CHECK_NONZERO_STAT_GID) || ce->ce_gid)\n+\t\tif (ce->ce_gid != (unsigned int) st->st_gid)\n+\t\t\tchanged |= OWNER_CHANGED;\n+\tif ((check_nonzero_stat&CHECK_NONZERO_STAT_INO) || ce->ce_ino)\n+\t\tif (ce->ce_ino != (unsigned int) st->st_ino)\n+\t\t\tchanged |= INODE_CHANGED;\n \n #ifdef USE_STDEV\n \t/*\n@@ -219,8 +224,9 @@ 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-\t\tchanged |= INODE_CHANGED;\n+\tif ((check_nonzero_stat&CHECK_NONZERO_STAT_DEV) || ce->ce_dev)\n+\t\tif (ce->ce_dev != (unsigned int) st->st_dev)\n+\t\t\tchanged |= INODE_CHANGED;\n #endif\n \n \tif (ce->ce_size != (unsigned int) st->st_size)\n-- \n1.8.1.337.g63e8afb.dirty\n"},{"id":"206844","messageId":"7vmwwb8m25.fsf@alter.siamese.dyndns.org","threadId":"32275","inReplyTo":"1358197878-36736-1-git-send-email-robin.rosenberg@dewire.com","subject":"Re: [PATCH v2] Make git selectively and conditionally ignore certain stat fields","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-14T21:57:38Z","receivedAt":"2013-01-14T21:57: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> diff --git a/read-cache.c b/read-cache.c\n> index fda78bc..f7fe15d 100644\n> --- a/read-cache.c\n> +++ b/read-cache.c\n> @@ -197,8 +197,9 @@ 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> +\tif ((trust_ctime || ((check_nonzero_stat&CHECK_NONZERO_STAT_CTIME) && ce->ce_ctime.sec)))\n\nOne SP is required on each side of a binary operator; please have\none after check_nonzero_stat and after the & after it.\n\nI wonder if we should lose the trust_ctime variable and use this\ncheck_nonzero_stat bitset exclusively, provided that this were a\ngood direction to go?\n"},{"id":"206845","messageId":"7vip6z8lkr.fsf@alter.siamese.dyndns.org","threadId":"32275","inReplyTo":"1358197878-36736-1-git-send-email-robin.rosenberg@dewire.com","subject":"Re: [PATCH v2] Make git selectively and conditionally ignore certain stat fields","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-14T22:08:04Z","receivedAt":"2013-01-14T22:08:04Z","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> @@ -566,6 +566,31 @@ 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.ignorezerostat\")) {\n> +\t\tchar *copy, *tok;\n> +\t\tgit_config_string(&copy, \"core.ignorezerostat\", value);\n> +\t\tcheck_nonzero_stat = CHECK_NONZERO_STAT_MASK;\n> +\t\ttok = strtok(value, \",\");\n> +\t\twhile (tok) {\n> +\t\t\tif (strcasecmp(tok, \"uid\") == 0)\n> +\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_UID;\n> +\t\t\telse if (strcasecmp(tok, \"gid\") == 0)\n> +\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_GID;\n> +\t\t\telse if (strcasecmp(tok, \"ctime\") == 0) {\n> +\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_CTIME;\n> +\t\t\t\ttrust_ctime = 0;\n> +\t\t\t} else if (strcasecmp(tok, \"ino\") == 0)\n> +\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_INO;\n> +\t\t\telse if (strcasecmp(tok, \"dev\") == 0)\n> +\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_DEV;\n> +\t\t\telse\n> +\t\t\t\tdie_bad_config(var);\n> +\t\t\ttok = strtok(NULL, \",\");\n> +\t\t}\n> +\t\tif (check_nonzero_stat >= CHECK_NONZERO_STAT_MASK)\n> +\t\t\tdie_bad_config(var);\n> +\t\tfree(copy);\n> +\t}\n\nAlso I am getting these:\n\nconfig.c: In function 'git_default_core_config':\nconfig.c:571: error: passing argument 1 of 'git_config_string' from incompatible pointer type\nconfig.c:540: note: expected 'const char **' but argument is of type 'char **'\nconfig.c:573: error: passing argument 1 of 'strtok' discards qualifiers from pointer target type\n"},{"id":"206852","messageId":"1815551092.2039693.1358207014937.JavaMail.root@dewire.com","threadId":"32275","inReplyTo":"7vmwwb8m25.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2] Make git selectively and conditionally ignore certain stat fields","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2013-01-14T23:43:34Z","receivedAt":"2013-01-14T23:43:34Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"\n\n----- Ursprungligt meddelande -----\n> Robin Rosenberg <robin.rosenberg@dewire.com> writes:\n> \n> > diff --git a/read-cache.c b/read-cache.c\n> > index fda78bc..f7fe15d 100644\n> > --- a/read-cache.c\n> > +++ b/read-cache.c\n> > @@ -197,8 +197,9 @@ static int ce_match_stat_basic(struct\n> > 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\n> > int)st->st_ctime)\n> > -\t\tchanged |= CTIME_CHANGED;\n> > +\tif ((trust_ctime ||\n> > ((check_nonzero_stat&CHECK_NONZERO_STAT_CTIME) &&\n> > ce->ce_ctime.sec)))\n> \n> One SP is required on each side of a binary operator; please have\n> one after check_nonzero_stat and after the & after it.\n> \n> I wonder if we should lose the trust_ctime variable and use this\n> check_nonzero_stat bitset exclusively, provided that this were a\n> good direction to go?\n\nSemantically they're somewhat different. My flags are for ignoring\na value when it's not used as indicated by the value zero, while\ntrustctime is for ignoring untrustworthy, non-zero, values.\n\n>From 1ce4790bf5e:\n    A new configuration variable 'core.trustctime' is introduced to\n    allow ignoring st_ctime information when checking if paths\n    in the working tree has changed, because there are situations where\n    it produces too much false positives.  Like when file system crawlers\n    keep changing it when scanning and using the ctime for marking scanned\n    files.\n\n(your second mail)\n>Also I am getting these:\n>\n>config.c: In function 'git_default_core_config':\n>config.c:571: error: passing argument 1 of 'git_config_string' from incompatible pointer type\n>config.c:540: note: expected 'const char **' but argument is of type 'char **'\n>config.c:573: error: passing argument 1 of 'strtok' discards qualifiers from pointer target type\n\nDifferent compilers have different defaults. I'm on OS X (mountain lion), or am I missing\nsomething? I do get a warning. Am I allowed to modify the value, like strtok does? Seems I\nmissed the opportunity to use the copy rather then the original value.\n\nAnother thing that I noticed, is that I probably wanto to be able to filter on the precision\nof timestamps. Again, this i JGit-related. Current JGit has milliseconds precision (max), whereas\nGit has down to nanosecond precision in timestamps. Newer JGits may get nanoseconds timestamps too,\nbut on current Linux versions JGit gets only integral seconds regardless of file system. \n\nWould the names, milli, micro, nano be good for ignoring the tail when zero, or n1..n9 (obviously\nn2 would be ok too). nN = ignore all but first N nsec digits if they are zero)?\n\n-- robin\n"},{"id":"206854","messageId":"1358207516-49199-1-git-send-email-robin.rosenberg@dewire.com","threadId":"32275","inReplyTo":"7vmwwb8m25.fsf@alter.siamese.dyndns.org","subject":"[PATCH v3] Make git selectively and conditionally ignore certain stat fields","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2013-01-14T23:51:56Z","receivedAt":"2013-01-14T23:51:56Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"Specifically the fields uid, gid, ctime, ino and dev are set to zero\nby JGit. Any stat checking by git will then need to check content,\nwhich may be very slow, particularly on Windows. Since mtime and size\nis typically enough we should allow the user to tell git to avoid\nchecking these fields if they are set to zero in the index.\n\nThis change introduces a core.ignorezerostat config option where the\nuser can list the fields to ignore using the names above.\n\nSigned-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n---\n Documentation/config.txt |  9 +++++++++\n cache.h                  |  8 ++++++++\n config.c                 | 26 ++++++++++++++++++++++++++\n environment.c            |  1 +\n read-cache.c             | 29 ++++++++++++++++++-----------\n 5 files changed, 62 insertions(+), 11 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex d5809e0..7f34c94 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -235,6 +235,15 @@ core.trustctime::\n \tcrawlers and some backup systems).\n \tSee linkgit:git-update-index[1]. True by default.\n \n+core.ignorezerostat::\n+\tAffects the interpretation of some fields in the index. If\n+\tunset has no effect. When set to a comma separated list of fields,\n+\teach of the fields in the index will be excluded from comparison with\n+\tworking tree if the index value is zero. The following fields\n+\tare recognzed: `uid', `gid', `ctime', `ino' and `dev'. When ctime is ignored\n+\tthe setting of 'core.trustctime' is overridden by by this config\n+\tvalue.\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 c257953..524e49a 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -536,6 +536,14 @@ 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 check_nonzero_stat;\n+#define CHECK_NONZERO_STAT_UID (1<<0)\n+#define CHECK_NONZERO_STAT_GID (1<<1)\n+#define CHECK_NONZERO_STAT_CTIME (1<<2)\n+#define CHECK_NONZERO_STAT_INO (1<<3)\n+#define CHECK_NONZERO_STAT_DEV (1<<4)\n+#define CHECK_NONZERO_STAT_MASK ((1<<5)-1)\n+\n extern int quote_path_fully;\n extern int has_symlinks;\n extern int minimum_abbrev, default_abbrev;\ndiff --git a/config.c b/config.c\nindex 7b444b6..6b617bc 100644\n--- a/config.c\n+++ b/config.c\n@@ -566,6 +566,32 @@ 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.ignorezerostat\")) {\n+\t\tconst char *copy;\n+\t\tconst char *tok;\n+\t\tgit_config_string(&copy, \"core.ignorezerostat\", value);\n+\t\tcheck_nonzero_stat = CHECK_NONZERO_STAT_MASK;\n+\t\ttok = strtok((char*)copy, \",\");\n+\t\twhile (tok) {\n+\t\t\tif (strcasecmp(tok, \"uid\") == 0)\n+\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_UID;\n+\t\t\telse if (strcasecmp(tok, \"gid\") == 0)\n+\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_GID;\n+\t\t\telse if (strcasecmp(tok, \"ctime\") == 0) {\n+\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_CTIME;\n+\t\t\t\ttrust_ctime = 0;\n+\t\t\t} else if (strcasecmp(tok, \"ino\") == 0)\n+\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_INO;\n+\t\t\telse if (strcasecmp(tok, \"dev\") == 0)\n+\t\t\t\tcheck_nonzero_stat &= ~CHECK_NONZERO_STAT_DEV;\n+\t\t\telse\n+\t\t\t\tdie_bad_config(var);\n+\t\t\ttok = strtok(NULL, \",\");\n+\t\t}\n+\t\tif (check_nonzero_stat >= CHECK_NONZERO_STAT_MASK)\n+\t\t\tdie_bad_config(var);\n+\t\tfree((char*)copy);\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 85edd7f..e90b52f 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -13,6 +13,7 @@\n \n int trust_executable_bit = 1;\n int trust_ctime = 1;\n+int check_nonzero_stat = CHECK_NONZERO_STAT_MASK;\n int has_symlinks = 1;\n int minimum_abbrev = 4, default_abbrev = 7;\n int ignore_case;\ndiff --git a/read-cache.c b/read-cache.c\nindex fda78bc..c4226ee 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -197,21 +197,27 @@ 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+\tif ((trust_ctime || ((check_nonzero_stat & CHECK_NONZERO_STAT_CTIME) && ce->ce_ctime.sec)))\n+\t\tif (ce->ce_ctime.sec != (unsigned int)st->st_ctime)\n+\t\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+\tif ((trust_ctime || ((check_nonzero_stat & CHECK_NONZERO_STAT_CTIME) && ce->ce_ctime.nsec))\n+\t\tif (ce->ce_ctime.nsec != ST_CTIME_NSEC(*st))\n+\t\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+\tif ((check_nonzero_stat & CHECK_NONZERO_STAT_UID) || ce->ce_uid)\n+\t\tif (ce->ce_uid != (unsigned int) st->st_uid)\n+\t\t\tchanged |= OWNER_CHANGED;\n+\tif ((check_nonzero_stat & CHECK_NONZERO_STAT_GID) || ce->ce_gid)\n+\t\tif (ce->ce_gid != (unsigned int) st->st_gid)\n+\t\t\tchanged |= OWNER_CHANGED;\n+\tif ((check_nonzero_stat & CHECK_NONZERO_STAT_INO) || ce->ce_ino)\n+\t\tif (ce->ce_ino != (unsigned int) st->st_ino)\n+\t\t\tchanged |= INODE_CHANGED;\n \n #ifdef USE_STDEV\n \t/*\n@@ -219,8 +225,9 @@ 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-\t\tchanged |= INODE_CHANGED;\n+\tif ((check_nonzero_stat & CHECK_NONZERO_STAT_DEV) || ce->ce_dev)\n+\t\tif (ce->ce_dev != (unsigned int) st->st_dev)\n+\t\t\tchanged |= INODE_CHANGED;\n #endif\n \n \tif (ce->ce_size != (unsigned int) st->st_size)\n-- \n1.8.1.337.gc903ef9.dirty\n"},{"id":"206856","messageId":"7vy5fv71ad.fsf@alter.siamese.dyndns.org","threadId":"32275","inReplyTo":"1815551092.2039693.1358207014937.JavaMail.root@dewire.com","subject":"Re: [PATCH v2] Make git selectively and conditionally ignore certain stat fields","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-15T00:11:38Z","receivedAt":"2013-01-15T00:11: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> Semantically they're somewhat different. My flags are for ignoring\n> a value when it's not used as indicated by the value zero, while\n> trustctime is for ignoring untrustworthy, non-zero, values.\n\nYeah, I realized that after writing that message.\n\n> Another thing that I noticed, is that I probably wanto to be able to filter on the precision\n> of timestamps. Again, this i JGit-related. Current JGit has milliseconds precision (max), whereas\n> Git has down to nanosecond precision in timestamps. Newer JGits may get nanoseconds timestamps too,\n> but on current Linux versions JGit gets only integral seconds regardless of file system. \n>\n> Would the names, milli, micro, nano be good for ignoring the tail when zero, or n1..n9 (obviously\n> n2 would be ok too). nN = ignore all but first N nsec digits if they are zero)?\n\nIt somehow starts to sound like over-engineering to solve a wrong\nproblem.\n\nI'd say a simplistic \"ignore if zero is stored\" or even \"ignore this\nas one of the systems that shares this file writes crap in it\" may\nbe sufficient, and if this is a jGit specific issue, it might even\nmake sense to introduce a single configuration variable with string\n\"jgit\" somewhere in its name and bypass the stat field comparison\nfor known-problematic fields, instead of having the user know and\nlist what stat fields need special attention.\n\nIs this \"the user edits in eclipse and then runs 'git status' from the\nterminal\" problem?\n"},{"id":"206859","messageId":"1620721033.2052381.1358210626868.JavaMail.root@dewire.com","threadId":"32275","inReplyTo":"7vy5fv71ad.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2] Make git selectively and conditionally ignore certain stat fields","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2013-01-15T00:43:46Z","receivedAt":"2013-01-15T00:43:46Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"\n> Is this \"the user edits in eclipse and then runs 'git status' from\n> the\n> terminal\" problem?\n\nYes. Of course not just status, but any command that validates\nthe index. On Unix this is usually bearable, though slow, but on\nWindows I often see git status take minutes (yes large files...).\n\n-- robin\n"},{"id":"206909","messageId":"50F4FF15.2080803@viscovery.net","threadId":"32275","inReplyTo":"7vy5fv71ad.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2] Make git selectively and conditionally ignore certain stat fields","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-01-15T07:02:45Z","receivedAt":"2013-01-15T07:02:45Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 1/15/2013 1:11, schrieb Junio C Hamano:\n> I'd say a simplistic \"ignore if zero is stored\" or even \"ignore this\n> as one of the systems that shares this file writes crap in it\" may\n> be sufficient, and if this is a jGit specific issue, it might even\n> make sense to introduce a single configuration variable with string\n> \"jgit\" somewhere in its name and bypass the stat field comparison\n> for known-problematic fields, instead of having the user know and\n> list what stat fields need special attention.\n\nIt was my suggestion to have a list of names to ignore because the answer\nto this question\n\n> Is this \"the user edits in eclipse and then runs 'git status' from the\n> terminal\" problem?\n\nwas \"It is purely for performance in some situations\" back then. But\ntoday, the answer is \"Yes\". With this new background, your suggestion to\nhave just a single option that contains the token \"jgit\" may make more\nsense. (core.ignoreCygwinFSTricks may serve as a precedent.) The original\npatch was along this way, and the name contained \"minimal\", which I\nobjected to.\n\n-- Hannes\n"},{"id":"206910","messageId":"1119893992.2134035.1358233781666.JavaMail.root@dewire.com","threadId":"32275","inReplyTo":"7vy5fv71ad.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2] Make git selectively and conditionally ignore certain stat fields","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2013-01-15T07:09:41Z","receivedAt":"2013-01-15T07:09:41Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"\n\n----- Ursprungligt meddelande -----\n> Robin Rosenberg <robin.rosenberg@dewire.com> writes:\n> \n> > Semantically they're somewhat different. My flags are for ignoring\n> > a value when it's not used as indicated by the value zero, while\n> > trustctime is for ignoring untrustworthy, non-zero, values.\n> \n> Yeah, I realized that after writing that message.\n> \n> > Another thing that I noticed, is that I probably wanto to be able\n> > to filter on the precision\n> > of timestamps. Again, this i JGit-related. Current JGit has\n> > milliseconds precision (max), whereas\n> > Git has down to nanosecond precision in timestamps. Newer JGits may\n> > get nanoseconds timestamps too,\n> > but on current Linux versions JGit gets only integral seconds\n> > regardless of file system.\n> >\n> > Would the names, milli, micro, nano be good for ignoring the tail\n> > when zero, or n1..n9 (obviously\n> > n2 would be ok too). nN = ignore all but first N nsec digits if\n> > they are zero)?\n> \n> It somehow starts to sound like over-engineering to solve a wrong\n> problem.\n> \n> I'd say a simplistic \"ignore if zero is stored\" or even \"ignore this\n> as one of the systems that shares this file writes crap in it\" may\n> be sufficient, and if this is a jGit specific issue, it might even\n> make sense to introduce a single configuration variable with string\n> \"jgit\" somewhere in its name and bypass the stat field comparison\n> for known-problematic fields, instead of having the user know and\n> list what stat fields need special attention.\n\nMy first patch was something like that, just not using the word jgit. As\nfor what fields to ignore, it's something that can be configured by EGit\nand documented on the EGit/JGit wiki. \n\n-- robin\n"},{"id":"206922","messageId":"7va9sa6f0h.fsf@alter.siamese.dyndns.org","threadId":"32275","inReplyTo":"1119893992.2134035.1358233781666.JavaMail.root@dewire.com","subject":"Re: [PATCH v2] Make git selectively and conditionally ignore certain stat fields","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-15T08:12:46Z","receivedAt":"2013-01-15T08:12:46Z","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>> I'd say a simplistic \"ignore if zero is stored\" or even \"ignore this\n>> as one of the systems that shares this file writes crap in it\" may\n>> be sufficient, and if this is a jGit specific issue, it might even\n>> make sense to introduce a single configuration variable with string\n>> \"jgit\" somewhere in its name and bypass the stat field comparison\n>> for known-problematic fields, instead of having the user know and\n>> list what stat fields need special attention.\n>\n> My first patch was something like that, just not using the word jgit. As\n> for what fields to ignore, it's something that can be configured by EGit\n> and documented on the EGit/JGit wiki. \n\nThat configurability is a slipperly slope to drag us into giving users\nmore complexity that does not help them very much, I suspect.\n\nEarlier somebody mentioned \"size and mtime is often enough\", so I\nthink a single option core.looseStatInfo (substitute \"loose\" with\nshort, minimum or whatever adjective that is more appropriate---I am\nnot good at picking phrases, it sounds to me a way to more loosely\ndefine stat info cleanliness than we usually do) that makes us\nignore all fields (regardless of their zero-ness) other than those\ntwo fields might not be a bad way to go.\n\nI do not offhand know if such a loose mode is too simple and make it\nexcessively risky, though.\n"},{"id":"207102","messageId":"50F70A1C.1000508@ramsay1.demon.co.uk","threadId":"32275","inReplyTo":"7va9sa6f0h.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2] Make git selectively and conditionally ignore certain stat fields","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2013-01-16T20:14:20Z","receivedAt":"2013-01-16T20:14:20Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Junio C Hamano wrote:\n> Robin Rosenberg <robin.rosenberg@dewire.com> writes:\n\n> That configurability is a slipperly slope to drag us into giving users\n> more complexity that does not help them very much, I suspect.\n> \n> Earlier somebody mentioned \"size and mtime is often enough\", so I\n> think a single option core.looseStatInfo (substitute \"loose\" with\n> short, minimum or whatever adjective that is more appropriate---I am\n> not good at picking phrases, it sounds to me a way to more loosely\n> define stat info cleanliness than we usually do) that makes us\n> ignore all fields (regardless of their zero-ness) other than those\n> two fields might not be a bad way to go.\n\nAt one point, I used to build (and test) the MSVC version of git on\ncygwin, which leads to exactly the same problem. So, this is not just\nan EGit/JGit vs c-git issue, although there can't be many people that\nwill have this problem. (Mixing the MinGW and cygwin versions on the\nsame repo will also have this problem).\n\nI had a patch which, essentially, did what you suggest above; ie ignore\neverything other than size and mtime, *including* ignoring the zero-ness\nin the index. (I just don't understand why you would think of doing\notherwise!! ;-) ). As part of that patch, I also suppressed the \"empty diff\"\noutput that used to be shown for stat-dirty files (that's been fixed now\nright?), otherwise using gitk was a pain.\n\n[BTW, given the \"schizophrenic stat\" functions on cygwin, you can have\nthis problem with the cygwin version of git - all on it's lonesome!]\n\nI can't help with naming, BTW, since I called the config variable\n\"core.ramsay-stat\". :-P\n\n> \n> I do not offhand know if such a loose mode is too simple and make it\n> excessively risky, though.\n\nI suspect it would be fine ... *however*, I never sent my patch because\nI didn't think there would be many idiots^H^H^H^H^H^H pioneers like me! :-D\n\nATB,\nRamsay Jones\n"},{"id":"207325","messageId":"1999787368.3950248.1358711511739.JavaMail.root@dewire.com","threadId":"32275","inReplyTo":"7va9sa6f0h.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2] Make git selectively and conditionally ignore certain stat fields","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2013-01-20T19:51:51Z","receivedAt":"2013-01-20T19:51:51Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"\n\n----- Ursprungligt meddelande -----\n\n> That configurability is a slipperly slope to drag us into giving\n> users\n> more complexity that does not help them very much, I suspect.\n> \n> Earlier somebody mentioned \"size and mtime is often enough\", so I\n> think a single option core.looseStatInfo (substitute \"loose\" with\n> short, minimum or whatever adjective that is more appropriate---I am\n> not good at picking phrases, it sounds to me a way to more loosely\n> define stat info cleanliness than we usually do) that makes us\n> ignore all fields (regardless of their zero-ness) other than those\n> two fields might not be a bad way to go.\n\nWould something like this be good?\n\ncore.statinfo = \ndefault = all fields\nminimal = whole seconds of mtime and size\nmedium = seconds, nanos of mtime and size\nnonzero = all non-zero fields\n\n-- robin\n"},{"id":"207332","messageId":"7v4niblhr6.fsf@alter.siamese.dyndns.org","threadId":"32275","inReplyTo":"1999787368.3950248.1358711511739.JavaMail.root@dewire.com","subject":"Re: [PATCH v2] Make git selectively and conditionally ignore certain stat fields","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-20T20:30:21Z","receivedAt":"2013-01-20T20:30:21Z","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> ----- Ursprungligt meddelande -----\n>\n>> That configurability is a slipperly slope to drag us into giving\n>> users\n>> more complexity that does not help them very much, I suspect.\n>> \n>> Earlier somebody mentioned \"size and mtime is often enough\", so I\n>> think a single option core.looseStatInfo (substitute \"loose\" with\n>> short, minimum or whatever adjective that is more appropriate---I am\n>> not good at picking phrases, it sounds to me a way to more loosely\n>> define stat info cleanliness than we usually do) that makes us\n>> ignore all fields (regardless of their zero-ness) other than those\n>> two fields might not be a bad way to go.\n>\n> Would something like this be good?\n>\n> core.statinfo = \n> default = all fields\n> minimal = whole seconds of mtime and size\n> medium = seconds, nanos of mtime and size\n> nonzero = all non-zero fields\n>\n> -- robin\n\nIf you mean to exclude ctime and other fields we already exclude as\nuseless from your \"all\", that may make sense, but do we really need\nthat much \"flexibility\", or do \"more choices\" just confuse users? I\nhave this suspicion that it may be the latter.\n\nWouldn't a single boolean that lets users choose between your\n\"minimal\" and \"default\" be sufficient?\n"},{"id":"207486","messageId":"1358840962-12316-1-git-send-email-robin.rosenberg@dewire.com","threadId":"32275","inReplyTo":"7v4niblhr6.fsf@alter.siamese.dyndns.org","subject":"[PATCH v3] Enable minimal stat checking","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2013-01-22T07:49:22Z","receivedAt":"2013-01-22T07:49:22Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"Specifically the fields uid, gid, ctime, ino and dev are set to zero\nby JGit. Other implementations, eg. Git in cygwin are allegedly also\nsomewhat incompatible with Git For Windows and on *nix platforms\nthe resolution of the timestamps may differ.\n\nAny stat checking by git will then need to check content, which may\nbe very slow, particularly on Windows. Since mtime and size\nis typically enough we should allow the user to tell git to avoid\nchecking these fields if they are set to zero in the index.\n\nThis change introduces a core.checkstat config option where the\nthe user can select to check all fields (default), or just size\nand the whole second part of mtime (minimal).\n\nSigned-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n---\n Documentation/config.txt |  6 ++++++\n cache.h                  |  1 +\n config.c                 |  8 ++++++++\n environment.c            |  1 +\n read-cache.c             | 28 ++++++++++++++++------------\n 5 files changed, 32 insertions(+), 12 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex d5809e0..47c213d 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -235,6 +235,12 @@ core.trustctime::\n \tcrawlers and some backup systems).\n \tSee linkgit:git-update-index[1]. True by default.\n \n+core.checkstat::\n+\tDetermines which stat fields to match between the index\n+\tand work tree. The user can set this to 'default' or\n+\t'minimal'. Default (or explicitly 'default'), is to check\n+\tall fields, including the sub-second part of mtime and ctime.\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 c257953..ab20c4d 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -536,6 +536,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 check_stat;\n extern int quote_path_fully;\n extern int has_symlinks;\n extern int minimum_abbrev, default_abbrev;\ndiff --git a/config.c b/config.c\nindex 7b444b6..2b58c75 100644\n--- a/config.c\n+++ b/config.c\n@@ -566,6 +566,14 @@ 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.statinfo\")) {\n+\t\tif (!strcasecmp(value, \"default\"))\n+\t\t\tcheck_stat = 1;\n+\t\telse if (!strcasecmp(value, \"minimal\"))\n+\t\t\tcheck_stat = 0;\n+\t\telse\n+\t\t\tdie_bad_config(var);\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 85edd7f..e828b37 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -13,6 +13,7 @@\n \n int trust_executable_bit = 1;\n int trust_ctime = 1;\n+int check_stat = 1;\n int has_symlinks = 1;\n int minimum_abbrev = 4, default_abbrev = 7;\n int ignore_case;\ndiff --git a/read-cache.c b/read-cache.c\nindex fda78bc..23db681 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -197,21 +197,25 @@ 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+\tif (trust_ctime ? check_stat : trust_ctime/*false*/)\n+\t\tif (ce->ce_ctime.sec != (unsigned int)st->st_ctime)\n+\t\t\tchanged |= CTIME_CHANGED;\n \n #ifdef USE_NSEC\n-\tif (ce->ce_mtime.nsec != ST_MTIME_NSEC(*st))\n+\tif (check_stat && 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+\tif (trust_ctime ? check_stat : trust_ctime/*false*/)\n+\t\tif (ce->ce_ctime.nsec != ST_CTIME_NSEC(*st))\n+\t\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+\tif (check_stat) {\n+\t\tif (ce->ce_uid != (unsigned int) st->st_uid ||\n+\t\t\tce->ce_gid != (unsigned int) st->st_gid)\n+\t\t\tchanged |= OWNER_CHANGED;\n+\t\tif (ce->ce_ino != (unsigned int) st->st_ino)\n+\t\t\tchanged |= INODE_CHANGED;\n+\t}\n \n #ifdef USE_STDEV\n \t/*\n@@ -219,8 +223,8 @@ 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-\t\tchanged |= INODE_CHANGED;\n+\tif (check_stat && ce->ce_dev != (unsigned int) st->st_dev)\n+\t\t\tchanged |= INODE_CHANGED;\n #endif\n \n \tif (ce->ce_size != (unsigned int) st->st_size)\n-- \n1.8.1.337.g6672977.dirty\n"},{"id":"207492","messageId":"50FE4CEB.5040200@viscovery.net","threadId":"32275","inReplyTo":"1358840962-12316-1-git-send-email-robin.rosenberg@dewire.com","subject":"Re: [PATCH v3] Enable minimal stat checking","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2013-01-22T08:25:15Z","receivedAt":"2013-01-22T08:25:15Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 1/22/2013 8:49, schrieb Robin Rosenberg:\n> Specifically the fields uid, gid, ctime, ino and dev are set to zero\n> by JGit. Other implementations, eg. Git in cygwin are allegedly also\n> somewhat incompatible with Git For Windows and on *nix platforms\n> the resolution of the timestamps may differ.\n> \n> Any stat checking by git will then need to check content, which may\n> be very slow, particularly on Windows. Since mtime and size\n> is typically enough we should allow the user to tell git to avoid\n> checking these fields if they are set to zero in the index.\n\nIsn't this paragraph about slowness in the commit message misleading, as\nwhat the patch does has no influence on the speed of stat checking? Am I\nmissing something?\n\n> This change introduces a core.checkstat config option where the\n> the user can select to check all fields (default), or just size\n> and the whole second part of mtime (minimal).\n\n> +core.checkstat::\n> +\tDetermines which stat fields to match between the index\n> +\tand work tree. The user can set this to 'default' or\n> +\t'minimal'. Default (or explicitly 'default'), is to check\n> +\tall fields, including the sub-second part of mtime and ctime.\n\nI think this needs some more clarification, less 1337 speak, as well as a\nhint when to set the option.\n\n\tDetermines which file attributes are checked to detect whether\n\ta file has been modified. Set this option to 'minimal', when...,\n\twhich checks only the file size and whole-seconds of the last\n\tmodification time. Otherwise, leave unset or set to the value\n\t'default'.\n\nBy starting with the hint when to set to 'minimal' in this way allows us\nto omit a specification what the 'default' is.\n\n> diff --git a/read-cache.c b/read-cache.c\n> index fda78bc..23db681 100644\n> --- a/read-cache.c\n> +++ b/read-cache.c\n> @@ -197,21 +197,25 @@ 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> +\tif (trust_ctime ? check_stat : trust_ctime/*false*/)\n> +\t\tif (ce->ce_ctime.sec != (unsigned int)st->st_ctime)\n> +\t\t\tchanged |= CTIME_CHANGED;\n\nIt took me a while to understand why you write /*false*/ there. Isn't the\nthe condition merely this:\n\n\tif (trust_ctime && check_stat &&\n\t    ce->ce_ctime.sec != (unsigned int)st->st_ctime)\n\t\tchanged |= CTIME_CHANGED;\n\n>  \n>  #ifdef USE_NSEC\n> -\tif (ce->ce_mtime.nsec != ST_MTIME_NSEC(*st))\n> +\tif (check_stat && 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> +\tif (trust_ctime ? check_stat : trust_ctime/*false*/)\n> +\t\tif (ce->ce_ctime.nsec != ST_CTIME_NSEC(*st))\n> +\t\t\tchanged |= CTIME_CHANGED;\n\nSame here.\n\n>  #endif\n\n-- Hannes\n"},{"id":"207514","messageId":"50FECA14.5030802@web.de","threadId":"32275","inReplyTo":"1358840962-12316-1-git-send-email-robin.rosenberg@dewire.com","subject":"Re: [PATCH v3] Enable minimal stat checking","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-01-22T17:19:16Z","receivedAt":"2013-01-22T17:19:16Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"\n+core.checkstat::\n+\tDetermines which stat fields to match between the index\n+\tand work tree. The user can set this to 'default' or\n+\t'minimal'. Default (or explicitly 'default'), is to check\n+\tall fields, including the sub-second part of mtime and ctime.\n+\nSetting 'minimal' implies core.trustctime = false\n\n[snip]\n\n> -\tif (trust_ctime && ce->ce_ctime.sec != (unsigned int)st->st_ctime)\n> -\t\tchanged |= CTIME_CHANGED;\n> +\tif (trust_ctime ? check_stat : trust_ctime/*false*/)\n> +\t\tif (ce->ce_ctime.sec != (unsigned int)st->st_ctime)\n> +\t\t\tchanged |= CTIME_CHANGED;\n\nCould that be written as:\n+\tif (trust_ctime && check_stat && (ce->ce_ctime.sec != (unsigned int)st->st_ctime))\n+\t\t\tchanged |= CTIME_CHANGED;\n\n\n>  \n>  #ifdef USE_NSEC\n> -\tif (ce->ce_mtime.nsec != ST_MTIME_NSEC(*st))\n> +\tif (check_stat && 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> +\tif (trust_ctime ? check_stat : trust_ctime/*false*/)\n> +\t\tif (ce->ce_ctime.nsec != ST_CTIME_NSEC(*st))\n> +\t\t\tchanged |= CTIME_CHANGED;\n\nAnd here:\n+\tif (trust_ctime && check_stat && (ce->ce_ctime.nsec != ST_CTIME_NSEC(*st))\n+\t\tchanged |= CTIME_CHANGED;\n"},{"id":"207515","messageId":"7va9s19lrb.fsf@alter.siamese.dyndns.org","threadId":"32275","inReplyTo":"1358840962-12316-1-git-send-email-robin.rosenberg@dewire.com","subject":"Re: [PATCH v3] Enable minimal stat checking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-22T17:21:28Z","receivedAt":"2013-01-22T17:21:28Z","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> Specifically the fields uid, gid, ctime, ino and dev are set to zero\n> by JGit. Other implementations, eg. Git in cygwin are allegedly also\n> somewhat incompatible with Git For Windows and on *nix platforms\n> the resolution of the timestamps may differ.\n>\n> Any stat checking by git will then need to check content, which may\n> be very slow, particularly on Windows. Since mtime and size\n> is typically enough we should allow the user to tell git to avoid\n> checking these fields if they are set to zero in the index.\n>\n> This change introduces a core.checkstat config option where the\n> the user can select to check all fields (default), or just size\n> and the whole second part of mtime (minimal).\n>\n> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n\nThe \"trust_ctime ? check_stat : trust_ctime/*false*/\" gave me the\nsame \"Huh?\" as it did to J6t, so I locally fixed them while\napplying.\n\nAlso, even though we settled on \"default/minimal\", we may regret in\nthe future if old implementations died on an unrecognized value, as\nthat will forbid users from using an old Git and a new Git on the\nsame repository at the same time, so I'd suggest removing the \"if\nnot default or minimal, die\" and replacing it with \"treat unknown\ntoken as a do-no-harm no-op\".\n\nInterdiff would look like this.\n\nThanks.\n\n config.c     |  2 --\n read-cache.c | 12 ++++++------\n 2 files changed, 6 insertions(+), 8 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex 2b58c75..3f638e3 100644\n--- a/config.c\n+++ b/config.c\n@@ -571,8 +571,6 @@ static int git_default_core_config(const char *var, const char *value)\n \t\t\tcheck_stat = 1;\n \t\telse if (!strcasecmp(value, \"minimal\"))\n \t\t\tcheck_stat = 0;\n-\t\telse\n-\t\t\tdie_bad_config(var);\n \t}\n \n \tif (!strcmp(var, \"core.quotepath\")) {\ndiff --git a/read-cache.c b/read-cache.c\nindex 23db681..827ae55 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -197,16 +197,16 @@ 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 ? check_stat : trust_ctime/*false*/)\n-\t\tif (ce->ce_ctime.sec != (unsigned int)st->st_ctime)\n-\t\t\tchanged |= CTIME_CHANGED;\n+\tif (trust_ctime && check_stat &&\n+\t    ce->ce_ctime.sec != (unsigned int)st->st_ctime)\n+\t\tchanged |= CTIME_CHANGED;\n \n #ifdef USE_NSEC\n \tif (check_stat && ce->ce_mtime.nsec != ST_MTIME_NSEC(*st))\n \t\tchanged |= MTIME_CHANGED;\n-\tif (trust_ctime ? check_stat : trust_ctime/*false*/)\n-\t\tif (ce->ce_ctime.nsec != ST_CTIME_NSEC(*st))\n-\t\t\tchanged |= CTIME_CHANGED;\n+\tif (trust_ctime && check_stat &&\n+\t    ce->ce_ctime.nsec != ST_CTIME_NSEC(*st))\n+\t\tchanged |= CTIME_CHANGED;\n #endif\n \n \tif (check_stat) {\n"},{"id":"207524","messageId":"1885874971.118014.1358887127633.JavaMail.root@dewire.com","threadId":"32275","inReplyTo":"7va9s19lrb.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v3] Enable minimal stat checking","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2013-01-22T20:38:47Z","receivedAt":"2013-01-22T20:38:47Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"\n\n----- Ursprungligt meddelande -----\n\n> Also, even though we settled on \"default/minimal\", we may regret in\n> the future if old implementations died on an unrecognized value, as\n> that will forbid users from using an old Git and a new Git on the\n> same repository at the same time, so I'd suggest removing the \"if\n> not default or minimal, die\" and replacing it with \"treat unknown\n> token as a do-no-harm no-op\".\n\nI decided on error after looking at how other configuration errors\nare handled, but I can change, though I personally prefer to get\nconfiguration mistakes thrown in my face so I know.\n\n-- robin\n"},{"id":"216559","messageId":"20130506232242.GA27393@sigill.intra.peff.net","threadId":"32275","inReplyTo":"1358840962-12316-1-git-send-email-robin.rosenberg@dewire.com","subject":"Re: [PATCH v3] Enable minimal stat checking","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-05-06T23:22:42Z","receivedAt":"2013-05-06T23:22:42Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 22, 2013 at 08:49:22AM +0100, Robin Rosenberg wrote:\n\n> Specifically the fields uid, gid, ctime, ino and dev are set to zero\n> by JGit. Other implementations, eg. Git in cygwin are allegedly also\n> somewhat incompatible with Git For Windows and on *nix platforms\n> the resolution of the timestamps may differ.\n\nThis is an old commit, but I noticed a bug today...\n\n> This change introduces a core.checkstat config option where the\n> [...]\n> +core.checkstat::\n> [...]\n> +\tif (!strcmp(var, \"core.statinfo\")) {\n\nOne of these is not like the others. I didn't prepare a patch, though,\nbecause I wasn't sure which it was supposed to be. A documentation bug\nor a code bug? :)\n\n-Peff\n"},{"id":"216595","messageId":"7va9o7o0dl.fsf@alter.siamese.dyndns.org","threadId":"32275","inReplyTo":"20130506232242.GA27393@sigill.intra.peff.net","subject":"Re: [PATCH v3] Enable minimal stat checking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-07T04:54:46Z","receivedAt":"2013-05-07T04:54:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Jan 22, 2013 at 08:49:22AM +0100, Robin Rosenberg wrote:\n>\n>> Specifically the fields uid, gid, ctime, ino and dev are set to zero\n>> by JGit. Other implementations, eg. Git in cygwin are allegedly also\n>> somewhat incompatible with Git For Windows and on *nix platforms\n>> the resolution of the timestamps may differ.\n>\n> This is an old commit, but I noticed a bug today...\n>\n>> This change introduces a core.checkstat config option where the\n>> [...]\n>> +core.checkstat::\n>> [...]\n>> +\tif (!strcmp(var, \"core.statinfo\")) {\n>\n> One of these is not like the others. I didn't prepare a patch, though,\n> because I wasn't sure which it was supposed to be. A documentation bug\n> or a code bug? :)\n\nI'd say checkstat reads much better than statinfo.\n"},{"id":"216597","messageId":"7v1u9jnyox.fsf_-_@alter.siamese.dyndns.org","threadId":"32275","inReplyTo":"7va9o7o0dl.fsf@alter.siamese.dyndns.org","subject":"[PATCH] deprecate core.statinfo at Git 2.0 boundary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-07T05:31:10Z","receivedAt":"2013-05-07T05:31:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"c08e4d5b5cfa (Enable minimal stat checking, 2013-01-22) advertised\nthe configuration variable core.checkstat in the documentation and\nits log message, but the code expected core.statinfo instead.\n\nFor now, add core.checkstat, and warn people who have core.statinfo\nin their configuration file that we will remove it in Git 2.0.\n\nNoticed-by: Jeff King <peff@peff.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n config.c | 15 ++++++++++++++-\n 1 file changed, 14 insertions(+), 1 deletion(-)\n\ndiff --git a/config.c b/config.c\nindex aefd80b..7c55d05 100644\n--- a/config.c\n+++ b/config.c\n@@ -566,7 +566,20 @@ 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.statinfo\")) {\n+\tif (!strcmp(var, \"core.statinfo\") ||\n+\t    !strcmp(var, \"core.checkstat\")) {\n+\t\t/*\n+\t\t * NEEDSWORK: statinfo was a typo in v1.8.2 that has\n+\t\t * never been advertised.  we will remove it at Git\n+\t\t * 2.0 boundary.\n+\t\t */\n+\t\tif (!strcmp(var, \"core.statinfo\")) {\n+\t\t\tstatic int warned;\n+\t\t\tif (!warned++) {\n+\t\t\t\twarning(\"'core.statinfo' will be removed in Git 2.0; \"\n+\t\t\t\t\t\"use 'core.checkstat' instead.\");\n+\t\t\t}\n+\t\t}\n \t\tif (!strcasecmp(value, \"default\"))\n \t\t\tcheck_stat = 1;\n \t\telse if (!strcasecmp(value, \"minimal\"))\n"},{"id":"216599","messageId":"7vsj1zmh0v.fsf@alter.siamese.dyndns.org","threadId":"32275","inReplyTo":"7v1u9jnyox.fsf_-_@alter.siamese.dyndns.org","subject":"Re: [PATCH] deprecate core.statinfo at Git 2.0 boundary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-05-07T06:38:08Z","receivedAt":"2013-05-07T06:38:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> For now, add core.checkstat, and warn people who have core.statinfo\n> in their configuration file that we will remove it in Git 2.0.\n\nAnd an obvious follow-up for the 2.0 looks like this.\n\n-- >8 --\nSubject: [PATCH] core.statinfo: remove as promised in Git 2.0\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n config.c | 15 +--------------\n 1 file changed, 1 insertion(+), 14 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex 7c55d05..1f2cc90 100644\n--- a/config.c\n+++ b/config.c\n@@ -566,20 +566,7 @@ 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.statinfo\") ||\n-\t    !strcmp(var, \"core.checkstat\")) {\n-\t\t/*\n-\t\t * NEEDSWORK: statinfo was a typo in v1.8.2 that has\n-\t\t * never been advertised.  we will remove it at Git\n-\t\t * 2.0 boundary.\n-\t\t */\n-\t\tif (!strcmp(var, \"core.statinfo\")) {\n-\t\t\tstatic int warned;\n-\t\t\tif (!warned++) {\n-\t\t\t\twarning(\"'core.statinfo' will be removed in Git 2.0; \"\n-\t\t\t\t\t\"use 'core.checkstat' instead.\");\n-\t\t\t}\n-\t\t}\n+\tif (!strcmp(var, \"core.checkstat\")) {\n \t\tif (!strcasecmp(value, \"default\"))\n \t\t\tcheck_stat = 1;\n \t\telse if (!strcasecmp(value, \"minimal\"))\n-- \n1.8.3-rc1-154-g10dfae1\n"},{"id":"216610","messageId":"20130507140904.GA3282@sigill.intra.peff.net","threadId":"32275","inReplyTo":"7v1u9jnyox.fsf_-_@alter.siamese.dyndns.org","subject":"Re: [PATCH] deprecate core.statinfo at Git 2.0 boundary","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-05-07T14:09:05Z","receivedAt":"2013-05-07T14:09:05Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, May 06, 2013 at 10:31:10PM -0700, Junio C Hamano wrote:\n\n> c08e4d5b5cfa (Enable minimal stat checking, 2013-01-22) advertised\n> the configuration variable core.checkstat in the documentation and\n> its log message, but the code expected core.statinfo instead.\n> \n> For now, add core.checkstat, and warn people who have core.statinfo\n> in their configuration file that we will remove it in Git 2.0.\n\nYeah, that looks like a fine solution to me.\n\nTo be honest, I doubt that it is even necessary to handle the backwards\ncompatibility. The checkstat option never actually worked, statinfo was\nnever advertised, and the broken state was available in only one\nrelease. So I'd be very surprised if anyone more than the author was\nactually using it.\n\nStill, it is not that hard to handle both, so I suppose it is better to\nbe conservative.\n\n-Peff\n"},{"id":"216640","messageId":"335406152.35740504.1367958561946.JavaMail.root@dewire.com","threadId":"32275","inReplyTo":"20130507140904.GA3282@sigill.intra.peff.net","subject":"Re: [PATCH] deprecate core.statinfo at Git 2.0 boundary","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2013-05-07T20:29:21Z","receivedAt":"2013-05-07T20:29:21Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"This looks ok with me, though I can manage without backward compatibility.\n\n-- robin\n"}]}