Unverified Commit f6be8c26 by Edward Thomson Committed by GitHub

Apply suggestions from code review

parent 760a5acc
...@@ -53,7 +53,7 @@ static int not_a_local_branch(const char *reference_name) ...@@ -53,7 +53,7 @@ static int not_a_local_branch(const char *reference_name)
return -1; 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, * Discourage branch name starting with dash,
...@@ -84,7 +84,7 @@ static int create_branch( ...@@ -84,7 +84,7 @@ static int create_branch(
GIT_ASSERT_ARG(ref_out); GIT_ASSERT_ARG(ref_out);
GIT_ASSERT_ARG(git_commit_owner(commit) == repository); 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); git_error_set(GIT_ERROR_REFERENCE, "'%s' is not a valid branch name", branch_name);
error = -1; error = -1;
goto cleanup; goto cleanup;
...@@ -808,7 +808,7 @@ int git_branch_name_is_valid(int *valid, const char *name) ...@@ -808,7 +808,7 @@ int git_branch_name_is_valid(int *valid, const char *name)
*valid = 0; *valid = 0;
if (!name || !branch_name_follows_pattern(name)) if (!name || !branch_name_is_valid(name))
goto done; goto done;
if ((error = git_str_puts(&ref_name, GIT_REFS_HEADS_DIR)) < 0 || if ((error = git_str_puts(&ref_name, GIT_REFS_HEADS_DIR)) < 0 ||
......
...@@ -244,7 +244,7 @@ on_error: ...@@ -244,7 +244,7 @@ on_error:
return -1; 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, * Discourage tag name starting with dash,
...@@ -278,7 +278,7 @@ static int git_tag_create__internal( ...@@ -278,7 +278,7 @@ static int git_tag_create__internal(
return -1; 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); git_error_set(GIT_ERROR_TAG, "'%s' is not a valid tag name", tag_name);
return -1; return -1;
} }
...@@ -554,7 +554,7 @@ int git_tag_name_is_valid(int *valid, const char *name) ...@@ -554,7 +554,7 @@ int git_tag_name_is_valid(int *valid, const char *name)
GIT_ASSERT(valid); GIT_ASSERT(valid);
if (!name || !tag_name_follows_pattern(name)) if (!name || !tag_name_is_valid(name))
goto done; goto done;
if ((error = git_str_puts(&ref_name, GIT_REFS_TAGS_DIR)) < 0 || if ((error = git_str_puts(&ref_name, GIT_REFS_TAGS_DIR)) < 0 ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment