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>
This commit is contained in:

committed by
Junio C Hamano

parent
30aaff437f
commit
97abaab5f6
10
refs.c
10
refs.c
@ -664,16 +664,6 @@ char *repo_default_branch_name(struct repository *r, int quiet)
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char *git_default_branch_name(int quiet)
|
||||
{
|
||||
static char *ret;
|
||||
|
||||
if (!ret)
|
||||
ret = repo_default_branch_name(the_repository, quiet);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* *string and *len will only be substituted, and *string returned (for
|
||||
* later free()ing) if the string passed in is a magic short-hand form
|
||||
|
Reference in New Issue
Block a user