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
c682886e
Commit
c682886e
authored
Jun 28, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repo: Rename HEAD-related methods
parent
e053c911
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
include/git2/repository.h
+2
-2
src/repository.c
+2
-2
tests/t12-repo.c
+10
-10
No files found.
include/git2/repository.h
View file @
c682886e
...
...
@@ -228,7 +228,7 @@ GIT_EXTERN(int) git_repository_init(git_repository **repo_out, const char *path,
* @return 1 if HEAD is detached, 0 if i'ts not; error code if there
* was an error.
*/
int
git_repository_
is
_detached
(
git_repository
*
repo
);
int
git_repository_
head
_detached
(
git_repository
*
repo
);
/**
* Check if the current branch is an orphan
...
...
@@ -240,7 +240,7 @@ int git_repository_is_detached(git_repository *repo);
* @return 1 if the current branch is an orphan, 0 if it's not; error
* code if therewas an error
*/
int
git_repository_
is
_orphan
(
git_repository
*
repo
);
int
git_repository_
head
_orphan
(
git_repository
*
repo
);
/**
* Check if a repository is empty
...
...
src/repository.c
View file @
c682886e
...
...
@@ -752,7 +752,7 @@ cleanup:
return
git__rethrow
(
error
,
"Failed to (re)init the repository `%s`"
,
path
);
}
int
git_repository_
is
_detached
(
git_repository
*
repo
)
int
git_repository_
head
_detached
(
git_repository
*
repo
)
{
git_reference
*
ref
;
int
error
;
...
...
@@ -776,7 +776,7 @@ int git_repository_is_detached(git_repository *repo)
return
1
;
}
int
git_repository_
is
_orphan
(
git_repository
*
repo
)
int
git_repository_
head
_orphan
(
git_repository
*
repo
)
{
git_reference
*
ref
;
int
error
;
...
...
tests/t12-repo.c
View file @
c682886e
...
...
@@ -275,16 +275,16 @@ BEGIN_TEST(detached0, "test if HEAD is detached")
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
must_be_true
(
git_repository_
is
_detached
(
repo
)
==
0
);
must_be_true
(
git_repository_
head
_detached
(
repo
)
==
0
);
/* detach the HEAD */
git_oid_fromstr
(
&
oid
,
"c47800c7266a2be04c571c04d5a6614691ea99bd"
);
must_pass
(
git_reference_create_oid
_f
(
&
ref
,
repo
,
"HEAD"
,
&
oid
));
must_be_true
(
git_repository_
is
_detached
(
repo
)
==
1
);
must_pass
(
git_reference_create_oid
(
&
ref
,
repo
,
"HEAD"
,
&
oid
,
1
));
must_be_true
(
git_repository_
head
_detached
(
repo
)
==
1
);
/* take the reop back to it's original state */
must_pass
(
git_reference_create_symbolic
_f
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
));
must_be_true
(
git_repository_
is
_detached
(
repo
)
==
0
);
must_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
must_be_true
(
git_repository_
head
_detached
(
repo
)
==
0
);
git_repository_free
(
repo
);
END_TEST
...
...
@@ -295,15 +295,15 @@ BEGIN_TEST(orphan0, "test if HEAD is orphan")
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
must_be_true
(
git_repository_
is
_orphan
(
repo
)
==
0
);
must_be_true
(
git_repository_
head
_orphan
(
repo
)
==
0
);
/* orphan HEAD */
must_pass
(
git_reference_create_symbolic
_f
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/orphan"
));
must_be_true
(
git_repository_
is
_orphan
(
repo
)
==
1
);
must_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/orphan"
,
1
));
must_be_true
(
git_repository_
head
_orphan
(
repo
)
==
1
);
/* take the reop back to it's original state */
must_pass
(
git_reference_create_symbolic
_f
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
));
must_be_true
(
git_repository_
is
_orphan
(
repo
)
==
0
);
must_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
must_be_true
(
git_repository_
head
_orphan
(
repo
)
==
0
);
git_repository_free
(
repo
);
END_TEST
...
...
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