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
3e8c5e45
Commit
3e8c5e45
authored
Jun 10, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3174 from libgit2/cmn/idx-fill-hole
indexer: use lseek to extend the packfile
parents
7f8cd672
aa57231f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
src/indexer.c
+4
-3
No files found.
src/indexer.c
View file @
3e8c5e45
...
...
@@ -478,13 +478,14 @@ static int write_at(git_indexer *idx, const void *data, git_off_t offset, size_t
static
int
append_to_pack
(
git_indexer
*
idx
,
const
void
*
data
,
size_t
size
)
{
git_off_t
current_size
=
idx
->
pack
->
mwf
.
size
;
int
fd
=
idx
->
pack
->
mwf
.
fd
;
if
(
!
size
)
return
0
;
/* add the extra space we need at the end */
if
(
p_ftruncate
(
idx
->
pack
->
mwf
.
fd
,
current_size
+
size
)
<
0
)
{
giterr_set
(
GITERR_OS
,
"
Failed to increase size of pack
file '%s'"
,
idx
->
pack
->
pack_name
);
if
(
p_lseek
(
fd
,
current_size
+
size
-
1
,
SEEK_SET
)
<
0
||
p_write
(
idx
->
pack
->
mwf
.
fd
,
data
,
1
)
<
0
)
{
giterr_set
(
GITERR_OS
,
"
cannot extend pack
file '%s'"
,
idx
->
pack
->
pack_name
);
return
-
1
;
}
...
...
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