From cfe3917c85f38c3367de7b6f5838ecaf6d1e148d Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Sat, 22 Feb 2020 20:17:37 +0000 Subject: setup: allow check_repository_format to read repository format In some cases, we will want to not only check the repository format, but extract the information that we've gained. To do so, allow check_repository_format to take a pointer to struct repository_format. Allow passing NULL for this argument if we're not interested in the information, and pass NULL for all existing callers. A future patch will make use of this information. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- setup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'setup.c') diff --git a/setup.c b/setup.c index 4ea7a0b081..af20c3d7c0 100644 --- a/setup.c +++ b/setup.c @@ -1253,10 +1253,12 @@ int git_config_perm(const char *var, const char *value) return -(i & 0666); } -void check_repository_format(void) +void check_repository_format(struct repository_format *fmt) { struct repository_format repo_fmt = REPOSITORY_FORMAT_INIT; - check_repository_format_gently(get_git_dir(), &repo_fmt, NULL); + if (!fmt) + fmt = &repo_fmt; + check_repository_format_gently(get_git_dir(), fmt, NULL); startup_info->have_repository = 1; clear_repository_format(&repo_fmt); } -- cgit v1.3