Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
f6be8c26
Unverified
Commit
f6be8c26
authored
Jul 12, 2022
by
Edward Thomson
Committed by
GitHub
Jul 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply suggestions from code review
parent
760a5acc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
src/libgit2/branch.c
+3
-3
src/libgit2/tag.c
+3
-3
No files found.
src/libgit2/branch.c
View file @
f6be8c26
...
...
@@ -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
||
...
...
src/libgit2/tag.c
View file @
f6be8c26
...
...
@@ -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
||
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment