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
7560ac4d
Commit
7560ac4d
authored
Jul 11, 2022
by
yuangli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches: fix error message for invalid name
parent
724b5a0e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
src/branch.c
+7
-7
No files found.
src/branch.c
View file @
7560ac4d
...
...
@@ -54,6 +54,12 @@ static int not_a_local_branch(const char *reference_name)
static
bool
branch_name_follows_pattern
(
const
char
*
branch_name
)
{
/*
* Discourage branch name starting with dash,
* https://github.com/git/git/commit/6348624010888b
* and discourage HEAD as branch name,
* https://github.com/git/git/commit/a625b092cc5994
*/
return
branch_name
[
0
]
!=
'-'
&&
git__strcmp
(
branch_name
,
"HEAD"
);
}
...
...
@@ -78,7 +84,7 @@ static int create_branch(
GIT_ASSERT_ARG
(
git_commit_owner
(
commit
)
==
repository
);
if
(
!
branch_name_follows_pattern
(
branch_name
))
{
git_error_set
(
GIT_ERROR_REFERENCE
,
"'
HEAD' is not a valid branch name"
);
git_error_set
(
GIT_ERROR_REFERENCE
,
"'
%s' is not a valid branch name"
,
branch_name
);
error
=
-
1
;
goto
cleanup
;
}
...
...
@@ -761,12 +767,6 @@ int git_branch_name_is_valid(int *valid, const char *name)
*
valid
=
0
;
/*
* Discourage branch name starting with dash,
* https://github.com/git/git/commit/6348624010888b
* and discourage HEAD as branch name,
* https://github.com/git/git/commit/a625b092cc5994
*/
if
(
!
name
||
!
branch_name_follows_pattern
(
name
))
goto
done
;
...
...
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