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
b595b385
Commit
b595b385
authored
Sep 03, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1814 from libgit2/is-empty-fix
Fix incorrect precedence within git_repository_is_empty()
parents
c46fe0c6
42181836
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
src/repository.c
+8
-12
No files found.
src/repository.c
View file @
b595b385
...
@@ -1495,24 +1495,20 @@ static int repo_contains_no_reference(git_repository *repo)
...
@@ -1495,24 +1495,20 @@ static int repo_contains_no_reference(git_repository *repo)
int
git_repository_is_empty
(
git_repository
*
repo
)
int
git_repository_is_empty
(
git_repository
*
repo
)
{
{
git_reference
*
head
=
NULL
;
git_reference
*
head
=
NULL
;
int
error
;
int
is_empty
=
0
;
if
(
git_reference_lookup
(
&
head
,
repo
,
GIT_HEAD_FILE
)
<
0
)
if
(
git_reference_lookup
(
&
head
,
repo
,
GIT_HEAD_FILE
)
<
0
)
return
-
1
;
return
-
1
;
if
(
!
((
error
=
git_reference_type
(
head
))
==
GIT_REF_SYMBOLIC
))
if
(
git_reference_type
(
head
)
==
GIT_REF_SYMBOLIC
)
goto
cleanup
;
is_empty
=
(
strcmp
(
git_reference_symbolic_target
(
head
),
if
(
!
(
error
=
(
strcmp
(
GIT_REFS_HEADS_DIR
"master"
)
==
0
)
&&
git_reference_symbolic_target
(
head
),
repo_contains_no_reference
(
repo
);
GIT_REFS_HEADS_DIR
"master"
)
==
0
)))
goto
cleanup
;
error
=
repo_contains_no_reference
(
repo
);
cleanup:
git_reference_free
(
head
);
git_reference_free
(
head
);
return
error
<
0
?
-
1
:
error
;
return
is_empty
;
}
}
const
char
*
git_repository_path
(
git_repository
*
repo
)
const
char
*
git_repository_path
(
git_repository
*
repo
)
...
...
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