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
7c8a7b91
Commit
7c8a7b91
authored
Mar 15, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip the optional header in packed-refs files
parent
7064938b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
src/refs.c
+10
-16
No files found.
src/refs.c
View file @
7c8a7b91
...
...
@@ -507,22 +507,14 @@ static int packed_load(git_repository *repo)
buffer_start
=
(
const
char
*
)
packfile
.
data
;
buffer_end
=
(
const
char
*
)(
buffer_start
)
+
packfile
.
len
;
/* Does the header look like valid? */
if
(
git__prefixcmp
((
const
char
*
)(
buffer_start
),
GIT_PACKEDREFS_HEADER
))
{
error
=
GIT_EPACKEDREFSCORRUPTED
;
goto
cleanup
;
}
/* Let's skip the header */
buffer_start
+=
strlen
(
GIT_PACKEDREFS_HEADER
);
if
(
*
buffer_start
==
'\r'
)
while
(
buffer_start
<
buffer_end
&&
buffer_start
[
0
]
==
'#'
)
{
buffer_start
=
strchr
(
buffer_start
,
'\n'
);
if
(
buffer_start
==
NULL
)
{
error
=
GIT_EPACKEDREFSCORRUPTED
;
goto
cleanup
;
}
buffer_start
++
;
if
(
*
buffer_start
!=
'\n'
)
return
GIT_EPACKEDREFSCORRUPTED
;
buffer_start
++
;
}
while
(
buffer_start
<
buffer_end
)
{
reference_oid
*
ref
=
NULL
;
...
...
@@ -810,7 +802,9 @@ static int packed_write(git_repository *repo)
if
((
error
=
git_filebuf_open
(
&
pack_file
,
pack_file_path
,
0
))
<
GIT_SUCCESS
)
return
error
;
/* Packfiles have a header! */
/* Packfiles have a header... apparently
* This is in fact not required, but we might as well print it
* just for kicks */
if
((
error
=
git_filebuf_printf
(
&
pack_file
,
"%s
\n
"
,
GIT_PACKEDREFS_HEADER
))
<
GIT_SUCCESS
)
return
error
;
...
...
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