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
f1bd50d6
Commit
f1bd50d6
authored
Nov 17, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tracking: remove code duplication in test
parent
7cdad6c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
23 deletions
+3
-23
tests-clar/refs/branches/tracking.c
+3
-23
No files found.
tests-clar/refs/branches/tracking.c
View file @
f1bd50d6
...
...
@@ -2,17 +2,19 @@
#include "refs.h"
static
git_repository
*
repo
;
static
git_reference
*
branch
;
static
git_reference
*
branch
,
*
tracking
;
void
test_refs_branches_tracking__initialize
(
void
)
{
cl_git_pass
(
git_repository_open
(
&
repo
,
cl_fixture
(
"testrepo.git"
)));
branch
=
NULL
;
tracking
=
NULL
;
}
void
test_refs_branches_tracking__cleanup
(
void
)
{
git_reference_free
(
tracking
);
git_reference_free
(
branch
);
branch
=
NULL
;
...
...
@@ -22,61 +24,39 @@ void test_refs_branches_tracking__cleanup(void)
void
test_refs_branches_tracking__can_retrieve_the_remote_tracking_reference_of_a_local_branch
(
void
)
{
git_reference
*
branch
,
*
tracking
;
cl_git_pass
(
git_reference_lookup
(
&
branch
,
repo
,
"refs/heads/master"
));
cl_git_pass
(
git_branch_tracking
(
&
tracking
,
branch
));
cl_assert_equal_s
(
"refs/remotes/test/master"
,
git_reference_name
(
tracking
));
git_reference_free
(
branch
);
git_reference_free
(
tracking
);
}
void
test_refs_branches_tracking__can_retrieve_the_local_tracking_reference_of_a_local_branch
(
void
)
{
git_reference
*
branch
,
*
tracking
;
cl_git_pass
(
git_reference_lookup
(
&
branch
,
repo
,
"refs/heads/track-local"
));
cl_git_pass
(
git_branch_tracking
(
&
tracking
,
branch
));
cl_assert_equal_s
(
"refs/heads/master"
,
git_reference_name
(
tracking
));
git_reference_free
(
branch
);
git_reference_free
(
tracking
);
}
void
test_refs_branches_tracking__cannot_retrieve_a_remote_tracking_reference_from_a_non_branch
(
void
)
{
git_reference
*
branch
,
*
tracking
;
cl_git_pass
(
git_reference_lookup
(
&
branch
,
repo
,
"refs/tags/e90810b"
));
cl_git_fail
(
git_branch_tracking
(
&
tracking
,
branch
));
git_reference_free
(
branch
);
}
void
test_refs_branches_tracking__trying_to_retrieve_a_remote_tracking_reference_from_a_plain_local_branch_returns_GIT_ENOTFOUND
(
void
)
{
git_reference
*
branch
,
*
tracking
;
cl_git_pass
(
git_reference_lookup
(
&
branch
,
repo
,
"refs/heads/subtrees"
));
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_branch_tracking
(
&
tracking
,
branch
));
git_reference_free
(
branch
);
}
void
test_refs_branches_tracking__trying_to_retrieve_a_remote_tracking_reference_from_a_branch_with_no_fetchspec_returns_GIT_ENOTFOUND
(
void
)
{
git_reference
*
branch
,
*
tracking
;
cl_git_pass
(
git_reference_lookup
(
&
branch
,
repo
,
"refs/heads/cannot-fetch"
));
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_branch_tracking
(
&
tracking
,
branch
));
git_reference_free
(
branch
);
}
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