mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
Apply suggestions from code review
This commit is contained in:
@@ -53,7 +53,7 @@ static int not_a_local_branch(const char *reference_name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static bool branch_name_follows_pattern(const char *branch_name)
|
||||
static bool branch_name_is_valid(const char *branch_name)
|
||||
{
|
||||
/*
|
||||
* Discourage branch name starting with dash,
|
||||
@@ -84,7 +84,7 @@ static int create_branch(
|
||||
GIT_ASSERT_ARG(ref_out);
|
||||
GIT_ASSERT_ARG(git_commit_owner(commit) == repository);
|
||||
|
||||
if (!branch_name_follows_pattern(branch_name)) {
|
||||
if (!branch_name_is_valid(branch_name)) {
|
||||
git_error_set(GIT_ERROR_REFERENCE, "'%s' is not a valid branch name", branch_name);
|
||||
error = -1;
|
||||
goto cleanup;
|
||||
@@ -808,7 +808,7 @@ int git_branch_name_is_valid(int *valid, const char *name)
|
||||
|
||||
*valid = 0;
|
||||
|
||||
if (!name || !branch_name_follows_pattern(name))
|
||||
if (!name || !branch_name_is_valid(name))
|
||||
goto done;
|
||||
|
||||
if ((error = git_str_puts(&ref_name, GIT_REFS_HEADS_DIR)) < 0 ||
|
||||
|
||||
@@ -244,7 +244,7 @@ on_error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static bool tag_name_follows_pattern(const char *tag_name)
|
||||
static bool tag_name_is_valid(const char *tag_name)
|
||||
{
|
||||
/*
|
||||
* Discourage tag name starting with dash,
|
||||
@@ -278,7 +278,7 @@ static int git_tag_create__internal(
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!tag_name_follows_pattern(tag_name)) {
|
||||
if (!tag_name_is_valid(tag_name)) {
|
||||
git_error_set(GIT_ERROR_TAG, "'%s' is not a valid tag name", tag_name);
|
||||
return -1;
|
||||
}
|
||||
@@ -554,7 +554,7 @@ int git_tag_name_is_valid(int *valid, const char *name)
|
||||
|
||||
GIT_ASSERT(valid);
|
||||
|
||||
if (!name || !tag_name_follows_pattern(name))
|
||||
if (!name || !tag_name_is_valid(name))
|
||||
goto done;
|
||||
|
||||
if ((error = git_str_puts(&ref_name, GIT_REFS_TAGS_DIR)) < 0 ||
|
||||
|
||||
Reference in New Issue
Block a user