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
c11daac9
Commit
c11daac9
authored
May 22, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3151 from ethomson/thinpack
Thin packs: don't
parents
2540487f
e2dd3735
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletions
+21
-1
src/indexer.c
+14
-1
src/pack.c
+7
-0
No files found.
src/indexer.c
View file @
c11daac9
...
...
@@ -325,6 +325,13 @@ on_error:
return
-
1
;
}
GIT_INLINE
(
bool
)
has_entry
(
git_indexer
*
idx
,
git_oid
*
id
)
{
khiter_t
k
;
k
=
kh_get
(
oid
,
idx
->
pack
->
idx_cache
,
id
);
return
(
k
!=
kh_end
(
idx
->
pack
->
idx_cache
));
}
static
int
save_entry
(
git_indexer
*
idx
,
struct
entry
*
entry
,
struct
git_pack_entry
*
pentry
,
git_off_t
entry_start
)
{
int
i
,
error
;
...
...
@@ -339,8 +346,11 @@ static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_ent
pentry
->
offset
=
entry_start
;
k
=
kh_put
(
oid
,
idx
->
pack
->
idx_cache
,
&
pentry
->
sha1
,
&
error
);
if
(
!
error
)
if
(
error
<=
0
)
{
giterr_set
(
GITERR_INDEXER
,
"cannot insert object into pack"
);
return
-
1
;
}
kh_value
(
idx
->
pack
->
idx_cache
,
k
)
=
pentry
;
...
...
@@ -791,6 +801,9 @@ static int fix_thin_pack(git_indexer *idx, git_transfer_progress *stats)
git_oid_fromraw
(
&
base
,
base_info
);
git_mwindow_close
(
&
w
);
if
(
has_entry
(
idx
,
&
base
))
return
0
;
if
(
inject_object
(
idx
,
&
base
)
<
0
)
return
-
1
;
...
...
src/pack.c
View file @
c11daac9
...
...
@@ -959,8 +959,15 @@ git_off_t get_delta_base(
if
(
k
!=
kh_end
(
p
->
idx_cache
))
{
*
curpos
+=
20
;
return
((
struct
git_pack_entry
*
)
kh_value
(
p
->
idx_cache
,
k
))
->
offset
;
}
else
{
/* If we're building an index, don't try to find the pack
* entry; we just haven't seen it yet. We'll make
* progress again in the next loop.
*/
return
GIT_PASSTHROUGH
;
}
}
/* The base entry _must_ be in the same pack */
if
(
pack_entry_find_offset
(
&
base_offset
,
&
unused
,
p
,
(
git_oid
*
)
base_info
,
GIT_OID_HEXSZ
)
<
0
)
return
packfile_error
(
"base entry delta is not in the same pack"
);
...
...
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