From: Junio C Hamano <gitster@pobox•com>
To: Robin Rosenberg <robin.rosenberg@dewire•com>
Cc: git@vger•kernel.org, j sixt <j.sixt@viscovery•net>,
Shawn Pearce <spearce@spearce•org>
Subject: Re: [PATCH v3] Enable minimal stat checking
Date: Tue, 22 Jan 2013 09:21:28 -0800 [thread overview]
Message-ID: <7va9s19lrb.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1358840962-12316-1-git-send-email-robin.rosenberg@dewire.com> (Robin Rosenberg's message of "Tue, 22 Jan 2013 08:49:22 +0100")
Robin Rosenberg <robin.rosenberg@dewire•com> writes:
> Specifically the fields uid, gid, ctime, ino and dev are set to zero
> by JGit. Other implementations, eg. Git in cygwin are allegedly also
> somewhat incompatible with Git For Windows and on *nix platforms
> the resolution of the timestamps may differ.
>
> Any stat checking by git will then need to check content, which may
> be very slow, particularly on Windows. Since mtime and size
> is typically enough we should allow the user to tell git to avoid
> checking these fields if they are set to zero in the index.
>
> This change introduces a core.checkstat config option where the
> the user can select to check all fields (default), or just size
> and the whole second part of mtime (minimal).
>
> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire•com>
The "trust_ctime ? check_stat : trust_ctime/*false*/" gave me the
same "Huh?" as it did to J6t, so I locally fixed them while
applying.
Also, even though we settled on "default/minimal", we may regret in
the future if old implementations died on an unrecognized value, as
that will forbid users from using an old Git and a new Git on the
same repository at the same time, so I'd suggest removing the "if
not default or minimal, die" and replacing it with "treat unknown
token as a do-no-harm no-op".
Interdiff would look like this.
Thanks.
config.c | 2 --
read-cache.c | 12 ++++++------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/config.c b/config.c
index 2b58c75..3f638e3 100644
--- a/config.c
+++ b/config.c
@@ -571,8 +571,6 @@ static int git_default_core_config(const char *var, const char *value)
check_stat = 1;
else if (!strcasecmp(value, "minimal"))
check_stat = 0;
- else
- die_bad_config(var);
}
if (!strcmp(var, "core.quotepath")) {
diff --git a/read-cache.c b/read-cache.c
index 23db681..827ae55 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -197,16 +197,16 @@ 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 ? check_stat : trust_ctime/*false*/)
- if (ce->ce_ctime.sec != (unsigned int)st->st_ctime)
- changed |= CTIME_CHANGED;
+ if (trust_ctime && check_stat &&
+ ce->ce_ctime.sec != (unsigned int)st->st_ctime)
+ changed |= CTIME_CHANGED;
#ifdef USE_NSEC
if (check_stat && ce->ce_mtime.nsec != ST_MTIME_NSEC(*st))
changed |= MTIME_CHANGED;
- if (trust_ctime ? check_stat : trust_ctime/*false*/)
- if (ce->ce_ctime.nsec != ST_CTIME_NSEC(*st))
- changed |= CTIME_CHANGED;
+ if (trust_ctime && check_stat &&
+ ce->ce_ctime.nsec != ST_CTIME_NSEC(*st))
+ changed |= CTIME_CHANGED;
#endif
if (check_stat) {
next prev parent reply other threads:[~2013-01-22 17:21 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-05 21:20 [PATCH] Perform minimal stat comparison when some stat fields are not set Robin Rosenberg
2012-12-05 23:43 ` Junio C Hamano
2012-12-06 1:09 ` Robin Rosenberg
2012-12-06 7:21 ` Johannes Sixt
2012-12-06 11:16 ` Robin Rosenberg
2013-01-14 21:11 ` [PATCH v2] Make git selectively and conditionally ignore certain stat fields Robin Rosenberg
2013-01-14 21:57 ` Junio C Hamano
2013-01-14 23:43 ` Robin Rosenberg
2013-01-15 0:11 ` Junio C Hamano
2013-01-15 0:43 ` Robin Rosenberg
2013-01-15 7:02 ` Johannes Sixt
2013-01-15 7:09 ` Robin Rosenberg
2013-01-15 8:12 ` Junio C Hamano
2013-01-16 20:14 ` Ramsay Jones
2013-01-20 19:51 ` Robin Rosenberg
2013-01-20 20:30 ` Junio C Hamano
2013-01-22 7:49 ` [PATCH v3] Enable minimal stat checking Robin Rosenberg
2013-01-22 8:25 ` Johannes Sixt
2013-01-22 17:19 ` Torsten Bögershausen
2013-01-22 17:21 ` Junio C Hamano [this message]
2013-01-22 20:38 ` Robin Rosenberg
2013-05-06 23:22 ` Jeff King
2013-05-07 4:54 ` Junio C Hamano
2013-05-07 5:31 ` [PATCH] deprecate core.statinfo at Git 2.0 boundary Junio C Hamano
2013-05-07 6:38 ` Junio C Hamano
2013-05-07 14:09 ` Jeff King
2013-05-07 20:29 ` Robin Rosenberg
2013-01-14 23:51 ` [PATCH v3] Make git selectively and conditionally ignore certain stat fields Robin Rosenberg
2013-01-14 22:08 ` [PATCH v2] " Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7va9s19lrb.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=j.sixt@viscovery$(echo .)net \
--cc=robin.rosenberg@dewire$(echo .)com \
--cc=spearce@spearce$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox