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
8689a69d
Commit
8689a69d
authored
Jul 25, 2012
by
Sascha Cunz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests: Test remote's pushurl
parent
76501590
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
tests-clar/network/remotes.c
+25
-2
tests-clar/resources/testrepo.git/config
+5
-0
No files found.
tests-clar/network/remotes.c
View file @
8689a69d
...
...
@@ -27,8 +27,26 @@ void test_network_remotes__cleanup(void)
void
test_network_remotes__parsing
(
void
)
{
git_remote
*
_remote2
=
NULL
;
cl_assert_equal_s
(
git_remote_name
(
_remote
),
"test"
);
cl_assert_equal_s
(
git_remote_url
(
_remote
),
"git://github.com/libgit2/libgit2"
);
cl_assert
(
git_remote_pushurl
(
_remote
)
==
NULL
);
cl_git_pass
(
git_remote_load
(
&
_remote2
,
_repo
,
"test_with_pushurl"
));
cl_assert_equal_s
(
git_remote_name
(
_remote2
),
"test_with_pushurl"
);
cl_assert_equal_s
(
git_remote_url
(
_remote2
),
"git://github.com/libgit2/fetchlibgit2"
);
cl_assert_equal_s
(
git_remote_pushurl
(
_remote2
),
"git://github.com/libgit2/pushlibgit2"
);
git_remote_free
(
_remote2
);
}
void
test_network_remotes__pushurl
(
void
)
{
cl_git_pass
(
git_remote_set_pushurl
(
_remote
,
"git://github.com/libgit2/notlibgit2"
));
cl_assert_equal_s
(
git_remote_pushurl
(
_remote
),
"git://github.com/libgit2/notlibgit2"
);
cl_git_pass
(
git_remote_set_pushurl
(
_remote
,
NULL
));
cl_assert
(
git_remote_pushurl
(
_remote
)
==
NULL
);
}
void
test_network_remotes__parsing_ssh_remote
(
void
)
...
...
@@ -81,6 +99,7 @@ void test_network_remotes__save(void)
cl_git_pass
(
git_remote_new
(
&
_remote
,
_repo
,
"upstream"
,
"git://github.com/libgit2/libgit2"
,
NULL
));
cl_git_pass
(
git_remote_set_fetchspec
(
_remote
,
"refs/heads/*:refs/remotes/upstream/*"
));
cl_git_pass
(
git_remote_set_pushspec
(
_remote
,
"refs/heads/*:refs/heads/*"
));
cl_git_pass
(
git_remote_set_pushurl
(
_remote
,
"git://github.com/libgit2/libgit2_push"
));
cl_git_pass
(
git_remote_save
(
_remote
));
git_remote_free
(
_remote
);
_remote
=
NULL
;
...
...
@@ -98,6 +117,9 @@ void test_network_remotes__save(void)
cl_assert
(
_refspec
!=
NULL
);
cl_assert_equal_s
(
git_refspec_src
(
_refspec
),
"refs/heads/*"
);
cl_assert_equal_s
(
git_refspec_dst
(
_refspec
),
"refs/heads/*"
);
cl_assert_equal_s
(
git_remote_url
(
_remote
),
"git://github.com/libgit2/libgit2"
);
cl_assert_equal_s
(
git_remote_pushurl
(
_remote
),
"git://github.com/libgit2/libgit2_push"
);
}
void
test_network_remotes__fnmatch
(
void
)
...
...
@@ -143,13 +165,13 @@ void test_network_remotes__list(void)
git_config
*
cfg
;
cl_git_pass
(
git_remote_list
(
&
list
,
_repo
));
cl_assert
(
list
.
count
==
1
);
cl_assert
(
list
.
count
==
2
);
git_strarray_free
(
&
list
);
cl_git_pass
(
git_repository_config
(
&
cfg
,
_repo
));
cl_git_pass
(
git_config_set_string
(
cfg
,
"remote.specless.url"
,
"http://example.com"
));
cl_git_pass
(
git_remote_list
(
&
list
,
_repo
));
cl_assert
(
list
.
count
==
2
);
cl_assert
(
list
.
count
==
3
);
git_strarray_free
(
&
list
);
git_config_free
(
cfg
);
...
...
@@ -180,4 +202,5 @@ void test_network_remotes__add(void)
cl_assert
(
!
strcmp
(
git_refspec_src
(
_refspec
),
"refs/heads/*"
));
cl_assert
(
git_refspec_force
(
_refspec
)
==
1
);
cl_assert
(
!
strcmp
(
git_refspec_dst
(
_refspec
),
"refs/remotes/addtest/*"
));
cl_assert_equal_s
(
git_remote_url
(
_remote
),
"http://github.com/libgit2/libgit2"
);
}
tests-clar/resources/testrepo.git/config
View file @
8689a69d
...
...
@@ -7,6 +7,11 @@
url = git://github.com/libgit2/libgit2
fetch = +refs/heads/*:refs/remotes/test/*
[remote "test_with_pushurl"]
url = git://github.com/libgit2/fetchlibgit2
pushurl = git://github.com/libgit2/pushlibgit2
fetch = +refs/heads/*:refs/remotes/test_with_pushurl/*
[branch "master"]
remote = test
merge = refs/heads/master
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