summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index fa01153151..392f0bbf68 100644
--- a/refs.c
+++ b/refs.c
@@ -567,8 +567,11 @@ char *repo_default_branch_name(struct repository *r)
const char *config_key = "init.defaultbranch";
const char *config_display_key = "init.defaultBranch";
char *ret = NULL, *full_ref;
+ const char *env = getenv("GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME");
- if (repo_config_get_string(r, config_key, &ret) < 0)
+ if (env && *env)
+ ret = xstrdup(env);
+ else if (repo_config_get_string(r, config_key, &ret) < 0)
die(_("could not retrieve `%s`"), config_display_key);
if (!ret)