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
ff9a4c13
Commit
ff9a4c13
authored
Jun 06, 2011
by
Romain Geissler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tree: Added a function that returns the type of a tree entry.
parent
f9213015
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
include/git2/tree.h
+8
-0
src/fileops.h
+3
-0
src/tree.c
+12
-0
No files found.
include/git2/tree.h
View file @
ff9a4c13
...
...
@@ -129,6 +129,14 @@ GIT_EXTERN(const char *) git_tree_entry_name(const git_tree_entry *entry);
GIT_EXTERN
(
const
git_oid
*
)
git_tree_entry_id
(
const
git_tree_entry
*
entry
);
/**
* Get the type of the object pointed by the entry
*
* @param entry a tree entry
* @return the type of the pointed object
*/
GIT_EXTERN
(
git_otype
)
git_tree_entry_type
(
const
git_tree_entry
*
entry
);
/**
* Convert a tree entry to the git_object it points too.
*
* @param object pointer to the converted object
...
...
src/fileops.h
View file @
ff9a4c13
...
...
@@ -20,6 +20,9 @@
#define GIT_PLATFORM_PATH_SEP '/'
#endif
#define S_IFGITLINK 0160000
#define S_ISGITLINK(m) (((m) & S_IFMT) == S_IFGITLINK)
#ifdef GIT_WIN32
GIT_INLINE
(
int
)
link
(
const
char
*
GIT_UNUSED
(
old
),
const
char
*
GIT_UNUSED
(
new
))
{
...
...
src/tree.c
View file @
ff9a4c13
...
...
@@ -100,6 +100,18 @@ const git_oid *git_tree_entry_id(const git_tree_entry *entry)
return
&
entry
->
oid
;
}
git_otype
git_tree_entry_type
(
const
git_tree_entry
*
entry
)
{
assert
(
entry
);
if
(
S_ISGITLINK
(
entry
->
attr
))
return
GIT_OBJ_COMMIT
;
else
if
(
S_ISDIR
(
entry
->
attr
))
return
GIT_OBJ_TREE
;
else
return
GIT_OBJ_BLOB
;
}
int
git_tree_entry_2object
(
git_object
**
object_out
,
git_repository
*
repo
,
const
git_tree_entry
*
entry
)
{
assert
(
entry
&&
object_out
);
...
...
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