diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-09-12 13:30:24 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-09-12 10:15:44 -0700 |
| commit | 11dbb4ace3ac428574fadf6f7895f56aba9dca81 (patch) | |
| tree | ca7a3d3afd87150d5fb2f369a52fb97da6b829cb /builtin/rev-parse.c | |
| parent | environment: stop storing "core.preferSymlinkRefs" globally (diff) | |
| download | git-11dbb4ace3ac428574fadf6f7895f56aba9dca81.tar.gz git-11dbb4ace3ac428574fadf6f7895f56aba9dca81.zip | |
environment: stop storing "core.warnAmbiguousRefs" globally
Same as the preceding commits, storing the "core.warnAmbiguousRefs"
value globally is misdesigned as this setting may be set per repository.
Move the logic into the repo-settings subsystem. The usual pattern here
is that users are expected to call `prepare_repo_settings()` before they
access the settings themselves. This seems somewhat fragile though, as
it is easy to miss and leads to somewhat ugly code patterns at the call
sites.
Instead, introduce a new function that encapsulates this logic for us.
This also allows us to change how exactly the lazy initialization works
in the future, e.g. by only partially initializing values as requested
by the caller.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rev-parse.c')
| -rw-r--r-- | builtin/rev-parse.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index a5108266da..34b4675442 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -19,6 +19,7 @@ #include "path.h" #include "diff.h" #include "read-cache-ll.h" +#include "repo-settings.h" #include "repository.h" #include "revision.h" #include "setup.h" @@ -899,7 +900,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) } if (opt_with_value(arg, "--abbrev-ref", &arg)) { abbrev_ref = 1; - abbrev_ref_strict = warn_ambiguous_refs; + abbrev_ref_strict = + repo_settings_get_warn_ambiguous_refs(the_repository); if (arg) { if (!strcmp(arg, "strict")) abbrev_ref_strict = 1; |
