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
879458e7
Commit
879458e7
authored
Apr 24, 2013
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repo: Add `git_repository__cleanup`
parent
2370b4d7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
5 deletions
+32
-5
include/git2/sys/repository.h
+14
-0
src/cache.c
+3
-0
src/cache.h
+1
-0
src/repository.c
+14
-5
No files found.
include/git2/sys/repository.h
View file @
879458e7
...
...
@@ -27,6 +27,20 @@ GIT_BEGIN_DECL
*/
GIT_EXTERN
(
int
)
git_repository_new
(
git_repository
**
out
);
/**
* Reset all the internal state in a repository.
*
* This will free all the mapped memory and internal objects
* of the repository and leave it in a "blank" state.
*
* There's no need to call this function directly unless you're
* trying to aggressively cleanup the repo before its
* deallocation. `git_repository_free` already performs this operation
* before deallocation the repo.
*/
GIT_EXTERN
(
void
)
git_repository__cleanup
(
git_repository
*
repo
);
/**
* Set the configuration file for this repository
*
...
...
src/cache.c
View file @
879458e7
...
...
@@ -77,6 +77,9 @@ static void clear_cache(git_cache *cache)
{
git_cached_obj
*
evict
=
NULL
;
if
(
kh_size
(
cache
->
map
)
==
0
)
return
;
kh_foreach_value
(
cache
->
map
,
evict
,
{
git_cached_obj_decref
(
evict
);
});
...
...
src/cache.h
View file @
879458e7
...
...
@@ -42,6 +42,7 @@ int git_cache_set_max_object_size(git_otype type, size_t size);
int
git_cache_init
(
git_cache
*
cache
);
void
git_cache_free
(
git_cache
*
cache
);
void
git_cache_clear
(
git_cache
*
cache
);
void
*
git_cache_store_raw
(
git_cache
*
cache
,
git_odb_object
*
entry
);
void
*
git_cache_store_parsed
(
git_cache
*
cache
,
git_object
*
entry
);
...
...
src/repository.c
View file @
879458e7
...
...
@@ -86,19 +86,28 @@ static void set_index(git_repository *repo, git_index *index)
}
}
void
git_repository_
free
(
git_repository
*
repo
)
void
git_repository_
_cleanup
(
git_repository
*
repo
)
{
if
(
repo
==
NULL
)
return
;
assert
(
repo
);
git_cache_
free
(
&
repo
->
objects
);
git_cache_
clear
(
&
repo
->
objects
);
git_attr_cache_flush
(
repo
);
git_submodule_config_free
(
repo
);
set_config
(
repo
,
NULL
);
set_index
(
repo
,
NULL
);
set_odb
(
repo
,
NULL
);
set_refdb
(
repo
,
NULL
);
}
void
git_repository_free
(
git_repository
*
repo
)
{
if
(
repo
==
NULL
)
return
;
git_repository__cleanup
(
repo
);
git_cache_free
(
&
repo
->
objects
);
git_submodule_config_free
(
repo
);
git__free
(
repo
->
path_repository
);
git__free
(
repo
->
workdir
);
...
...
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