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
bc8c4a8a
Commit
bc8c4a8a
authored
Nov 08, 2014
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2695 from libgit2/cmn/remote-lookup
remote: rename _load() to _lookup()
parents
e3bd48a7
209425ce
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
45 additions
and
42 deletions
+45
-42
CHANGELOG.md
+3
-0
examples/network/fetch.c
+1
-1
examples/network/ls-remote.c
+1
-1
include/git2/remote.h
+1
-1
src/branch.c
+3
-3
src/remote.c
+4
-4
src/submodule.c
+2
-2
tests/clone/local.c
+2
-2
tests/clone/nonetwork.c
+2
-2
tests/fetchhead/nonetwork.c
+1
-1
tests/network/fetchlocal.c
+2
-2
tests/network/remote/createthenload.c
+1
-1
tests/network/remote/remotes.c
+12
-12
tests/network/remote/rename.c
+4
-4
tests/online/clone.c
+2
-2
tests/online/fetch.c
+1
-1
tests/online/fetchhead.c
+1
-1
tests/repo/init.c
+1
-1
tests/submodule/add.c
+1
-1
No files found.
CHANGELOG.md
View file @
bc8c4a8a
...
@@ -85,6 +85,9 @@ v0.21 + 1
...
@@ -85,6 +85,9 @@ v0.21 + 1
resfpecs to be the active list, similarly to how git fetch accepts a
resfpecs to be the active list, similarly to how git fetch accepts a
list on the command-line.
list on the command-line.
*
Rename git_remote_load() to git_remote_lookup() to bring it in line
with the rest of the lookup functions.
*
Introduce git_merge_bases() and the git_oidarray type to expose all
*
Introduce git_merge_bases() and the git_oidarray type to expose all
merge bases between two commits.
merge bases between two commits.
...
...
examples/network/fetch.c
View file @
bc8c4a8a
...
@@ -90,7 +90,7 @@ int fetch(git_repository *repo, int argc, char **argv)
...
@@ -90,7 +90,7 @@ int fetch(git_repository *repo, int argc, char **argv)
// Figure out whether it's a named remote or a URL
// Figure out whether it's a named remote or a URL
printf
(
"Fetching %s for repo %p
\n
"
,
argv
[
1
],
repo
);
printf
(
"Fetching %s for repo %p
\n
"
,
argv
[
1
],
repo
);
if
(
git_remote_lo
ad
(
&
remote
,
repo
,
argv
[
1
])
<
0
)
{
if
(
git_remote_lo
okup
(
&
remote
,
repo
,
argv
[
1
])
<
0
)
{
if
(
git_remote_create_anonymous
(
&
remote
,
repo
,
argv
[
1
],
NULL
)
<
0
)
if
(
git_remote_create_anonymous
(
&
remote
,
repo
,
argv
[
1
],
NULL
)
<
0
)
return
-
1
;
return
-
1
;
}
}
...
...
examples/network/ls-remote.c
View file @
bc8c4a8a
...
@@ -13,7 +13,7 @@ static int use_remote(git_repository *repo, char *name)
...
@@ -13,7 +13,7 @@ static int use_remote(git_repository *repo, char *name)
git_remote_callbacks
callbacks
=
GIT_REMOTE_CALLBACKS_INIT
;
git_remote_callbacks
callbacks
=
GIT_REMOTE_CALLBACKS_INIT
;
// Find the remote by name
// Find the remote by name
error
=
git_remote_lo
ad
(
&
remote
,
repo
,
name
);
error
=
git_remote_lo
okup
(
&
remote
,
repo
,
name
);
if
(
error
<
0
)
{
if
(
error
<
0
)
{
error
=
git_remote_create_anonymous
(
&
remote
,
repo
,
name
,
NULL
);
error
=
git_remote_create_anonymous
(
&
remote
,
repo
,
name
,
NULL
);
if
(
error
<
0
)
if
(
error
<
0
)
...
...
include/git2/remote.h
View file @
bc8c4a8a
...
@@ -94,7 +94,7 @@ GIT_EXTERN(int) git_remote_create_anonymous(
...
@@ -94,7 +94,7 @@ GIT_EXTERN(int) git_remote_create_anonymous(
* @param name the remote's name
* @param name the remote's name
* @return 0, GIT_ENOTFOUND, GIT_EINVALIDSPEC or an error code
* @return 0, GIT_ENOTFOUND, GIT_EINVALIDSPEC or an error code
*/
*/
GIT_EXTERN
(
int
)
git_remote_lo
ad
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
);
GIT_EXTERN
(
int
)
git_remote_lo
okup
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
);
/**
/**
* Save a remote to its repository's configuration
* Save a remote to its repository's configuration
...
...
src/branch.c
View file @
bc8c4a8a
...
@@ -360,7 +360,7 @@ int git_branch_upstream_name(
...
@@ -360,7 +360,7 @@ int git_branch_upstream_name(
}
}
if
(
strcmp
(
"."
,
remote_name
)
!=
0
)
{
if
(
strcmp
(
"."
,
remote_name
)
!=
0
)
{
if
((
error
=
git_remote_lo
ad
(
&
remote
,
repo
,
remote_name
))
<
0
)
if
((
error
=
git_remote_lo
okup
(
&
remote
,
repo
,
remote_name
))
<
0
)
goto
cleanup
;
goto
cleanup
;
refspec
=
git_remote__matching_refspec
(
remote
,
merge_name
);
refspec
=
git_remote__matching_refspec
(
remote
,
merge_name
);
...
@@ -411,7 +411,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
...
@@ -411,7 +411,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
/* Find matching remotes */
/* Find matching remotes */
for
(
i
=
0
;
i
<
remote_list
.
count
;
i
++
)
{
for
(
i
=
0
;
i
<
remote_list
.
count
;
i
++
)
{
if
((
error
=
git_remote_lo
ad
(
&
remote
,
repo
,
remote_list
.
strings
[
i
]))
<
0
)
if
((
error
=
git_remote_lo
okup
(
&
remote
,
repo
,
remote_list
.
strings
[
i
]))
<
0
)
continue
;
continue
;
fetchspec
=
git_remote__matching_dst_refspec
(
remote
,
refname
);
fetchspec
=
git_remote__matching_dst_refspec
(
remote
,
refname
);
...
@@ -556,7 +556,7 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
...
@@ -556,7 +556,7 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
goto
on_error
;
goto
on_error
;
}
else
{
}
else
{
/* Get the remoe-tracking branch's refname in its repo */
/* Get the remoe-tracking branch's refname in its repo */
if
(
git_remote_lo
ad
(
&
remote
,
repo
,
git_buf_cstr
(
&
value
))
<
0
)
if
(
git_remote_lo
okup
(
&
remote
,
repo
,
git_buf_cstr
(
&
value
))
<
0
)
goto
on_error
;
goto
on_error
;
fetchspec
=
git_remote__matching_dst_refspec
(
remote
,
git_reference_name
(
upstream
));
fetchspec
=
git_remote__matching_dst_refspec
(
remote
,
git_reference_name
(
upstream
));
...
...
src/remote.c
View file @
bc8c4a8a
...
@@ -186,7 +186,7 @@ static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
...
@@ -186,7 +186,7 @@ static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
int
error
;
int
error
;
git_remote
*
remote
;
git_remote
*
remote
;
error
=
git_remote_lo
ad
(
&
remote
,
repo
,
name
);
error
=
git_remote_lo
okup
(
&
remote
,
repo
,
name
);
if
(
error
==
GIT_ENOTFOUND
)
if
(
error
==
GIT_ENOTFOUND
)
return
0
;
return
0
;
...
@@ -350,7 +350,7 @@ static int get_optional_config(
...
@@ -350,7 +350,7 @@ static int get_optional_config(
return
error
;
return
error
;
}
}
int
git_remote_lo
ad
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
)
int
git_remote_lo
okup
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
)
{
{
git_remote
*
remote
;
git_remote
*
remote
;
git_buf
buf
=
GIT_BUF_INIT
;
git_buf
buf
=
GIT_BUF_INIT
;
...
@@ -1677,7 +1677,7 @@ int git_remote_rename(git_strarray *out, git_repository *repo, const char *name,
...
@@ -1677,7 +1677,7 @@ int git_remote_rename(git_strarray *out, git_repository *repo, const char *name,
assert
(
out
&&
repo
&&
name
&&
new_name
);
assert
(
out
&&
repo
&&
name
&&
new_name
);
if
((
error
=
git_remote_lo
ad
(
&
remote
,
repo
,
name
))
<
0
)
if
((
error
=
git_remote_lo
okup
(
&
remote
,
repo
,
name
))
<
0
)
return
error
;
return
error
;
if
((
error
=
ensure_remote_name_is_valid
(
new_name
))
<
0
)
if
((
error
=
ensure_remote_name_is_valid
(
new_name
))
<
0
)
...
@@ -2010,7 +2010,7 @@ static int remove_remote_tracking(git_repository *repo, const char *remote_name)
...
@@ -2010,7 +2010,7 @@ static int remove_remote_tracking(git_repository *repo, const char *remote_name)
size_t
i
,
count
;
size_t
i
,
count
;
/* we want to use what's on the config, regardless of changes to the instance in memory */
/* we want to use what's on the config, regardless of changes to the instance in memory */
if
((
error
=
git_remote_lo
ad
(
&
remote
,
repo
,
remote_name
))
<
0
)
if
((
error
=
git_remote_lo
okup
(
&
remote
,
repo
,
remote_name
))
<
0
)
return
error
;
return
error
;
count
=
git_remote_refspec_count
(
remote
);
count
=
git_remote_refspec_count
(
remote
);
...
...
src/submodule.c
View file @
bc8c4a8a
...
@@ -1876,7 +1876,7 @@ static int lookup_head_remote(git_remote **remote, git_repository *repo)
...
@@ -1876,7 +1876,7 @@ static int lookup_head_remote(git_remote **remote, git_repository *repo)
/* lookup remote of remote tracking branch name */
/* lookup remote of remote tracking branch name */
if
(
!
(
error
=
lookup_head_remote_key
(
&
remote_name
,
repo
)))
if
(
!
(
error
=
lookup_head_remote_key
(
&
remote_name
,
repo
)))
error
=
git_remote_lo
ad
(
remote
,
repo
,
remote_name
.
ptr
);
error
=
git_remote_lo
okup
(
remote
,
repo
,
remote_name
.
ptr
);
git_buf_free
(
&
remote_name
);
git_buf_free
(
&
remote_name
);
...
@@ -1890,7 +1890,7 @@ static int lookup_default_remote(git_remote **remote, git_repository *repo)
...
@@ -1890,7 +1890,7 @@ static int lookup_default_remote(git_remote **remote, git_repository *repo)
/* if that failed, use 'origin' instead */
/* if that failed, use 'origin' instead */
if
(
error
==
GIT_ENOTFOUND
)
if
(
error
==
GIT_ENOTFOUND
)
error
=
git_remote_lo
ad
(
remote
,
repo
,
"origin"
);
error
=
git_remote_lo
okup
(
remote
,
repo
,
"origin"
);
if
(
error
==
GIT_ENOTFOUND
)
if
(
error
==
GIT_ENOTFOUND
)
giterr_set
(
giterr_set
(
...
...
tests/clone/local.c
View file @
bc8c4a8a
...
@@ -171,7 +171,7 @@ void test_clone_local__standard_unc_paths_are_written_git_style(void)
...
@@ -171,7 +171,7 @@ void test_clone_local__standard_unc_paths_are_written_git_style(void)
cl_git_pass
(
git_style_unc_path
(
&
git_unc
,
"localhost"
,
path
));
cl_git_pass
(
git_style_unc_path
(
&
git_unc
,
"localhost"
,
path
));
cl_git_pass
(
git_clone
(
&
repo
,
unc
.
ptr
,
"./clone.git"
,
&
opts
));
cl_git_pass
(
git_clone
(
&
repo
,
unc
.
ptr
,
"./clone.git"
,
&
opts
));
cl_git_pass
(
git_remote_lo
ad
(
&
remote
,
repo
,
"origin"
));
cl_git_pass
(
git_remote_lo
okup
(
&
remote
,
repo
,
"origin"
));
cl_assert_equal_s
(
git_unc
.
ptr
,
git_remote_url
(
remote
));
cl_assert_equal_s
(
git_unc
.
ptr
,
git_remote_url
(
remote
));
...
@@ -198,7 +198,7 @@ void test_clone_local__git_style_unc_paths(void)
...
@@ -198,7 +198,7 @@ void test_clone_local__git_style_unc_paths(void)
cl_git_pass
(
git_style_unc_path
(
&
git_unc
,
"localhost"
,
path
));
cl_git_pass
(
git_style_unc_path
(
&
git_unc
,
"localhost"
,
path
));
cl_git_pass
(
git_clone
(
&
repo
,
git_unc
.
ptr
,
"./clone.git"
,
&
opts
));
cl_git_pass
(
git_clone
(
&
repo
,
git_unc
.
ptr
,
"./clone.git"
,
&
opts
));
cl_git_pass
(
git_remote_lo
ad
(
&
remote
,
repo
,
"origin"
));
cl_git_pass
(
git_remote_lo
okup
(
&
remote
,
repo
,
"origin"
));
cl_assert_equal_s
(
git_unc
.
ptr
,
git_remote_url
(
remote
));
cl_assert_equal_s
(
git_unc
.
ptr
,
git_remote_url
(
remote
));
...
...
tests/clone/nonetwork.c
View file @
bc8c4a8a
...
@@ -128,14 +128,14 @@ void test_clone_nonetwork__custom_origin_name(void)
...
@@ -128,14 +128,14 @@ void test_clone_nonetwork__custom_origin_name(void)
g_options
.
remote_cb
=
custom_origin_name_remote_create
;
g_options
.
remote_cb
=
custom_origin_name_remote_create
;
cl_git_pass
(
git_clone
(
&
g_repo
,
cl_git_fixture_url
(
"testrepo.git"
),
"./foo"
,
&
g_options
));
cl_git_pass
(
git_clone
(
&
g_repo
,
cl_git_fixture_url
(
"testrepo.git"
),
"./foo"
,
&
g_options
));
cl_git_pass
(
git_remote_lo
ad
(
&
g_remote
,
g_repo
,
"my_origin"
));
cl_git_pass
(
git_remote_lo
okup
(
&
g_remote
,
g_repo
,
"my_origin"
));
}
}
void
test_clone_nonetwork__defaults
(
void
)
void
test_clone_nonetwork__defaults
(
void
)
{
{
cl_git_pass
(
git_clone
(
&
g_repo
,
cl_git_fixture_url
(
"testrepo.git"
),
"./foo"
,
NULL
));
cl_git_pass
(
git_clone
(
&
g_repo
,
cl_git_fixture_url
(
"testrepo.git"
),
"./foo"
,
NULL
));
cl_assert
(
g_repo
);
cl_assert
(
g_repo
);
cl_git_pass
(
git_remote_lo
ad
(
&
g_remote
,
g_repo
,
"origin"
));
cl_git_pass
(
git_remote_lo
okup
(
&
g_remote
,
g_repo
,
"origin"
));
}
}
void
test_clone_nonetwork__cope_with_already_existing_directory
(
void
)
void
test_clone_nonetwork__cope_with_already_existing_directory
(
void
)
...
...
tests/fetchhead/nonetwork.c
View file @
bc8c4a8a
...
@@ -331,7 +331,7 @@ void test_fetchhead_nonetwork__unborn_with_upstream(void)
...
@@ -331,7 +331,7 @@ void test_fetchhead_nonetwork__unborn_with_upstream(void)
cl_git_pass
(
git_clone
(
&
repo
,
"./test1"
,
"./repowithunborn"
,
NULL
));
cl_git_pass
(
git_clone
(
&
repo
,
"./test1"
,
"./repowithunborn"
,
NULL
));
/* Simulate someone pushing to it by changing to one that has stuff */
/* Simulate someone pushing to it by changing to one that has stuff */
cl_git_pass
(
git_remote_lo
ad
(
&
remote
,
repo
,
"origin"
));
cl_git_pass
(
git_remote_lo
okup
(
&
remote
,
repo
,
"origin"
));
cl_git_pass
(
git_remote_set_url
(
remote
,
cl_fixture
(
"testrepo.git"
)));
cl_git_pass
(
git_remote_set_url
(
remote
,
cl_fixture
(
"testrepo.git"
)));
cl_git_pass
(
git_remote_save
(
remote
));
cl_git_pass
(
git_remote_save
(
remote
));
...
...
tests/network/fetchlocal.c
View file @
bc8c4a8a
...
@@ -137,7 +137,7 @@ void test_network_fetchlocal__multi_remotes(void)
...
@@ -137,7 +137,7 @@ void test_network_fetchlocal__multi_remotes(void)
cl_set_cleanup
(
&
cleanup_sandbox
,
NULL
);
cl_set_cleanup
(
&
cleanup_sandbox
,
NULL
);
callbacks
.
transfer_progress
=
transfer_cb
;
callbacks
.
transfer_progress
=
transfer_cb
;
cl_git_pass
(
git_remote_lo
ad
(
&
test
,
repo
,
"test"
));
cl_git_pass
(
git_remote_lo
okup
(
&
test
,
repo
,
"test"
));
cl_git_pass
(
git_remote_set_url
(
test
,
cl_git_fixture_url
(
"testrepo.git"
)));
cl_git_pass
(
git_remote_set_url
(
test
,
cl_git_fixture_url
(
"testrepo.git"
)));
git_remote_set_callbacks
(
test
,
&
callbacks
);
git_remote_set_callbacks
(
test
,
&
callbacks
);
cl_git_pass
(
git_remote_connect
(
test
,
GIT_DIRECTION_FETCH
));
cl_git_pass
(
git_remote_connect
(
test
,
GIT_DIRECTION_FETCH
));
...
@@ -148,7 +148,7 @@ void test_network_fetchlocal__multi_remotes(void)
...
@@ -148,7 +148,7 @@ void test_network_fetchlocal__multi_remotes(void)
cl_assert_equal_i
(
32
,
(
int
)
refnames
.
count
);
cl_assert_equal_i
(
32
,
(
int
)
refnames
.
count
);
git_strarray_free
(
&
refnames
);
git_strarray_free
(
&
refnames
);
cl_git_pass
(
git_remote_lo
ad
(
&
test2
,
repo
,
"test_with_pushurl"
));
cl_git_pass
(
git_remote_lo
okup
(
&
test2
,
repo
,
"test_with_pushurl"
));
cl_git_pass
(
git_remote_set_url
(
test2
,
cl_git_fixture_url
(
"testrepo.git"
)));
cl_git_pass
(
git_remote_set_url
(
test2
,
cl_git_fixture_url
(
"testrepo.git"
)));
git_remote_set_callbacks
(
test2
,
&
callbacks
);
git_remote_set_callbacks
(
test2
,
&
callbacks
);
cl_git_pass
(
git_remote_connect
(
test2
,
GIT_DIRECTION_FETCH
));
cl_git_pass
(
git_remote_connect
(
test2
,
GIT_DIRECTION_FETCH
));
...
...
tests/network/remote/createthenload.c
View file @
bc8c4a8a
...
@@ -16,7 +16,7 @@ void test_network_remote_createthenload__initialize(void)
...
@@ -16,7 +16,7 @@ void test_network_remote_createthenload__initialize(void)
cl_git_pass
(
git_config_set_string
(
_config
,
"remote.origin.url"
,
url
));
cl_git_pass
(
git_config_set_string
(
_config
,
"remote.origin.url"
,
url
));
git_config_free
(
_config
);
git_config_free
(
_config
);
cl_git_pass
(
git_remote_lo
ad
(
&
_remote
,
_repo
,
"origin"
));
cl_git_pass
(
git_remote_lo
okup
(
&
_remote
,
_repo
,
"origin"
));
}
}
void
test_network_remote_createthenload__cleanup
(
void
)
void
test_network_remote_createthenload__cleanup
(
void
)
...
...
tests/network/remote/remotes.c
View file @
bc8c4a8a
...
@@ -11,7 +11,7 @@ void test_network_remote_remotes__initialize(void)
...
@@ -11,7 +11,7 @@ void test_network_remote_remotes__initialize(void)
{
{
_repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
_repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
cl_git_pass
(
git_remote_lo
ad
(
&
_remote
,
_repo
,
"test"
));
cl_git_pass
(
git_remote_lo
okup
(
&
_remote
,
_repo
,
"test"
));
_refspec
=
git_remote_get_refspec
(
_remote
,
0
);
_refspec
=
git_remote_get_refspec
(
_remote
,
0
);
cl_assert
(
_refspec
!=
NULL
);
cl_assert
(
_refspec
!=
NULL
);
...
@@ -38,7 +38,7 @@ void test_network_remote_remotes__parsing(void)
...
@@ -38,7 +38,7 @@ void test_network_remote_remotes__parsing(void)
cl_assert_equal_s
(
git_remote__urlfordirection
(
_remote
,
GIT_DIRECTION_PUSH
),
cl_assert_equal_s
(
git_remote__urlfordirection
(
_remote
,
GIT_DIRECTION_PUSH
),
"git://github.com/libgit2/libgit2"
);
"git://github.com/libgit2/libgit2"
);
cl_git_pass
(
git_remote_lo
ad
(
&
_remote2
,
_repo
,
"test_with_pushurl"
));
cl_git_pass
(
git_remote_lo
okup
(
&
_remote2
,
_repo
,
"test_with_pushurl"
));
cl_assert_equal_s
(
git_remote_name
(
_remote2
),
"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_url
(
_remote2
),
"git://github.com/libgit2/fetchlibgit2"
);
cl_assert_equal_s
(
git_remote_pushurl
(
_remote2
),
"git://github.com/libgit2/pushlibgit2"
);
cl_assert_equal_s
(
git_remote_pushurl
(
_remote2
),
"git://github.com/libgit2/pushlibgit2"
);
...
@@ -63,7 +63,7 @@ void test_network_remote_remotes__pushurl(void)
...
@@ -63,7 +63,7 @@ void test_network_remote_remotes__pushurl(void)
void
test_network_remote_remotes__error_when_not_found
(
void
)
void
test_network_remote_remotes__error_when_not_found
(
void
)
{
{
git_remote
*
r
;
git_remote
*
r
;
cl_git_fail_with
(
git_remote_lo
ad
(
&
r
,
_repo
,
"does-not-exist"
),
GIT_ENOTFOUND
);
cl_git_fail_with
(
git_remote_lo
okup
(
&
r
,
_repo
,
"does-not-exist"
),
GIT_ENOTFOUND
);
cl_assert
(
giterr_last
()
!=
NULL
);
cl_assert
(
giterr_last
()
!=
NULL
);
cl_assert
(
giterr_last
()
->
klass
==
GITERR_CONFIG
);
cl_assert
(
giterr_last
()
->
klass
==
GITERR_CONFIG
);
...
@@ -181,7 +181,7 @@ void test_network_remote_remotes__save(void)
...
@@ -181,7 +181,7 @@ void test_network_remote_remotes__save(void)
_remote
=
NULL
;
_remote
=
NULL
;
/* Load it from config and make sure everything matches */
/* Load it from config and make sure everything matches */
cl_git_pass
(
git_remote_lo
ad
(
&
_remote
,
_repo
,
"upstream"
));
cl_git_pass
(
git_remote_lo
okup
(
&
_remote
,
_repo
,
"upstream"
));
cl_git_pass
(
git_remote_get_fetch_refspecs
(
&
array
,
_remote
));
cl_git_pass
(
git_remote_get_fetch_refspecs
(
&
array
,
_remote
));
cl_assert_equal_i
(
2
,
(
int
)
array
.
count
);
cl_assert_equal_i
(
2
,
(
int
)
array
.
count
);
...
@@ -204,7 +204,7 @@ void test_network_remote_remotes__save(void)
...
@@ -204,7 +204,7 @@ void test_network_remote_remotes__save(void)
git_remote_free
(
_remote
);
git_remote_free
(
_remote
);
_remote
=
NULL
;
_remote
=
NULL
;
cl_git_pass
(
git_remote_lo
ad
(
&
_remote
,
_repo
,
"upstream"
));
cl_git_pass
(
git_remote_lo
okup
(
&
_remote
,
_repo
,
"upstream"
));
cl_assert
(
git_remote_pushurl
(
_remote
)
==
NULL
);
cl_assert
(
git_remote_pushurl
(
_remote
)
==
NULL
);
}
}
...
@@ -241,7 +241,7 @@ void test_network_remote_remotes__missing_refspecs(void)
...
@@ -241,7 +241,7 @@ void test_network_remote_remotes__missing_refspecs(void)
cl_git_pass
(
git_repository_config
(
&
cfg
,
_repo
));
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_config_set_string
(
cfg
,
"remote.specless.url"
,
"http://example.com"
));
cl_git_pass
(
git_remote_lo
ad
(
&
_remote
,
_repo
,
"specless"
));
cl_git_pass
(
git_remote_lo
okup
(
&
_remote
,
_repo
,
"specless"
));
git_config_free
(
cfg
);
git_config_free
(
cfg
);
}
}
...
@@ -302,7 +302,7 @@ void test_network_remote_remotes__loading_a_missing_remote_returns_ENOTFOUND(voi
...
@@ -302,7 +302,7 @@ void test_network_remote_remotes__loading_a_missing_remote_returns_ENOTFOUND(voi
git_remote_free
(
_remote
);
git_remote_free
(
_remote
);
_remote
=
NULL
;
_remote
=
NULL
;
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_remote_lo
ad
(
&
_remote
,
_repo
,
"just-left-few-minutes-ago"
));
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_remote_lo
okup
(
&
_remote
,
_repo
,
"just-left-few-minutes-ago"
));
}
}
void
test_network_remote_remotes__loading_with_an_invalid_name_returns_EINVALIDSPEC
(
void
)
void
test_network_remote_remotes__loading_with_an_invalid_name_returns_EINVALIDSPEC
(
void
)
...
@@ -310,7 +310,7 @@ void test_network_remote_remotes__loading_with_an_invalid_name_returns_EINVALIDS
...
@@ -310,7 +310,7 @@ void test_network_remote_remotes__loading_with_an_invalid_name_returns_EINVALIDS
git_remote_free
(
_remote
);
git_remote_free
(
_remote
);
_remote
=
NULL
;
_remote
=
NULL
;
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_remote_lo
ad
(
&
_remote
,
_repo
,
"Inv@{id"
));
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_remote_lo
okup
(
&
_remote
,
_repo
,
"Inv@{id"
));
}
}
/*
/*
...
@@ -333,7 +333,7 @@ void test_network_remote_remotes__add(void)
...
@@ -333,7 +333,7 @@ void test_network_remote_remotes__add(void)
git_remote_free
(
_remote
);
git_remote_free
(
_remote
);
_remote
=
NULL
;
_remote
=
NULL
;
cl_git_pass
(
git_remote_lo
ad
(
&
_remote
,
_repo
,
"addtest"
));
cl_git_pass
(
git_remote_lo
okup
(
&
_remote
,
_repo
,
"addtest"
));
cl_assert_equal_i
(
GIT_REMOTE_DOWNLOAD_TAGS_AUTO
,
git_remote_autotag
(
_remote
));
cl_assert_equal_i
(
GIT_REMOTE_DOWNLOAD_TAGS_AUTO
,
git_remote_autotag
(
_remote
));
_refspec
=
git_vector_get
(
&
_remote
->
refspecs
,
0
);
_refspec
=
git_vector_get
(
&
_remote
->
refspecs
,
0
);
...
@@ -407,7 +407,7 @@ void test_network_remote_remotes__can_load_with_an_empty_url(void)
...
@@ -407,7 +407,7 @@ void test_network_remote_remotes__can_load_with_an_empty_url(void)
{
{
git_remote
*
remote
=
NULL
;
git_remote
*
remote
=
NULL
;
cl_git_pass
(
git_remote_lo
ad
(
&
remote
,
_repo
,
"empty-remote-url"
));
cl_git_pass
(
git_remote_lo
okup
(
&
remote
,
_repo
,
"empty-remote-url"
));
cl_assert
(
remote
->
url
==
NULL
);
cl_assert
(
remote
->
url
==
NULL
);
cl_assert
(
remote
->
pushurl
==
NULL
);
cl_assert
(
remote
->
pushurl
==
NULL
);
...
@@ -424,7 +424,7 @@ void test_network_remote_remotes__can_load_with_only_an_empty_pushurl(void)
...
@@ -424,7 +424,7 @@ void test_network_remote_remotes__can_load_with_only_an_empty_pushurl(void)
{
{
git_remote
*
remote
=
NULL
;
git_remote
*
remote
=
NULL
;
cl_git_pass
(
git_remote_lo
ad
(
&
remote
,
_repo
,
"empty-remote-pushurl"
));
cl_git_pass
(
git_remote_lo
okup
(
&
remote
,
_repo
,
"empty-remote-pushurl"
));
cl_assert
(
remote
->
url
==
NULL
);
cl_assert
(
remote
->
url
==
NULL
);
cl_assert
(
remote
->
pushurl
==
NULL
);
cl_assert
(
remote
->
pushurl
==
NULL
);
...
@@ -439,7 +439,7 @@ void test_network_remote_remotes__returns_ENOTFOUND_when_neither_url_nor_pushurl
...
@@ -439,7 +439,7 @@ void test_network_remote_remotes__returns_ENOTFOUND_when_neither_url_nor_pushurl
git_remote
*
remote
=
NULL
;
git_remote
*
remote
=
NULL
;
cl_git_fail_with
(
cl_git_fail_with
(
git_remote_lo
ad
(
&
remote
,
_repo
,
"no-remote-url"
),
GIT_ENOTFOUND
);
git_remote_lo
okup
(
&
remote
,
_repo
,
"no-remote-url"
),
GIT_ENOTFOUND
);
}
}
void
assert_cannot_create_remote
(
const
char
*
name
,
int
expected_error
)
void
assert_cannot_create_remote
(
const
char
*
name
,
int
expected_error
)
...
...
tests/network/remote/rename.c
View file @
bc8c4a8a
...
@@ -74,7 +74,7 @@ void test_network_remote_rename__renaming_a_remote_without_a_fetchrefspec_doesnt
...
@@ -74,7 +74,7 @@ void test_network_remote_rename__renaming_a_remote_without_a_fetchrefspec_doesnt
cl_git_pass
(
git_repository_config__weakptr
(
&
config
,
_repo
));
cl_git_pass
(
git_repository_config__weakptr
(
&
config
,
_repo
));
cl_git_pass
(
git_config_delete_entry
(
config
,
"remote.test.fetch"
));
cl_git_pass
(
git_config_delete_entry
(
config
,
"remote.test.fetch"
));
cl_git_pass
(
git_remote_lo
ad
(
&
remote
,
_repo
,
"test"
));
cl_git_pass
(
git_remote_lo
okup
(
&
remote
,
_repo
,
"test"
));
git_remote_free
(
remote
);
git_remote_free
(
remote
);
assert_config_entry_existence
(
_repo
,
"remote.test.fetch"
,
false
);
assert_config_entry_existence
(
_repo
,
"remote.test.fetch"
,
false
);
...
@@ -94,7 +94,7 @@ void test_network_remote_rename__renaming_a_remote_notifies_of_non_default_fetch
...
@@ -94,7 +94,7 @@ void test_network_remote_rename__renaming_a_remote_notifies_of_non_default_fetch
cl_git_pass
(
git_repository_config__weakptr
(
&
config
,
_repo
));
cl_git_pass
(
git_repository_config__weakptr
(
&
config
,
_repo
));
cl_git_pass
(
git_config_set_string
(
config
,
"remote.test.fetch"
,
"+refs/*:refs/*"
));
cl_git_pass
(
git_config_set_string
(
config
,
"remote.test.fetch"
,
"+refs/*:refs/*"
));
cl_git_pass
(
git_remote_lo
ad
(
&
remote
,
_repo
,
"test"
));
cl_git_pass
(
git_remote_lo
okup
(
&
remote
,
_repo
,
"test"
));
git_remote_free
(
remote
);
git_remote_free
(
remote
);
cl_git_pass
(
git_remote_rename
(
&
problems
,
_repo
,
_remote_name
,
"just/renamed"
));
cl_git_pass
(
git_remote_rename
(
&
problems
,
_repo
,
_remote_name
,
"just/renamed"
));
...
@@ -132,14 +132,14 @@ void test_network_remote_rename__renamed_name_is_persisted(void)
...
@@ -132,14 +132,14 @@ void test_network_remote_rename__renamed_name_is_persisted(void)
git_repository
*
another_repo
;
git_repository
*
another_repo
;
git_strarray
problems
=
{
0
};
git_strarray
problems
=
{
0
};
cl_git_fail
(
git_remote_lo
ad
(
&
renamed
,
_repo
,
"just/renamed"
));
cl_git_fail
(
git_remote_lo
okup
(
&
renamed
,
_repo
,
"just/renamed"
));
cl_git_pass
(
git_remote_rename
(
&
problems
,
_repo
,
_remote_name
,
"just/renamed"
));
cl_git_pass
(
git_remote_rename
(
&
problems
,
_repo
,
_remote_name
,
"just/renamed"
));
cl_assert_equal_i
(
0
,
problems
.
count
);
cl_assert_equal_i
(
0
,
problems
.
count
);
git_strarray_free
(
&
problems
);
git_strarray_free
(
&
problems
);
cl_git_pass
(
git_repository_open
(
&
another_repo
,
"testrepo.git"
));
cl_git_pass
(
git_repository_open
(
&
another_repo
,
"testrepo.git"
));
cl_git_pass
(
git_remote_lo
ad
(
&
renamed
,
_repo
,
"just/renamed"
));
cl_git_pass
(
git_remote_lo
okup
(
&
renamed
,
_repo
,
"just/renamed"
));
git_remote_free
(
renamed
);
git_remote_free
(
renamed
);
git_repository_free
(
another_repo
);
git_repository_free
(
another_repo
);
...
...
tests/online/clone.c
View file @
bc8c4a8a
...
@@ -46,7 +46,7 @@ void test_online_clone__network_full(void)
...
@@ -46,7 +46,7 @@ void test_online_clone__network_full(void)
cl_git_pass
(
git_clone
(
&
g_repo
,
LIVE_REPO_URL
,
"./foo"
,
&
g_options
));
cl_git_pass
(
git_clone
(
&
g_repo
,
LIVE_REPO_URL
,
"./foo"
,
&
g_options
));
cl_assert
(
!
git_repository_is_bare
(
g_repo
));
cl_assert
(
!
git_repository_is_bare
(
g_repo
));
cl_git_pass
(
git_remote_lo
ad
(
&
origin
,
g_repo
,
"origin"
));
cl_git_pass
(
git_remote_lo
okup
(
&
origin
,
g_repo
,
"origin"
));
cl_assert_equal_i
(
GIT_REMOTE_DOWNLOAD_TAGS_AUTO
,
origin
->
download_tags
);
cl_assert_equal_i
(
GIT_REMOTE_DOWNLOAD_TAGS_AUTO
,
origin
->
download_tags
);
...
@@ -61,7 +61,7 @@ void test_online_clone__network_bare(void)
...
@@ -61,7 +61,7 @@ void test_online_clone__network_bare(void)
cl_git_pass
(
git_clone
(
&
g_repo
,
LIVE_REPO_URL
,
"./foo"
,
&
g_options
));
cl_git_pass
(
git_clone
(
&
g_repo
,
LIVE_REPO_URL
,
"./foo"
,
&
g_options
));
cl_assert
(
git_repository_is_bare
(
g_repo
));
cl_assert
(
git_repository_is_bare
(
g_repo
));
cl_git_pass
(
git_remote_lo
ad
(
&
origin
,
g_repo
,
"origin"
));
cl_git_pass
(
git_remote_lo
okup
(
&
origin
,
g_repo
,
"origin"
));
git_remote_free
(
origin
);
git_remote_free
(
origin
);
}
}
...
...
tests/online/fetch.c
View file @
bc8c4a8a
...
@@ -120,7 +120,7 @@ void test_online_fetch__doesnt_retrieve_a_pack_when_the_repository_is_up_to_date
...
@@ -120,7 +120,7 @@ void test_online_fetch__doesnt_retrieve_a_pack_when_the_repository_is_up_to_date
cl_git_pass
(
git_repository_open
(
&
_repository
,
"./fetch/lg2"
));
cl_git_pass
(
git_repository_open
(
&
_repository
,
"./fetch/lg2"
));
cl_git_pass
(
git_remote_lo
ad
(
&
remote
,
_repository
,
"origin"
));
cl_git_pass
(
git_remote_lo
okup
(
&
remote
,
_repository
,
"origin"
));
cl_git_pass
(
git_remote_connect
(
remote
,
GIT_DIRECTION_FETCH
));
cl_git_pass
(
git_remote_connect
(
remote
,
GIT_DIRECTION_FETCH
));
cl_assert_equal_i
(
false
,
invoked
);
cl_assert_equal_i
(
false
,
invoked
);
...
...
tests/online/fetchhead.c
View file @
bc8c4a8a
...
@@ -42,7 +42,7 @@ static void fetchhead_test_fetch(const char *fetchspec, const char *expected_fet
...
@@ -42,7 +42,7 @@ static void fetchhead_test_fetch(const char *fetchspec, const char *expected_fet
int
equals
=
0
;
int
equals
=
0
;
git_strarray
array
,
*
active_refs
=
NULL
;
git_strarray
array
,
*
active_refs
=
NULL
;
cl_git_pass
(
git_remote_lo
ad
(
&
remote
,
g_repo
,
"origin"
));
cl_git_pass
(
git_remote_lo
okup
(
&
remote
,
g_repo
,
"origin"
));
git_remote_set_autotag
(
remote
,
GIT_REMOTE_DOWNLOAD_TAGS_AUTO
);
git_remote_set_autotag
(
remote
,
GIT_REMOTE_DOWNLOAD_TAGS_AUTO
);
if
(
fetchspec
!=
NULL
)
{
if
(
fetchspec
!=
NULL
)
{
...
...
tests/repo/init.c
View file @
bc8c4a8a
...
@@ -358,7 +358,7 @@ void test_repo_init__extended_1(void)
...
@@ -358,7 +358,7 @@ void test_repo_init__extended_1(void)
cl_assert_equal_s
(
"refs/heads/development"
,
git_reference_symbolic_target
(
ref
));
cl_assert_equal_s
(
"refs/heads/development"
,
git_reference_symbolic_target
(
ref
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
cl_git_pass
(
git_remote_lo
ad
(
&
remote
,
_repo
,
"origin"
));
cl_git_pass
(
git_remote_lo
okup
(
&
remote
,
_repo
,
"origin"
));
cl_assert_equal_s
(
"origin"
,
git_remote_name
(
remote
));
cl_assert_equal_s
(
"origin"
,
git_remote_name
(
remote
));
cl_assert_equal_s
(
opts
.
origin_url
,
git_remote_url
(
remote
));
cl_assert_equal_s
(
opts
.
origin_url
,
git_remote_url
(
remote
));
git_remote_free
(
remote
);
git_remote_free
(
remote
);
...
...
tests/submodule/add.c
View file @
bc8c4a8a
...
@@ -97,7 +97,7 @@ void test_submodule_add__url_relative(void)
...
@@ -97,7 +97,7 @@ void test_submodule_add__url_relative(void)
cl_git_pass
(
git_remote_rename
(
&
problems
,
g_repo
,
"origin"
,
"test_remote"
));
cl_git_pass
(
git_remote_rename
(
&
problems
,
g_repo
,
"origin"
,
"test_remote"
));
cl_assert_equal_i
(
0
,
problems
.
count
);
cl_assert_equal_i
(
0
,
problems
.
count
);
git_strarray_free
(
&
problems
);
git_strarray_free
(
&
problems
);
cl_git_fail
(
git_remote_lo
ad
(
&
remote
,
g_repo
,
"origin"
));
cl_git_fail
(
git_remote_lo
okup
(
&
remote
,
g_repo
,
"origin"
));
cl_git_pass
(
cl_git_pass
(
git_submodule_add_setup
(
&
sm
,
g_repo
,
"../TestGitRepository"
,
"TestGitRepository"
,
1
)
git_submodule_add_setup
(
&
sm
,
g_repo
,
"../TestGitRepository"
,
"TestGitRepository"
,
1
)
...
...
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