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
89f9fc6f
Commit
89f9fc6f
authored
Jan 28, 2011
by
John Wiegley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make git_tree_clear_entries visible to the user
parent
75e051c6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
src/git2/tree.h
+10
-0
src/tree.c
+5
-3
No files found.
src/git2/tree.h
View file @
89f9fc6f
...
...
@@ -205,6 +205,16 @@ GIT_EXTERN(int) git_tree_remove_entry_byindex(git_tree *tree, int idx);
GIT_EXTERN
(
int
)
git_tree_remove_entry_byname
(
git_tree
*
tree
,
const
char
*
filename
);
/**
* Clear all the entries in a tree.
*
* This will mark the tree as modified; the modified entry will
* be written back to disk on the next git_object_write().
*
* @param tree Tree object whose entries are to be sorted
*/
GIT_EXTERN
(
void
)
git_tree_clear_entries
(
git_tree
*
tree
);
/**
* Change the SHA1 id of a tree entry.
*
* This will mark the tree that contains the entry as modified;
...
...
src/tree.c
View file @
89f9fc6f
...
...
@@ -48,7 +48,7 @@ int entry_sort_cmp(const void *a, const void *b)
return
strcmp
(
entry_a
->
filename
,
entry_b
->
filename
);
}
static
void
clear_entries
(
git_tree
*
tree
)
void
git_tree_
clear_entries
(
git_tree
*
tree
)
{
unsigned
int
i
;
...
...
@@ -64,6 +64,8 @@ static void clear_entries(git_tree *tree)
}
git_vector_clear
(
&
tree
->
entries
);
tree
->
object
.
modified
=
1
;
}
...
...
@@ -90,7 +92,7 @@ git_tree *git_tree__new(void)
void
git_tree__free
(
git_tree
*
tree
)
{
clear_entries
(
tree
);
git_tree_
clear_entries
(
tree
);
git_vector_free
(
&
tree
->
entries
);
free
(
tree
);
}
...
...
@@ -282,7 +284,7 @@ static int tree_parse_buffer(git_tree *tree, char *buffer, char *buffer_end)
expected_size
=
(
tree
->
object
.
source
.
raw
.
len
/
avg_entry_size
)
+
1
;
clear_entries
(
tree
);
git_tree_
clear_entries
(
tree
);
while
(
buffer
<
buffer_end
)
{
git_tree_entry
*
entry
;
...
...
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