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
61d57b7a
Commit
61d57b7a
authored
Sep 04, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test pushing to remotes with "
file:///"
urls
parent
f42d546c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
1 deletions
+70
-1
tests-clar/network/remote/local.c
+70
-1
No files found.
tests-clar/network/remote/local.c
View file @
61d57b7a
...
@@ -52,7 +52,6 @@ static void connect_to_local_repository(const char *local_repository)
...
@@ -52,7 +52,6 @@ static void connect_to_local_repository(const char *local_repository)
cl_git_pass
(
git_remote_create_inmemory
(
&
remote
,
repo
,
NULL
,
git_buf_cstr
(
&
file_path_buf
)));
cl_git_pass
(
git_remote_create_inmemory
(
&
remote
,
repo
,
NULL
,
git_buf_cstr
(
&
file_path_buf
)));
cl_git_pass
(
git_remote_connect
(
remote
,
GIT_DIRECTION_FETCH
));
cl_git_pass
(
git_remote_connect
(
remote
,
GIT_DIRECTION_FETCH
));
}
}
void
test_network_remote_local__connected
(
void
)
void
test_network_remote_local__connected
(
void
)
...
@@ -170,3 +169,73 @@ void test_network_remote_local__tagopt(void)
...
@@ -170,3 +169,73 @@ void test_network_remote_local__tagopt(void)
cl_git_pass
(
git_reference_lookup
(
&
ref
,
repo
,
"refs/tags/hard_tag"
));
cl_git_pass
(
git_reference_lookup
(
&
ref
,
repo
,
"refs/tags/hard_tag"
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
}
}
void
test_network_remote_local__push_to_bare_remote
(
void
)
{
/* Should be able to push to a bare remote */
git_remote
*
localremote
;
git_push
*
push
;
/* Get some commits */
connect_to_local_repository
(
cl_fixture
(
"testrepo.git"
));
cl_git_pass
(
git_remote_add_fetch
(
remote
,
"master:master"
));
cl_git_pass
(
git_remote_download
(
remote
,
NULL
,
NULL
));
cl_git_pass
(
git_remote_update_tips
(
remote
));
git_remote_disconnect
(
remote
);
/* Set up an empty bare repo to push into */
{
git_repository
*
localbarerepo
;
cl_git_pass
(
git_repository_init
(
&
localbarerepo
,
"./localbare.git"
,
1
));
git_repository_free
(
localbarerepo
);
}
/* Connect to the bare repo */
cl_git_pass
(
git_remote_create_inmemory
(
&
localremote
,
repo
,
NULL
,
"./localbare.git"
));
cl_git_pass
(
git_remote_connect
(
localremote
,
GIT_DIRECTION_PUSH
));
/* Try to push */
cl_git_pass
(
git_push_new
(
&
push
,
localremote
));
cl_git_pass
(
git_push_add_refspec
(
push
,
"refs/heads/master:"
));
cl_git_pass
(
git_push_finish
(
push
));
cl_assert
(
git_push_unpack_ok
(
push
));
/* Clean up */
git_remote_free
(
localremote
);
cl_fixture_cleanup
(
"localbare.git"
);
}
void
test_network_remote_local__push_to_non_bare_remote
(
void
)
{
/* Shouldn't be able to push to a non-bare remote */
git_remote
*
localremote
;
git_push
*
push
;
/* Get some commits */
connect_to_local_repository
(
cl_fixture
(
"testrepo.git"
));
cl_git_pass
(
git_remote_add_fetch
(
remote
,
"master:master"
));
cl_git_pass
(
git_remote_download
(
remote
,
NULL
,
NULL
));
cl_git_pass
(
git_remote_update_tips
(
remote
));
git_remote_disconnect
(
remote
);
/* Set up an empty non-bare repo to push into */
{
git_repository
*
remoterepo
=
NULL
;
cl_git_pass
(
git_repository_init
(
&
remoterepo
,
"localnonbare"
,
0
));
git_repository_free
(
remoterepo
);
}
/* Connect to the bare repo */
cl_git_pass
(
git_remote_create_inmemory
(
&
localremote
,
repo
,
NULL
,
"./localnonbare"
));
cl_git_pass
(
git_remote_connect
(
localremote
,
GIT_DIRECTION_PUSH
));
/* Try to push */
cl_git_pass
(
git_push_new
(
&
push
,
localremote
));
cl_git_pass
(
git_push_add_refspec
(
push
,
"refs/heads/master:"
));
cl_git_fail_with
(
git_push_finish
(
push
),
GIT_EBAREREPO
);
cl_assert_equal_i
(
0
,
git_push_unpack_ok
(
push
));
/* Clean up */
git_remote_free
(
localremote
);
cl_fixture_cleanup
(
"localbare.git"
);
}
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