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
cb35094b
Commit
cb35094b
authored
Jan 22, 2013
by
Scott J. Goldman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow peeled references without trailing newline at end of file
Also ammends one of the tag tests to make sure it's working.
parent
2a707d0e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
src/refs.c
+8
-4
tests-clar/object/tag/read.c
+4
-0
tests-clar/resources/bad_tag.git/packed-refs
+3
-0
No files found.
src/refs.c
View file @
cb35094b
...
...
@@ -328,7 +328,7 @@ static int packed_parse_peel(
if
(
git__prefixcmp
(
tag_ref
->
name
,
GIT_REFS_TAGS_DIR
)
!=
0
)
goto
corrupt
;
if
(
buffer
+
GIT_OID_HEXSZ
>
=
buffer_end
)
if
(
buffer
+
GIT_OID_HEXSZ
>
buffer_end
)
goto
corrupt
;
/* Is this a valid object id? */
...
...
@@ -339,10 +339,14 @@ static int packed_parse_peel(
if
(
*
buffer
==
'\r'
)
buffer
++
;
if
(
*
buffer
!=
'\n'
)
goto
corrupt
;
if
(
buffer
!=
buffer_end
)
{
if
(
*
buffer
==
'\n'
)
buffer
++
;
else
goto
corrupt
;
}
*
buffer_out
=
buffer
+
1
;
*
buffer_out
=
buffer
;
return
0
;
corrupt:
...
...
tests-clar/object/tag/read.c
View file @
cb35094b
...
...
@@ -62,6 +62,7 @@ void test_object_tag_read__parse_without_tagger(void)
git_tag
*
bad_tag
;
git_commit
*
commit
;
git_oid
id
,
id_commit
;
git_strarray
ref_list
;
// TODO: This is a little messy
cl_git_pass
(
git_repository_open
(
&
bad_tag_repo
,
cl_fixture
(
"bad_tag.git"
)));
...
...
@@ -81,6 +82,9 @@ void test_object_tag_read__parse_without_tagger(void)
cl_assert
(
git_oid_cmp
(
&
id_commit
,
git_commit_id
(
commit
))
==
0
);
cl_git_pass
(
git_reference_list
(
&
ref_list
,
bad_tag_repo
,
GIT_REF_LISTALL
));
git_strarray_free
(
&
ref_list
);
git_tag_free
(
bad_tag
);
git_commit_free
(
commit
);
git_repository_free
(
bad_tag_repo
);
...
...
tests-clar/resources/bad_tag.git/packed-refs
View file @
cb35094b
# pack-refs with: peeled
eda9f45a2a98d4c17a09d681d88569fa4ea91755 refs/tags/e90810b
^e90810b8df3e80c413d903f631643c716887138d
d3bacb8d3ff25876a961b1963b6515170d0151ab refs/tags/hello
^6dcf9bf7541ee10456529833502442f385010c3d
\ No newline at end of file
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