diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-01-07 14:05:02 +0000 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-01-07 14:05:02 +0000 |
commit | 3f4bc2132c933e1a1719555dde1207d4896f7a12 (patch) | |
tree | aa61bf27654e3a6c1cd3d97cb982f749a1d0dc57 /src | |
parent | 32350e89d8e3ca245def9ccee05aa21c92e10726 (diff) | |
download | libgit2-ethomson/empty_default_branch.tar.gz |
repo: ignore empty init.defaultbranchethomson/empty_default_branch
The init.defaultbranch option may be set, but empty. In this case, we
should ignore it instead of trying to set our default branch to
`refs/heads/`.
Diffstat (limited to 'src')
-rw-r--r-- | src/repository.c | 3 |
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; } |