Skip to content

Commit 87aace1

Browse files
pks-tgitster
authored andcommitted
config: pass repo to git_config_get_expiry()
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d8b7721 commit 87aace1

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

builtin/gc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ static void gc_config(void)
167167
git_config_get_bool("gc.autodetach", &detach_auto);
168168
git_config_get_bool("gc.cruftpacks", &cruft_packs);
169169
git_config_get_ulong("gc.maxcruftsize", &max_cruft_size);
170-
git_config_get_expiry("gc.pruneexpire", &prune_expire);
171-
git_config_get_expiry("gc.worktreepruneexpire", &prune_worktrees_expire);
172-
git_config_get_expiry("gc.logexpiry", &gc_log_expire);
170+
repo_config_get_expiry(the_repository, "gc.pruneexpire", &prune_expire);
171+
repo_config_get_expiry(the_repository, "gc.worktreepruneexpire", &prune_worktrees_expire);
172+
repo_config_get_expiry(the_repository, "gc.logexpiry", &gc_log_expire);
173173

174174
git_config_get_ulong("gc.bigpackthreshold", &big_pack_threshold);
175175
git_config_get_ulong("pack.deltacachesize", &max_delta_cache_size);

config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2766,9 +2766,9 @@ int git_config_get_pathname(const char *key, char **dest)
27662766
return repo_config_get_pathname(the_repository, key, dest);
27672767
}
27682768

2769-
int git_config_get_expiry(const char *key, const char **output)
2769+
int repo_config_get_expiry(struct repository *r, const char *key, const char **output)
27702770
{
2771-
int ret = git_config_get_string(key, (char **)output);
2771+
int ret = repo_config_get_string(r, key, (char **)output);
27722772
if (ret)
27732773
return ret;
27742774
if (strcmp(*output, "now")) {

config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ int repo_config_get_split_index(struct repository *r);
715715
int repo_config_get_max_percent_split_change(struct repository *r);
716716

717717
/* This dies if the configured or default date is in the future */
718-
int git_config_get_expiry(const char *key, const char **output);
718+
int repo_config_get_expiry(struct repository *r, const char *key, const char **output);
719719

720720
/* parse either "this many days" integer, or "5.days.ago" approxidate */
721721
int git_config_get_expiry_in_days(const char *key, timestamp_t *, timestamp_t now);

read-cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3184,8 +3184,8 @@ static unsigned long get_shared_index_expire_date(void)
31843184
static int shared_index_expire_date_prepared;
31853185

31863186
if (!shared_index_expire_date_prepared) {
3187-
git_config_get_expiry("splitindex.sharedindexexpire",
3188-
&shared_index_expire);
3187+
repo_config_get_expiry(the_repository, "splitindex.sharedindexexpire",
3188+
&shared_index_expire);
31893189
shared_index_expire_date = approxidate(shared_index_expire);
31903190
shared_index_expire_date_prepared = 1;
31913191
}

0 commit comments

Comments
 (0)