Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
ethomson authored Jul 13, 2022
1 parent 760a5ac commit f6be8c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/libgit2/branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 ||
Expand Down
6 changes: 3 additions & 3 deletions src/libgit2/tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ static int write_tag_annotation(
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,
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 ||
Expand Down

0 comments on commit f6be8c2

Please sign in to comment.