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
bef2a12c
Commit
bef2a12c
authored
Mar 19, 2013
by
Philip Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert enqueue_object to a function
parent
799f9a04
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
21 deletions
+19
-21
src/push.c
+19
-21
No files found.
src/push.c
View file @
bef2a12c
...
...
@@ -347,6 +347,20 @@ on_error:
return
error
==
GIT_ITEROVER
?
0
:
error
;
}
static
int
enqueue_object
(
const
git_tree_entry
*
entry
,
git_packbuilder
*
pb
)
{
switch
(
git_tree_entry_type
(
entry
))
{
case
GIT_OBJ_COMMIT
:
return
0
;
case
GIT_OBJ_TREE
:
return
git_packbuilder_insert_tree
(
pb
,
&
entry
->
oid
);
default:
return
git_packbuilder_insert
(
pb
,
&
entry
->
oid
,
entry
->
filename
);
}
}
static
int
queue_differences
(
git_tree
*
base
,
git_tree
*
delta
,
...
...
@@ -358,22 +372,6 @@ static int queue_differences(
size_t
i
=
0
,
j
=
0
;
int
error
;
#define _enqueue_object(ENTRY) do { \
switch (git_tree_entry_type((ENTRY))) { \
case GIT_OBJ_COMMIT: \
break; \
case GIT_OBJ_TREE: \
if ((error = git_packbuilder_insert_tree(pb, &(ENTRY)->oid)) < 0) \
goto on_error; \
break; \
default: \
if ((error = git_packbuilder_insert(pb, &(ENTRY)->oid, \
(ENTRY)->filename)) < 0) \
goto on_error; \
break; \
} \
} while (0)
while
(
i
<
b_length
&&
j
<
d_length
)
{
const
git_tree_entry
*
b_entry
=
git_tree_entry_byindex
(
base
,
i
);
const
git_tree_entry
*
d_entry
=
git_tree_entry_byindex
(
delta
,
j
);
...
...
@@ -409,8 +407,9 @@ static int queue_differences(
}
/* If the object is new or different in the right-hand tree,
* then enumerate it */
else
if
(
cmp
>=
0
)
_enqueue_object
(
d_entry
);
else
if
(
cmp
>=
0
&&
(
error
=
enqueue_object
(
d_entry
,
pb
))
<
0
)
goto
on_error
;
loop:
if
(
cmp
<=
0
)
i
++
;
...
...
@@ -419,9 +418,8 @@ static int queue_differences(
/* Drain the right-hand tree of entries */
for
(;
j
<
d_length
;
j
++
)
_enqueue_object
(
git_tree_entry_byindex
(
delta
,
j
));
#undef _enqueue_object
if
((
error
=
enqueue_object
(
git_tree_entry_byindex
(
delta
,
j
),
pb
))
<
0
)
goto
on_error
;
error
=
0
;
...
...
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