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
87c9b741
Commit
87c9b741
authored
Apr 24, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2295 from libgit2/cmn/fetchhead-quote
fetchhead: deal with quotes in branch names
parents
212b6205
bdc82e1c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletions
+13
-1
src/fetchhead.c
+1
-1
tests/fetchhead/fetchhead_data.h
+3
-0
tests/fetchhead/nonetwork.c
+9
-0
No files found.
src/fetchhead.c
View file @
87c9b741
...
...
@@ -210,7 +210,7 @@ static int fetchhead_ref_parse(
name
=
desc
+
1
;
if
(
name
)
{
if
((
desc
=
str
chr
(
name
,
'\''
))
==
NULL
||
if
((
desc
=
str
str
(
name
,
"' "
))
==
NULL
||
git__prefixcmp
(
desc
,
"' of "
)
!=
0
)
{
giterr_set
(
GITERR_FETCHHEAD
,
"Invalid description in FETCH_HEAD line %d"
,
line_num
);
...
...
tests/fetchhead/fetchhead_data.h
View file @
87c9b741
...
...
@@ -28,3 +28,6 @@
#define FETCH_HEAD_EXPLICIT_DATA \
"0966a434eb1a025db6b71485ab63a3bfbea520b6\t\tbranch 'first-merge' of git://github.com/libgit2/TestGitRepository\n"
#define FETCH_HEAD_QUOTE_DATA \
"0966a434eb1a025db6b71485ab63a3bfbea520b6\t\tbranch 'first's-merge' of git://github.com/libgit2/TestGitRepository\n"
tests/fetchhead/nonetwork.c
View file @
87c9b741
...
...
@@ -343,3 +343,12 @@ void test_fetchhead_nonetwork__unborn_with_upstream(void)
git_repository_free
(
repo
);
cl_fixture_cleanup
(
"./repowithunborn"
);
}
void
test_fetchhead_nonetwork__quote_in_branch_name
(
void
)
{
cl_set_cleanup
(
&
cleanup_repository
,
"./test1"
);
cl_git_pass
(
git_repository_init
(
&
g_repo
,
"./test1"
,
0
));
cl_git_rewritefile
(
"./test1/.git/FETCH_HEAD"
,
FETCH_HEAD_QUOTE_DATA
);
cl_git_pass
(
git_repository_fetchhead_foreach
(
g_repo
,
read_noop
,
NULL
));
}
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