diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2020-10-11 13:20:52 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2020-10-25 16:33:27 +0000 |
| commit | b52bb4d4b2548d0c7f00de0eab5073cc8fe9e899 (patch) | |
| tree | 89b5bc95613013bc79e922ad7de85135dbcbd534 /src/repository.c | |
| parent | 29715d4082ef97d54ce2bf24943425f558335796 (diff) | |
| download | libgit2-b52bb4d4b2548d0c7f00de0eab5073cc8fe9e899.tar.gz | |
refs: use git_reference_name_is_valid
Diffstat (limited to 'src/repository.c')
| -rw-r--r-- | src/repository.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/repository.c b/src/repository.c index 513dbd61f..f0d4b06aa 100644 --- a/src/repository.c +++ b/src/repository.c @@ -2359,7 +2359,7 @@ int git_repository_initialbranch(git_buf *out, git_repository *repo) git_config *config; git_config_entry *entry = NULL; const char *branch; - int error; + int valid, error; if ((error = git_repository_config__weakptr(&config, repo)) < 0) return error; @@ -2375,10 +2375,11 @@ int git_repository_initialbranch(git_buf *out, git_repository *repo) } if ((error = git_buf_puts(out, GIT_REFS_HEADS_DIR)) < 0 || - (error = git_buf_puts(out, branch)) < 0) + (error = git_buf_puts(out, branch)) < 0 || + (error = git_reference_name_is_valid(&valid, out->ptr)) < 0) goto done; - if (!git_reference_is_valid_name(out->ptr)) { + if (!valid) { git_error_set(GIT_ERROR_INVALID, "the value of init.defaultBranch is not a valid reference name"); error = -1; } |
