Re: [PATCH v3 00/21] Add configuration options for split-index
From: Christian Couder <hidden>
Date: 2016-12-26 10:29:10
Subsystem:
the rest · Maintainer:
Linus Torvalds
On Mon, Dec 26, 2016 at 11:22 AM, Christian Couder [off-list ref] wrote:
Highlevel view of the patches in the series ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Except for patch 1/21, there are 3 big steps, one for each new configuration variable introduced. There only a few small differences between this patch series and the v2 patch series sent a few weeks ago. Only two commits have been changed a little, as suggested by Duy.
Here is the diff compared to v2:
diff --git a/config.c b/config.c
index 5c52cefd78..d6c8f8f3ba 100644
--- a/config.c
+++ b/config.c@@ -1724,7 +1724,7 @@ int git_config_get_untracked_cache(void) int git_config_get_split_index(void) { - int val = -1; + int val; if (!git_config_get_maybe_bool("core.splitindex", &val)) return val;
diff --git a/read-cache.c b/read-cache.c
index 772343ab25..bf0ac1ce61 100644
--- a/read-cache.c
+++ b/read-cache.c@@ -2227,18 +2227,17 @@ static unsigned long get_shared_index_expire_date(void) return shared_index_expire_date; } -static int can_delete_shared_index(const char *shared_sha1_hex) +static int can_delete_shared_index(const char *shared_index_path) { struct stat st; unsigned long expiration; - const char *shared_index = git_path("sharedindex.%s", shared_sha1_hex); /* Check timestamp */ expiration = get_shared_index_expire_date(); if (!expiration) return 0; - if (stat(shared_index, &st)) - return error_errno(_("could not stat '%s"), shared_index); + if (stat(shared_index_path, &st)) + return error_errno(_("could not stat '%s"), shared_index_path); if (st.st_mtime > expiration) return 0;
@@ -2255,13 +2254,15 @@ static int clean_shared_index_files(const char*current_hex)
while ((de = readdir(dir)) != NULL) {
const char *sha1_hex;
+ const char *shared_index_path;
if (!skip_prefix(de->d_name, "sharedindex.", &sha1_hex))
continue;
if (!strcmp(sha1_hex, current_hex))
continue;
- if (can_delete_shared_index(sha1_hex) > 0 &&
- unlink(git_path("%s", de->d_name)))
- error_errno(_("unable to unlink: %s"),
git_path("%s", de->d_name));
+ shared_index_path = git_path("%s", de->d_name);
+ if (can_delete_shared_index(shared_index_path) > 0 &&
+ unlink(shared_index_path))
+ error_errno(_("unable to unlink: %s"),
shared_index_path);
}
closedir(dir);