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
f1ad25f6
Commit
f1ad25f6
authored
Sep 15, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repository: separate head related tests
parent
10df95c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
46 deletions
+52
-46
tests-clar/repo/getters.c
+0
-46
tests-clar/repo/head.c
+52
-0
No files found.
tests-clar/repo/getters.c
View file @
f1ad25f6
...
...
@@ -23,52 +23,6 @@ void test_repo_getters__empty(void)
git_repository_free
(
repo_empty
);
}
void
test_repo_getters__head_detached
(
void
)
{
git_repository
*
repo
;
git_reference
*
ref
;
git_oid
oid
;
cl_git_pass
(
git_repository_open
(
&
repo
,
"testrepo.git"
));
cl_assert
(
git_repository_head_detached
(
repo
)
==
0
);
/* detach the HEAD */
git_oid_fromstr
(
&
oid
,
"c47800c7266a2be04c571c04d5a6614691ea99bd"
);
cl_git_pass
(
git_reference_create_oid
(
&
ref
,
repo
,
"HEAD"
,
&
oid
,
1
));
cl_assert
(
git_repository_head_detached
(
repo
)
==
1
);
git_reference_free
(
ref
);
/* take the reop back to it's original state */
cl_git_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
cl_assert
(
git_repository_head_detached
(
repo
)
==
0
);
git_reference_free
(
ref
);
git_repository_free
(
repo
);
}
void
test_repo_getters__head_orphan
(
void
)
{
git_repository
*
repo
;
git_reference
*
ref
;
cl_git_pass
(
git_repository_open
(
&
repo
,
"testrepo.git"
));
cl_assert
(
git_repository_head_orphan
(
repo
)
==
0
);
/* orphan HEAD */
cl_git_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/orphan"
,
1
));
cl_assert
(
git_repository_head_orphan
(
repo
)
==
1
);
git_reference_free
(
ref
);
/* take the reop back to it's original state */
cl_git_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
cl_assert
(
git_repository_head_orphan
(
repo
)
==
0
);
git_reference_free
(
ref
);
git_repository_free
(
repo
);
}
void
test_repo_getters__retrieving_the_odb_honors_the_refcount
(
void
)
{
git_odb
*
odb
;
...
...
tests-clar/repo/head.c
0 → 100644
View file @
f1ad25f6
#include "clar_libgit2.h"
#include "refs.h"
git_repository
*
repo
;
void
test_repo_head__initialize
(
void
)
{
repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
}
void
test_repo_head__cleanup
(
void
)
{
cl_git_sandbox_cleanup
();
}
void
test_repo_head__head_detached
(
void
)
{
git_reference
*
ref
;
git_oid
oid
;
cl_assert
(
git_repository_head_detached
(
repo
)
==
0
);
/* detach the HEAD */
git_oid_fromstr
(
&
oid
,
"c47800c7266a2be04c571c04d5a6614691ea99bd"
);
cl_git_pass
(
git_reference_create_oid
(
&
ref
,
repo
,
"HEAD"
,
&
oid
,
1
));
cl_assert
(
git_repository_head_detached
(
repo
)
==
1
);
git_reference_free
(
ref
);
/* take the reop back to it's original state */
cl_git_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
cl_assert
(
git_repository_head_detached
(
repo
)
==
0
);
git_reference_free
(
ref
);
}
void
test_repo_head__head_orphan
(
void
)
{
git_reference
*
ref
;
cl_assert
(
git_repository_head_orphan
(
repo
)
==
0
);
/* orphan HEAD */
cl_git_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/orphan"
,
1
));
cl_assert
(
git_repository_head_orphan
(
repo
)
==
1
);
git_reference_free
(
ref
);
/* take the reop back to it's original state */
cl_git_pass
(
git_reference_create_symbolic
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
cl_assert
(
git_repository_head_orphan
(
repo
)
==
0
);
git_reference_free
(
ref
);
}
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