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
3ba69ba8
Commit
3ba69ba8
authored
Aug 02, 2011
by
Carlos Martín Nieto
Committed by
Vicent Marti
Sep 27, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add git_tree_cache_get
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
parent
b419fe2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletions
+25
-1
src/tree-cache.c
+24
-1
src/tree-cache.h
+1
-0
No files found.
src/tree-cache.c
View file @
3ba69ba8
...
...
@@ -7,7 +7,7 @@
#include "tree-cache.h"
static
git_tree_cache
*
find_child
(
git_tree_cache
*
tree
,
const
char
*
path
)
static
git_tree_cache
*
find_child
(
const
git_tree_cache
*
tree
,
const
char
*
path
)
{
size_t
i
,
dirlen
;
const
char
*
end
;
...
...
@@ -53,6 +53,29 @@ void git_tree_cache_invalidate_path(git_tree_cache *tree, const char *path)
}
}
const
git_tree_cache
*
git_tree_cache_get
(
const
git_tree_cache
*
tree
,
const
char
*
path
)
{
const
char
*
ptr
=
path
,
*
end
;
if
(
tree
==
NULL
)
{
return
NULL
;
}
while
(
1
)
{
end
=
strchr
(
ptr
,
'/'
);
tree
=
find_child
(
tree
,
ptr
);
if
(
tree
==
NULL
)
{
/* Can't find it */
return
NULL
;
}
if
(
end
==
NULL
||
end
+
1
==
'\0'
)
return
tree
;
ptr
=
end
+
1
;
}
}
static
int
read_tree_internal
(
git_tree_cache
**
out
,
const
char
**
buffer_in
,
const
char
*
buffer_end
,
git_tree_cache
*
parent
)
{
...
...
src/tree-cache.h
View file @
3ba69ba8
...
...
@@ -25,6 +25,7 @@ typedef struct git_tree_cache git_tree_cache;
int
git_tree_cache_read
(
git_tree_cache
**
tree
,
const
char
*
buffer
,
size_t
buffer_size
);
void
git_tree_cache_invalidate_path
(
git_tree_cache
*
tree
,
const
char
*
path
);
const
git_tree_cache
*
git_tree_cache_get
(
const
git_tree_cache
*
tree
,
const
char
*
path
);
void
git_tree_cache_free
(
git_tree_cache
*
tree
);
#endif
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