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
98fec8a9
Commit
98fec8a9
authored
Oct 22, 2013
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement `git_odb_object_dup`
parent
86774742
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
include/git2/odb.h
+14
-0
src/odb.c
+7
-0
No files found.
include/git2/odb.h
View file @
98fec8a9
...
...
@@ -358,6 +358,20 @@ GIT_EXTERN(int) git_odb_hash(git_oid *out, const void *data, size_t len, git_oty
GIT_EXTERN
(
int
)
git_odb_hashfile
(
git_oid
*
out
,
const
char
*
path
,
git_otype
type
);
/**
* Create a copy of an odb_object
*
* The returned copy must be manually freed with `git_odb_object_free`.
* Note that because of an implementation detail, the returned copy will be
* the same pointer as `source`: the object is internally refcounted, so the
* copy still needs to be freed twice.
*
* @param dest pointer where to store the copy
* @param source object to copy
* @return 0 or an error code
*/
GIT_EXTERN
(
int
)
git_odb_object_dup
(
git_odb_object
**
dest
,
git_odb_object
*
source
);
/**
* Close an ODB object
*
* This method must always be called once a `git_odb_object` is no
...
...
src/odb.c
View file @
98fec8a9
...
...
@@ -124,6 +124,13 @@ git_otype git_odb_object_type(git_odb_object *object)
return
object
->
cached
.
type
;
}
int
git_odb_object_dup
(
git_odb_object
**
dest
,
git_odb_object
*
source
)
{
git_cached_obj_incref
(
source
);
*
dest
=
source
;
return
0
;
}
void
git_odb_object_free
(
git_odb_object
*
object
)
{
if
(
object
==
NULL
)
...
...
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