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
7c353afd
Commit
7c353afd
authored
Dec 13, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define constant for default fetch spec
parent
44f36f6e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
7 deletions
+15
-7
include/git2/remote.h
+8
-0
src/remote.c
+1
-1
tests-clar/clone/network.c
+2
-2
tests-clar/clone/nonetwork.c
+2
-2
tests-clar/fetchhead/network.c
+1
-1
tests-clar/network/fetch.c
+1
-1
No files found.
include/git2/remote.h
View file @
7c353afd
...
...
@@ -24,6 +24,14 @@
*/
GIT_BEGIN_DECL
/**
* Use this when creating a remote with git_remote_new to get the default fetch
* behavior produced by git_remote_add. It corresponds to this fetchspec (note
* the spaces between '/' and '*' to avoid C compiler errors):
* "+refs/heads/ *:refs/remotes/<remote_name>/ *"
*/
#define GIT_REMOTE_DEFAULT_FETCH ""
typedef
int
(
*
git_remote_rename_problem_cb
)(
const
char
*
problematic_refspec
,
void
*
payload
);
/*
* TODO: This functions still need to be implemented:
...
...
src/remote.c
View file @
7c353afd
...
...
@@ -115,7 +115,7 @@ int git_remote_new(git_remote **out, git_repository *repo, const char *name, con
GITERR_CHECK_ALLOC
(
remote
->
name
);
/* An empty name indicates to use a sensible default for the fetchspec. */
if
(
fetch
&&
strlen
(
fetch
)
==
0
)
{
if
(
fetch
&&
!
(
*
fetch
)
)
{
if
(
git_buf_printf
(
&
fetchbuf
,
"+refs/heads/*:refs/remotes/%s/*"
,
remote
->
name
)
<
0
)
goto
on_error
;
fetch
=
git_buf_cstr
(
&
fetchbuf
);
...
...
tests-clar/clone/network.c
View file @
7c353afd
...
...
@@ -14,7 +14,7 @@ static git_remote *g_origin;
void
test_clone_network__initialize
(
void
)
{
g_repo
=
NULL
;
cl_git_pass
(
git_remote_new
(
&
g_origin
,
NULL
,
"origin"
,
LIVE_REPO_URL
,
""
));
cl_git_pass
(
git_remote_new
(
&
g_origin
,
NULL
,
"origin"
,
LIVE_REPO_URL
,
GIT_REMOTE_DEFAULT_FETCH
));
}
static
void
cleanup_repository
(
void
*
path
)
...
...
@@ -70,7 +70,7 @@ void test_clone_network__empty_repository(void)
cl_set_cleanup
(
&
cleanup_repository
,
"./empty"
);
git_remote_free
(
g_origin
);
cl_git_pass
(
git_remote_new
(
&
g_origin
,
NULL
,
"origin"
,
LIVE_EMPTYREPO_URL
,
""
));
cl_git_pass
(
git_remote_new
(
&
g_origin
,
NULL
,
"origin"
,
LIVE_EMPTYREPO_URL
,
GIT_REMOTE_DEFAULT_FETCH
));
cl_git_pass
(
git_clone
(
&
g_repo
,
g_origin
,
"./empty"
,
NULL
,
NULL
,
NULL
));
...
...
tests-clar/clone/nonetwork.c
View file @
7c353afd
...
...
@@ -11,7 +11,7 @@ static git_remote *g_origin = NULL;
void
test_clone_nonetwork__initialize
(
void
)
{
g_repo
=
NULL
;
cl_git_pass
(
git_remote_new
(
&
g_origin
,
NULL
,
"origin"
,
cl_git_fixture_url
(
"testrepo.git"
),
""
));
cl_git_pass
(
git_remote_new
(
&
g_origin
,
NULL
,
"origin"
,
cl_git_fixture_url
(
"testrepo.git"
),
GIT_REMOTE_DEFAULT_FETCH
));
}
static
void
cleanup_repository
(
void
*
path
)
...
...
@@ -28,7 +28,7 @@ void test_clone_nonetwork__bad_url(void)
{
/* Clone should clean up the mess if the URL isn't a git repository */
git_remote_free
(
g_origin
);
cl_git_pass
(
git_remote_new
(
&
g_origin
,
NULL
,
"origin"
,
"not_a_repo"
,
NULL
));
cl_git_pass
(
git_remote_new
(
&
g_origin
,
NULL
,
"origin"
,
"not_a_repo"
,
GIT_REMOTE_DEFAULT_FETCH
));
cl_git_fail
(
git_clone
(
&
g_repo
,
g_origin
,
"./foo"
,
NULL
,
NULL
,
NULL
));
cl_assert
(
!
git_path_exists
(
"./foo"
));
...
...
tests-clar/fetchhead/network.c
View file @
7c353afd
...
...
@@ -15,7 +15,7 @@ static git_remote *g_origin;
void
test_fetchhead_network__initialize
(
void
)
{
g_repo
=
NULL
;
cl_git_pass
(
git_remote_new
(
&
g_origin
,
NULL
,
"origin"
,
LIVE_REPO_URL
,
""
));
cl_git_pass
(
git_remote_new
(
&
g_origin
,
NULL
,
"origin"
,
LIVE_REPO_URL
,
GIT_REMOTE_DEFAULT_FETCH
));
}
void
test_fetchhead_network__cleanup
(
void
)
...
...
tests-clar/network/fetch.c
View file @
7c353afd
...
...
@@ -89,7 +89,7 @@ void test_network_fetch__doesnt_retrieve_a_pack_when_the_repository_is_up_to_dat
git_remote
*
remote
;
bool
invoked
=
false
;
cl_git_pass
(
git_remote_new
(
&
remote
,
NULL
,
"origin"
,
"https://github.com/libgit2/TestGitRepository.git"
,
""
));
cl_git_pass
(
git_remote_new
(
&
remote
,
NULL
,
"origin"
,
"https://github.com/libgit2/TestGitRepository.git"
,
GIT_REMOTE_DEFAULT_FETCH
));
cl_git_pass
(
git_clone_bare
(
&
_repository
,
remote
,
"./fetch/lg2"
,
NULL
,
NULL
));
git_repository_free
(
_repository
);
...
...
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