All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: vdye@github.com, johannes.schindelin@gmx.de, newren@gmail.com,
	peff@peff.net, gitster@pobox.com,
	Derrick Stolee <derrickstolee@github.com>,
	Derrick Stolee <derrickstolee@github.com>
Subject: [PATCH 3/6] config: move trust_ctime to global config
Date: Fri, 02 Jun 2023 14:33:37 +0000	[thread overview]
Message-ID: <d03a79f6f65758b8226d64e5d20d94f789f58919.1685716420.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1539.git.1685716420.gitgitgadget@gmail.com>

From: Derrick Stolee <derrickstolee@github.com>

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
---
 config.c        | 4 ----
 environment.c   | 1 -
 environment.h   | 1 -
 global-config.c | 2 ++
 global-config.h | 1 +
 read-cache.c    | 6 ++++--
 6 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/config.c b/config.c
index ffe6bea80a6..d955a16b372 100644
--- a/config.c
+++ b/config.c
@@ -1561,10 +1561,6 @@ int git_config_color(char *dest, const char *var, const char *value)
 
 static int git_default_core_config(const char *var, const char *value, void *cb)
 {
-	if (!strcmp(var, "core.trustctime")) {
-		trust_ctime = git_config_bool(var, value);
-		return 0;
-	}
 	if (!strcmp(var, "core.checkstat")) {
 		if (!strcasecmp(value, "default"))
 			check_stat = 1;
diff --git a/environment.c b/environment.c
index 890705f0f69..f42f79f7f1b 100644
--- a/environment.c
+++ b/environment.c
@@ -30,7 +30,6 @@
 #include "wrapper.h"
 #include "write-or-die.h"
 
-int trust_ctime = 1;
 int check_stat = 1;
 int has_symlinks = 1;
 int minimum_abbrev = 4, default_abbrev = -1;
diff --git a/environment.h b/environment.h
index 66d88612085..362681f63e7 100644
--- a/environment.h
+++ b/environment.h
@@ -111,7 +111,6 @@ void set_git_work_tree(const char *tree);
 #define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
 
 /* Environment bits from configuration mechanism */
-extern int trust_ctime;
 extern int check_stat;
 extern int has_symlinks;
 extern int minimum_abbrev, default_abbrev;
diff --git a/global-config.c b/global-config.c
index b6fd16b14f6..5bd6bc45418 100644
--- a/global-config.c
+++ b/global-config.c
@@ -5,6 +5,7 @@
 static int global_ints[] = {
 	[INT_CONFIG_NONE] = 0, /* unused*/
 	[INT_CONFIG_TRUST_EXECUTABLE_BIT] = 1,
+	[INT_CONFIG_TRUST_CTIME] = 1,
 };
 
 /* Bitmask for the enum. */
@@ -13,6 +14,7 @@ static uint64_t global_ints_initialized;
 static const char *global_int_names[] = {
 	[INT_CONFIG_NONE] = NULL, /* unused*/
 	[INT_CONFIG_TRUST_EXECUTABLE_BIT] = "core.filemode",
+	[INT_CONFIG_TRUST_CTIME] = "core.trustctime",
 };
 
 static int config_available;
diff --git a/global-config.h b/global-config.h
index e66c3f4ac77..a6d8e5adc4e 100644
--- a/global-config.h
+++ b/global-config.h
@@ -4,6 +4,7 @@
 enum int_config_key {
 	INT_CONFIG_NONE = 0,
 	INT_CONFIG_TRUST_EXECUTABLE_BIT,
+	INT_CONFIG_TRUST_CTIME,
 };
 
 /**
diff --git a/read-cache.c b/read-cache.c
index 8d14a029ce4..9e5a6ba2c76 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -192,14 +192,16 @@ int match_stat_data(const struct stat_data *sd, struct stat *st)
 
 	if (sd->sd_mtime.sec != (unsigned int)st->st_mtime)
 		changed |= MTIME_CHANGED;
-	if (trust_ctime && check_stat &&
+	if (get_int_config_global(INT_CONFIG_TRUST_CTIME) &&
+	    check_stat &&
 	    sd->sd_ctime.sec != (unsigned int)st->st_ctime)
 		changed |= CTIME_CHANGED;
 
 #ifdef USE_NSEC
 	if (check_stat && sd->sd_mtime.nsec != ST_MTIME_NSEC(*st))
 		changed |= MTIME_CHANGED;
-	if (trust_ctime && check_stat &&
+	if (get_int_config_global(INT_CONFIG_TRUST_CTIME) &&
+	    check_stat &&
 	    sd->sd_ctime.nsec != ST_CTIME_NSEC(*st))
 		changed |= CTIME_CHANGED;
 #endif
-- 
gitgitgadget


  parent reply	other threads:[~2023-06-02 14:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02 14:33 [PATCH 0/6] [RFC] Lazy-loaded default Git config Derrick Stolee via GitGitGadget
2023-06-02 14:33 ` [PATCH 1/6] config: create new global config helpers Derrick Stolee via GitGitGadget
2023-06-02 14:33 ` [PATCH 2/6] config: add trust_executable_bit to global config Derrick Stolee via GitGitGadget
2023-06-02 14:33 ` Derrick Stolee via GitGitGadget [this message]
2023-06-02 14:33 ` [PATCH 4/6] config: move quote_path_fully " Derrick Stolee via GitGitGadget
2023-06-02 14:33 ` [PATCH 5/6] config: move has_symlinks " Derrick Stolee via GitGitGadget
2023-06-02 14:33 ` [PATCH 6/6] config: move ignore_case " Derrick Stolee via GitGitGadget
2023-06-08 18:19 ` [PATCH 0/6] [RFC] Lazy-loaded default Git config Glen Choo

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=d03a79f6f65758b8226d64e5d20d94f789f58919.1685716420.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=vdye@github.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.