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
575a54db
Commit
575a54db
authored
Apr 10, 2013
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
object: Export git_object_dup
parent
90431f1b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
16 deletions
+19
-16
include/git2/object.h
+9
-0
src/iterator.c
+1
-1
src/object.c
+7
-1
src/object.h
+0
-7
src/refs.c
+1
-1
src/revparse.c
+1
-1
src/tree.h
+0
-5
No files found.
include/git2/object.h
View file @
575a54db
...
@@ -188,6 +188,15 @@ GIT_EXTERN(int) git_object_peel(
...
@@ -188,6 +188,15 @@ GIT_EXTERN(int) git_object_peel(
const
git_object
*
object
,
const
git_object
*
object
,
git_otype
target_type
);
git_otype
target_type
);
/**
* Create an in-memory copy of a Git object. The copy must be
* explicitly free'd or it will leak.
*
* @param dest Pointer to store the copy of the object
* @param source Original object to copy
*/
GIT_EXTERN
(
int
)
git_object_dup
(
git_object
**
dest
,
git_object
*
source
);
/** @} */
/** @} */
GIT_END_DECL
GIT_END_DECL
...
...
src/iterator.c
View file @
575a54db
...
@@ -578,7 +578,7 @@ int git_iterator_for_tree(
...
@@ -578,7 +578,7 @@ int git_iterator_for_tree(
if
(
tree
==
NULL
)
if
(
tree
==
NULL
)
return
git_iterator_for_nothing
(
iter
,
flags
,
start
,
end
);
return
git_iterator_for_nothing
(
iter
,
flags
,
start
,
end
);
if
((
error
=
git_
tree__dup
(
&
tree
,
tree
))
<
0
)
if
((
error
=
git_
object_dup
((
git_object
**
)
&
tree
,
(
git_object
*
)
tree
))
<
0
)
return
error
;
return
error
;
ITERATOR_BASE_INIT
(
ti
,
tree
,
TREE
,
git_tree_owner
(
tree
));
ITERATOR_BASE_INIT
(
ti
,
tree
,
TREE
,
git_tree_owner
(
tree
));
...
...
src/object.c
View file @
575a54db
...
@@ -360,7 +360,7 @@ int git_object_peel(
...
@@ -360,7 +360,7 @@ int git_object_peel(
assert
(
object
&&
peeled
);
assert
(
object
&&
peeled
);
if
(
git_object_type
(
object
)
==
target_type
)
if
(
git_object_type
(
object
)
==
target_type
)
return
git_object_
_
dup
(
peeled
,
(
git_object
*
)
object
);
return
git_object_dup
(
peeled
,
(
git_object
*
)
object
);
source
=
(
git_object
*
)
object
;
source
=
(
git_object
*
)
object
;
...
@@ -396,3 +396,9 @@ int git_object_peel(
...
@@ -396,3 +396,9 @@ int git_object_peel(
return
error
;
return
error
;
}
}
int
git_object_dup
(
git_object
**
dest
,
git_object
*
source
)
{
git_cached_obj_incref
(
source
);
*
dest
=
source
;
return
0
;
}
src/object.h
View file @
575a54db
...
@@ -17,13 +17,6 @@ struct git_object {
...
@@ -17,13 +17,6 @@ struct git_object {
/* fully free the object; internal method, DO NOT EXPORT */
/* fully free the object; internal method, DO NOT EXPORT */
void
git_object__free
(
void
*
object
);
void
git_object__free
(
void
*
object
);
GIT_INLINE
(
int
)
git_object__dup
(
git_object
**
dest
,
git_object
*
source
)
{
git_cached_obj_incref
(
source
);
*
dest
=
source
;
return
0
;
}
int
git_object__from_odb_object
(
int
git_object__from_odb_object
(
git_object
**
object_out
,
git_object
**
object_out
,
git_repository
*
repo
,
git_repository
*
repo
,
...
...
src/refs.c
View file @
575a54db
...
@@ -934,7 +934,7 @@ int git_reference_peel(
...
@@ -934,7 +934,7 @@ int git_reference_peel(
}
}
if
(
target_type
==
GIT_OBJ_ANY
&&
git_object_type
(
target
)
!=
GIT_OBJ_TAG
)
if
(
target_type
==
GIT_OBJ_ANY
&&
git_object_type
(
target
)
!=
GIT_OBJ_TAG
)
error
=
git_object_
_
dup
(
peeled
,
target
);
error
=
git_object_dup
(
peeled
,
target
);
else
else
error
=
git_object_peel
(
peeled
,
target
,
target_type
);
error
=
git_object_peel
(
peeled
,
target
,
target_type
);
...
...
src/revparse.c
View file @
575a54db
...
@@ -432,7 +432,7 @@ static int dereference_to_non_tag(git_object **out, git_object *obj)
...
@@ -432,7 +432,7 @@ static int dereference_to_non_tag(git_object **out, git_object *obj)
if
(
git_object_type
(
obj
)
==
GIT_OBJ_TAG
)
if
(
git_object_type
(
obj
)
==
GIT_OBJ_TAG
)
return
git_tag_peel
(
out
,
(
git_tag
*
)
obj
);
return
git_tag_peel
(
out
,
(
git_tag
*
)
obj
);
return
git_object_
_
dup
(
out
,
obj
);
return
git_object_dup
(
out
,
obj
);
}
}
static
int
handle_caret_parent_syntax
(
git_object
**
out
,
git_object
*
obj
,
int
n
)
static
int
handle_caret_parent_syntax
(
git_object
**
out
,
git_object
*
obj
,
int
n
)
...
...
src/tree.h
View file @
575a54db
...
@@ -30,11 +30,6 @@ struct git_treebuilder {
...
@@ -30,11 +30,6 @@ struct git_treebuilder {
size_t
entrycount
;
/* vector may contain "removed" entries */
size_t
entrycount
;
/* vector may contain "removed" entries */
};
};
GIT_INLINE
(
int
)
git_tree__dup
(
git_tree
**
dest
,
git_tree
*
source
)
{
return
git_object__dup
((
git_object
**
)
dest
,
(
git_object
*
)
source
);
}
GIT_INLINE
(
bool
)
git_tree_entry__is_tree
(
const
struct
git_tree_entry
*
e
)
GIT_INLINE
(
bool
)
git_tree_entry__is_tree
(
const
struct
git_tree_entry
*
e
)
{
{
return
(
S_ISDIR
(
e
->
attr
)
&&
!
S_ISGITLINK
(
e
->
attr
));
return
(
S_ISDIR
(
e
->
attr
)
&&
!
S_ISGITLINK
(
e
->
attr
));
...
...
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