diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-05-17 10:19:09 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-05-17 19:33:39 +0200 |
commit | 97abaab5f6390ccb3e55c8b63c9087be7b1fc1d7 (patch) | |
tree | 6b6c75c1e7f25862626adbc8b83de1037a411382 /refs.h | |
parent | refs: pass repo when peeling objects (diff) | |
download | git-97abaab5f6390ccb3e55c8b63c9087be7b1fc1d7.tar.xz git-97abaab5f6390ccb3e55c8b63c9087be7b1fc1d7.zip |
refs: drop `git_default_branch_name()`
The `git_default_branch_name()` function is a thin wrapper around
`repo_default_branch_name()` with two differences:
- We implicitly rely on `the_repository`.
- We cache the default branch name.
None of the callsites of `git_default_branch_name()` are hot code paths
though, so the caching of the branch name is not really required.
Refactor the callsites to use `repo_default_branch_name()` instead and
drop `git_default_branch_name()`, thus getting rid of one more case
where we rely on `the_repository`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r-- | refs.h | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -169,10 +169,8 @@ int dwim_log(const char *str, int len, struct object_id *oid, char **ref); /* * Retrieves the default branch name for newly-initialized repositories. * - * The return value of `repo_default_branch_name()` is an allocated string. The - * return value of `git_default_branch_name()` is a singleton. + * The return value is an allocated string. */ -const char *git_default_branch_name(int quiet); char *repo_default_branch_name(struct repository *r, int quiet); /* |