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
1f080e2d
Commit
1f080e2d
authored
Dec 13, 2010
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix initialization & freeing of inexistent repos
Signed-off-by: Vicent Marti <tanoku@gmail.com>
parent
e0d9e12e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
8 deletions
+33
-8
src/fileops.c
+7
-2
src/odb.c
+2
-1
src/repository.c
+12
-5
src/revwalk.c
+12
-0
No files found.
src/fileops.c
View file @
1f080e2d
...
...
@@ -74,8 +74,13 @@ int gitfo_isdir(const char *path)
stat_error
=
gitfo_stat
(
path
,
&
st
);
}
return
(
stat_error
==
0
&&
S_ISDIR
(
st
.
st_mode
))
?
GIT_SUCCESS
:
GIT_ENOTFOUND
;
if
(
stat_error
<
GIT_SUCCESS
)
return
GIT_ENOTFOUND
;
if
(
!
S_ISDIR
(
st
.
st_mode
))
return
GIT_ENOTFOUND
;
return
GIT_SUCCESS
;
}
int
gitfo_exists
(
const
char
*
path
)
...
...
src/odb.c
View file @
1f080e2d
...
...
@@ -210,7 +210,8 @@ void git_odb_close(git_odb *db)
{
unsigned
int
i
;
assert
(
db
);
if
(
db
==
NULL
)
return
;
for
(
i
=
0
;
i
<
db
->
backends
.
length
;
++
i
)
{
git_odb_backend
*
b
=
git_vector_get
(
&
db
->
backends
,
i
);
...
...
src/repository.c
View file @
1f080e2d
...
...
@@ -103,7 +103,6 @@ static int assign_repository_folders(git_repository *repo,
if
(
git_dir
==
NULL
||
gitfo_isdir
(
git_dir
)
<
GIT_SUCCESS
)
return
GIT_ENOTFOUND
;
/* store GIT_DIR */
path_len
=
strlen
(
git_dir
);
strcpy
(
path_aux
,
git_dir
);
...
...
@@ -279,6 +278,7 @@ int git_repository_open(git_repository **repo_out, const char *path)
if
(
error
<
GIT_SUCCESS
)
goto
cleanup
;
error
=
git_odb_open
(
&
repo
->
db
,
repo
->
path_odb
);
if
(
error
<
GIT_SUCCESS
)
goto
cleanup
;
...
...
@@ -296,7 +296,8 @@ void git_repository_free(git_repository *repo)
git_hashtable_iterator
it
;
git_object
*
object
;
assert
(
repo
);
if
(
repo
==
NULL
)
return
;
free
(
repo
->
path_workdir
);
free
(
repo
->
path_index
);
...
...
@@ -310,8 +311,13 @@ void git_repository_free(git_repository *repo)
git_object_free
(
object
);
git_hashtable_free
(
repo
->
objects
);
git_odb_close
(
repo
->
db
);
git_index_free
(
repo
->
index
);
if
(
repo
->
db
!=
NULL
)
git_odb_close
(
repo
->
db
);
if
(
repo
->
index
!=
NULL
)
git_index_free
(
repo
->
index
);
free
(
repo
);
}
...
...
@@ -511,7 +517,8 @@ int git_object_write(git_object *object)
void
git_object_free
(
git_object
*
object
)
{
assert
(
object
);
if
(
object
==
NULL
)
return
;
git_object__source_close
(
object
);
git_hashtable_remove
(
object
->
repo
->
objects
,
&
object
->
id
);
...
...
src/revwalk.c
View file @
1f080e2d
...
...
@@ -77,6 +77,9 @@ int git_revwalk_new(git_revwalk **revwalk_out, git_repository *repo)
void
git_revwalk_free
(
git_revwalk
*
walk
)
{
if
(
walk
==
NULL
)
return
;
git_revwalk_reset
(
walk
);
git_hashtable_free
(
walk
->
commits
);
free
(
walk
);
...
...
@@ -90,6 +93,8 @@ git_repository *git_revwalk_repository(git_revwalk *walk)
int
git_revwalk_sorting
(
git_revwalk
*
walk
,
unsigned
int
sort_mode
)
{
assert
(
walk
);
if
(
walk
->
walking
)
return
GIT_EBUSY
;
...
...
@@ -165,6 +170,7 @@ static git_revwalk_commit *insert_commit(git_revwalk *walk, git_commit *commit_o
int
git_revwalk_push
(
git_revwalk
*
walk
,
git_commit
*
commit
)
{
assert
(
walk
&&
commit
);
return
insert_commit
(
walk
,
commit
)
?
GIT_SUCCESS
:
GIT_ENOMEM
;
}
...
...
@@ -186,6 +192,8 @@ static void mark_uninteresting(git_revwalk_commit *commit)
int
git_revwalk_hide
(
git_revwalk
*
walk
,
git_commit
*
commit
)
{
git_revwalk_commit
*
hide
;
assert
(
walk
&&
commit
);
hide
=
insert_commit
(
walk
,
commit
);
if
(
hide
==
NULL
)
...
...
@@ -216,6 +224,8 @@ git_commit *git_revwalk_next(git_revwalk *walk)
{
git_revwalk_commit
*
next
;
assert
(
walk
);
if
(
!
walk
->
walking
)
prepare_walk
(
walk
);
...
...
@@ -234,6 +244,8 @@ void git_revwalk_reset(git_revwalk *walk)
git_hashtable_iterator
it
;
git_revwalk_commit
*
commit
;
assert
(
walk
);
git_hashtable_iterator_init
(
walk
->
commits
,
&
it
);
while
((
commit
=
(
git_revwalk_commit
*
)
...
...
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