summaryrefslogtreecommitdiff
path: root/src/repository.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/repository.c')
-rw-r--r--src/repository.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/repository.c b/src/repository.c
index 948413d17..de1a89582 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -2092,7 +2092,8 @@ static int repo_init_head(const char *repo_dir, const char *given)
if (given) {
initial_head = given;
} else if ((error = git_config_open_default(&cfg)) >= 0 &&
- (error = git_config_get_string_buf(&cfg_branch, cfg, "init.defaultbranch")) >= 0) {
+ (error = git_config_get_string_buf(&cfg_branch, cfg, "init.defaultbranch")) >= 0 &&
+ *cfg_branch.ptr) {
initial_head = cfg_branch.ptr;
}