summaryrefslogtreecommitdiffstats
path: root/config.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-08-16 12:44:57 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-16 18:46:24 +0200
commita70a9bf6eec832b808a805de318601684b19f18e (patch)
treeaca5b36515a0cf6fc94eec7e2cdf6573fb29f6dd /config.h
parentThe third batch (diff)
downloadgit-a70a9bf6eec832b808a805de318601684b19f18e.tar.xz
git-a70a9bf6eec832b808a805de318601684b19f18e.zip
config: fix constness of out parameter for `git_config_get_expiry()`
The type of the out parameter of `git_config_get_expiry()` is a pointer to a constant string, which creates the impression that ownership of the returned data wasn't transferred to the caller. This isn't true though and thus quite misleading. Adapt the parameter to be of type `char **` and adjust callers accordingly. While at it, refactor `get_shared_index_expire_date()` to drop the static `shared_index_expire` variable. It is only used in that function, and furthermore we would only hit the code where we parse the expiry date a single time because we already use a static `prepared` variable to track whether we did parse it. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.h')
-rw-r--r--config.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/config.h b/config.h
index 54b47dec9e..4801391c32 100644
--- a/config.h
+++ b/config.h
@@ -701,7 +701,7 @@ int git_config_get_split_index(void);
int git_config_get_max_percent_split_change(void);
/* This dies if the configured or default date is in the future */
-int git_config_get_expiry(const char *key, const char **output);
+int git_config_get_expiry(const char *key, 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);