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
6c9dc12b
Commit
6c9dc12b
authored
Apr 23, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1501 from xavier-l/packbuilder-commit
Added function to insert commit into pack
parents
9a9de29d
0b90366c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
include/git2/pack.h
+12
-0
src/pack-objects.c
+15
-0
No files found.
include/git2/pack.h
View file @
6c9dc12b
...
@@ -95,6 +95,18 @@ GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *id, c
...
@@ -95,6 +95,18 @@ GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *id, c
GIT_EXTERN
(
int
)
git_packbuilder_insert_tree
(
git_packbuilder
*
pb
,
const
git_oid
*
id
);
GIT_EXTERN
(
int
)
git_packbuilder_insert_tree
(
git_packbuilder
*
pb
,
const
git_oid
*
id
);
/**
/**
* Insert a commit object
*
* This will add a commit as well as the completed referenced tree.
*
* @param pb The packbuilder
* @param id The oid of the commit
*
* @return 0 or an error code
*/
GIT_EXTERN
(
int
)
git_packbuilder_insert_commit
(
git_packbuilder
*
pb
,
const
git_oid
*
id
);
/**
* Write the new pack and the corresponding index to path
* Write the new pack and the corresponding index to path
*
*
* @param pb The packbuilder
* @param pb The packbuilder
...
...
src/pack-objects.c
View file @
6c9dc12b
...
@@ -1284,6 +1284,21 @@ static int cb_tree_walk(const char *root, const git_tree_entry *entry, void *pay
...
@@ -1284,6 +1284,21 @@ static int cb_tree_walk(const char *root, const git_tree_entry *entry, void *pay
git_buf_cstr
(
&
ctx
->
buf
));
git_buf_cstr
(
&
ctx
->
buf
));
}
}
int
git_packbuilder_insert_commit
(
git_packbuilder
*
pb
,
const
git_oid
*
oid
)
{
git_commit
*
commit
;
if
(
git_commit_lookup
(
&
commit
,
pb
->
repo
,
oid
)
<
0
||
git_packbuilder_insert
(
pb
,
oid
,
NULL
)
<
0
)
return
-
1
;
if
(
git_packbuilder_insert_tree
(
pb
,
git_commit_tree_id
(
commit
))
<
0
)
return
-
1
;
git_commit_free
(
commit
);
return
0
;
}
int
git_packbuilder_insert_tree
(
git_packbuilder
*
pb
,
const
git_oid
*
oid
)
int
git_packbuilder_insert_tree
(
git_packbuilder
*
pb
,
const
git_oid
*
oid
)
{
{
git_tree
*
tree
;
git_tree
*
tree
;
...
...
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