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
1881f078
Commit
1881f078
authored
Mar 21, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add getters for `git_odb_object`
parent
b932ef5b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
include/git2/odb.h
+42
-0
src/odb.c
+20
-0
No files found.
include/git2/odb.h
View file @
1881f078
...
@@ -235,6 +235,48 @@ GIT_EXTERN(int) git_odb_hash(git_oid *id, const void *data, size_t len, git_otyp
...
@@ -235,6 +235,48 @@ GIT_EXTERN(int) git_odb_hash(git_oid *id, const void *data, size_t len, git_otyp
*/
*/
GIT_EXTERN
(
void
)
git_odb_object_close
(
git_odb_object
*
object
);
GIT_EXTERN
(
void
)
git_odb_object_close
(
git_odb_object
*
object
);
/**
* Return the OID of an ODB object
*
* This is the OID from which the object was read from
*
* @param object the object
* @return a pointer to the OID
*/
GIT_EXTERN
(
const
git_oid
*
)
git_odb_object_id
(
git_odb_object
*
object
);
/**
* Return the data of an ODB object
*
* This is the uncompressed, raw data as read from the ODB,
* without the leading header.
*
* This pointer is owned by the object and shall not be free'd.
*
* @param object the object
* @return a pointer to the data
*/
GIT_EXTERN
(
const
void
*
)
git_odb_object_data
(
git_odb_object
*
object
);
/**
* Return the size of an ODB object
*
* This is the real size of the `data` buffer, not the
* actual size of the object.
*
* @param object the object
* @return the size
*/
GIT_EXTERN
(
size_t
)
git_odb_object_size
(
git_odb_object
*
object
);
/**
* Return the type of an ODB object
*
* @param object the object
* @return the type
*/
GIT_EXTERN
(
git_otype
)
git_odb_object_type
(
git_odb_object
*
object
);
/** @} */
/** @} */
GIT_END_DECL
GIT_END_DECL
#endif
#endif
src/odb.c
View file @
1881f078
...
@@ -109,6 +109,26 @@ static void free_odb_object(void *o)
...
@@ -109,6 +109,26 @@ static void free_odb_object(void *o)
}
}
}
}
const
git_oid
*
git_odb_object_id
(
git_odb_object
*
object
)
{
return
&
object
->
cached
.
oid
;
}
const
void
*
git_odb_object_data
(
git_odb_object
*
object
)
{
return
object
->
raw
.
data
;
}
size_t
git_odb_object_size
(
git_odb_object
*
object
)
{
return
object
->
raw
.
len
;
}
git_otype
git_odb_object_type
(
git_odb_object
*
object
)
{
return
object
->
raw
.
type
;
}
void
git_odb_object_close
(
git_odb_object
*
object
)
void
git_odb_object_close
(
git_odb_object
*
object
)
{
{
git_cached_obj_decref
((
git_cached_obj
*
)
object
,
&
free_odb_object
);
git_cached_obj_decref
((
git_cached_obj
*
)
object
,
&
free_odb_object
);
...
...
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