]> git.ipfire.org Git - thirdparty/git.git/commitdiff
config: pass repo to `git_config_get_expiry()`
authorPatrick Steinhardt <ps@pks.im>
Tue, 13 Aug 2024 09:13:59 +0000 (11:13 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Aug 2024 17:01:03 +0000 (10:01 -0700)
Refactor `git_config_get_expiry()` to accept a `struct repository` such
that we can get rid of the implicit dependency on `the_repository`.
Rename the function accordingly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/gc.c
config.c
config.h
read-cache.c

index 2ca6288c6bd9150c1c65521ae8670dd3970d6d22..dc87c659061006915149fc04c7168730b9aecb43 100644 (file)
@@ -167,9 +167,9 @@ static void gc_config(void)
        git_config_get_bool("gc.autodetach", &detach_auto);
        git_config_get_bool("gc.cruftpacks", &cruft_packs);
        git_config_get_ulong("gc.maxcruftsize", &max_cruft_size);
-       git_config_get_expiry("gc.pruneexpire", &prune_expire);
-       git_config_get_expiry("gc.worktreepruneexpire", &prune_worktrees_expire);
-       git_config_get_expiry("gc.logexpiry", &gc_log_expire);
+       repo_config_get_expiry(the_repository, "gc.pruneexpire", &prune_expire);
+       repo_config_get_expiry(the_repository, "gc.worktreepruneexpire", &prune_worktrees_expire);
+       repo_config_get_expiry(the_repository, "gc.logexpiry", &gc_log_expire);
 
        git_config_get_ulong("gc.bigpackthreshold", &big_pack_threshold);
        git_config_get_ulong("pack.deltacachesize", &max_delta_cache_size);
index f1d2fb6d4c0c7f530221fe86a9cbd0ea1ab5263c..4138dc50ce8e2e40d154555dae75b61c2707fa7e 100644 (file)
--- a/config.c
+++ b/config.c
@@ -2766,9 +2766,9 @@ int git_config_get_pathname(const char *key, char **dest)
        return repo_config_get_pathname(the_repository, key, dest);
 }
 
-int git_config_get_expiry(const char *key, const char **output)
+int repo_config_get_expiry(struct repository *r, const char *key, const char **output)
 {
-       int ret = git_config_get_string(key, (char **)output);
+       int ret = repo_config_get_string(r, key, (char **)output);
        if (ret)
                return ret;
        if (strcmp(*output, "now")) {
index dd7127b8e979a15fc0dd6490242b0feb050c32ff..7674617a1db9959fb05ba4fc17fcf1efd03a3df4 100644 (file)
--- a/config.h
+++ b/config.h
@@ -715,7 +715,7 @@ int repo_config_get_split_index(struct repository *r);
 int repo_config_get_max_percent_split_change(struct repository *r);
 
 /* This dies if the configured or default date is in the future */
-int git_config_get_expiry(const char *key, const char **output);
+int repo_config_get_expiry(struct repository *r, const char *key, const char **output);
 
 /* parse either "this many days" integer, or "5.days.ago" approxidate */
 int git_config_get_expiry_in_days(const char *key, timestamp_t *, timestamp_t now);
index 1e52db7f36f3d9d6ad0cdafbb073aa6d2fd36d71..18394d7180d130254c45e80a33ee07b88584c640 100644 (file)
@@ -3184,8 +3184,8 @@ static unsigned long get_shared_index_expire_date(void)
        static int shared_index_expire_date_prepared;
 
        if (!shared_index_expire_date_prepared) {
-               git_config_get_expiry("splitindex.sharedindexexpire",
-                                     &shared_index_expire);
+               repo_config_get_expiry(the_repository, "splitindex.sharedindexexpire",
+                                      &shared_index_expire);
                shared_index_expire_date = approxidate(shared_index_expire);
                shared_index_expire_date_prepared = 1;
        }