From d24eda4e03cabbd39ce06827d47e52a97b9095db Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Tue, 6 Jun 2023 13:24:35 +0000 Subject: repository: create disable_replace_refs() Several builtins depend on being able to disable the replace references so we actually operate on each object individually. These currently do so by directly mutating the 'read_replace_refs' global. A future change will move this global into a different place, so it will be necessary to change all of these lines. However, we can simplify that transition by abstracting the purpose of these global assignments with a method call. We will need to keep this read_replace_refs global forever, as we want to make sure that we never use replace refs throughout the life of the process if this method is called. Future changes may present a repository-scoped version of the variable to represent that repository's core.useReplaceRefs config value, but a zero-valued read_replace_refs will always override such a setting. Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- replace-object.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'replace-object.h') diff --git a/replace-object.h b/replace-object.h index 500482b02b..7786d4152b 100644 --- a/replace-object.h +++ b/replace-object.h @@ -48,4 +48,12 @@ static inline const struct object_id *lookup_replace_object(struct repository *r return do_lookup_replace_object(r, oid); } +/* + * Some commands override config and environment settings for using + * replace references. Use this method to disable the setting and ensure + * those other settings will not override this choice. This applies + * globally to all in-process repositories. + */ +void disable_replace_refs(void); + #endif /* REPLACE_OBJECT_H */ -- cgit v1.2.3