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
0f489fb2
Commit
0f489fb2
authored
Jun 28, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repo: Fix git_repository_is_empty
parent
ab7941b5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
src/repository.c
+7
-3
No files found.
src/repository.c
View file @
0f489fb2
...
@@ -800,12 +800,16 @@ int git_repository_is_empty(git_repository *repo)
...
@@ -800,12 +800,16 @@ int git_repository_is_empty(git_repository *repo)
error
=
git_reference_lookup
(
&
head
,
repo
,
"HEAD"
);
error
=
git_reference_lookup
(
&
head
,
repo
,
"HEAD"
);
if
(
error
<
GIT_SUCCESS
)
if
(
error
<
GIT_SUCCESS
)
return
git__throw
(
error
,
"
Failed to determine the emptiness of the repository. An error occured while retrieving the HEAD reference
"
);
return
git__throw
(
error
,
"
Corrupted repository. HEAD does not exist
"
);
if
(
git_reference_type
(
head
)
!=
GIT_REF_SYMBOLIC
)
if
(
git_reference_type
(
head
)
!=
GIT_REF_SYMBOLIC
)
return
git__throw
(
GIT_EOBJCORRUPTED
,
"Failed to determine the emptiness of the repository. HEAD is probably in detached state"
);
return
0
;
if
(
strcmp
(
git_reference_target
(
head
),
"refs/heads/master"
)
!=
0
)
return
0
;
return
git_reference_resolve
(
&
branch
,
head
)
==
GIT_SUCCESS
?
0
:
1
;
error
=
git_reference_resolve
(
&
branch
,
head
);
return
error
==
GIT_ENOTFOUND
?
1
:
error
;
}
}
const
char
*
git_repository_path
(
git_repository
*
repo
,
git_repository_pathid
id
)
const
char
*
git_repository_path
(
git_repository
*
repo
,
git_repository_pathid
id
)
...
...
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