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
79000951
Commit
79000951
authored
Dec 21, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In-memory remotes don't have names
parent
87bc689f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
32 deletions
+22
-32
include/git2/remote.h
+0
-2
src/remote.c
+7
-2
tests-clar/network/remotelocal.c
+1
-1
tests-clar/network/remoterename.c
+10
-23
tests-clar/network/remotes.c
+4
-4
No files found.
include/git2/remote.h
View file @
79000951
...
...
@@ -61,7 +61,6 @@ GIT_EXTERN(int) git_remote_create(
*
* @param out pointer to the new remote object
* @param repo the associated repository. May be NULL for a "dangling" remote.
* @param name the optional remote's name. May be NULL.
* @param url the remote repository's URL
* @param fetch the fetch refspec to use for this remote. May be NULL for defaults.
* @return 0, GIT_EINVALIDSPEC or an error code
...
...
@@ -69,7 +68,6 @@ GIT_EXTERN(int) git_remote_create(
GIT_EXTERN
(
int
)
git_remote_create_inmemory
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
url
,
const
char
*
fetch
);
...
...
src/remote.c
View file @
79000951
...
...
@@ -162,12 +162,12 @@ on_error:
return
-
1
;
}
int
git_remote_create_inmemory
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
url
,
const
char
*
fetch
)
int
git_remote_create_inmemory
(
git_remote
**
out
,
git_repository
*
repo
,
const
char
*
url
,
const
char
*
fetch
)
{
int
error
;
git_remote
*
remote
;
if
((
error
=
create_internal
(
&
remote
,
repo
,
name
,
url
,
fetch
))
<
0
)
if
((
error
=
create_internal
(
&
remote
,
repo
,
NULL
,
url
,
fetch
))
<
0
)
return
error
;
remote
->
inmem
=
true
;
...
...
@@ -1326,6 +1326,11 @@ int git_remote_rename(
assert
(
remote
&&
new_name
);
if
(
remote
->
inmem
)
{
giterr_set
(
GITERR_INVALID
,
"Can't rename an in-memory remote."
);
return
GIT_EINVALIDSPEC
;
}
if
((
error
=
ensure_remote_name_is_valid
(
new_name
))
<
0
)
return
error
;
...
...
tests-clar/network/remotelocal.c
View file @
79000951
...
...
@@ -50,7 +50,7 @@ static void connect_to_local_repository(const char *local_repository)
{
git_buf_sets
(
&
file_path_buf
,
cl_git_path_url
(
local_repository
));
cl_git_pass
(
git_remote_create_inmemory
(
&
remote
,
repo
,
NULL
,
git_buf_cstr
(
&
file_path_buf
),
NULL
));
cl_git_pass
(
git_remote_create_inmemory
(
&
remote
,
repo
,
git_buf_cstr
(
&
file_path_buf
),
NULL
));
cl_git_pass
(
git_remote_connect
(
remote
,
GIT_DIRECTION_FETCH
));
}
...
...
tests-clar/network/remoterename.c
View file @
79000951
...
...
@@ -148,29 +148,6 @@ void test_network_remoterename__cannot_overwrite_an_existing_remote(void)
cl_assert_equal_i
(
GIT_EEXISTS
,
git_remote_rename
(
_remote
,
"test_with_pushurl"
,
dont_call_me_cb
,
NULL
));
}
void
test_network_remoterename__renaming_an_inmemory_nameless_remote_notifies_the_inability_to_update_the_fetch_refspec
(
void
)
{
git_remote
*
remote
;
char
*
expected_refspecs
[]
=
{
"+refs/heads/*:refs/remotes/volatile/*"
,
NULL
};
assert_config_entry_existence
(
_repo
,
"remote.volatile.url"
,
false
);
cl_git_pass
(
git_remote_create_inmemory
(
&
remote
,
_repo
,
NULL
,
"git://github.com/libgit2/volatile.git"
,
"+refs/heads/*:refs/remotes/volatile/*"
));
cl_git_pass
(
git_remote_rename
(
remote
,
"durable"
,
ensure_refspecs
,
&
expected_refspecs
));
git_remote_free
(
remote
);
}
void
test_network_remoterename__renaming_a_remote_moves_the_underlying_reference
(
void
)
{
git_reference
*
underlying
;
...
...
@@ -185,3 +162,13 @@ void test_network_remoterename__renaming_a_remote_moves_the_underlying_reference
cl_git_pass
(
git_reference_lookup
(
&
underlying
,
_repo
,
"refs/remotes/just/renamed/master"
));
git_reference_free
(
underlying
);
}
void
test_network_remoterename__cannot_rename_an_inmemory_remote
(
void
)
{
git_remote
*
remote
;
cl_git_pass
(
git_remote_create_inmemory
(
&
remote
,
_repo
,
"file:///blah"
,
NULL
));
cl_git_fail
(
git_remote_rename
(
remote
,
"newname"
,
NULL
,
NULL
));
git_remote_free
(
remote
);
}
tests-clar/network/remotes.c
View file @
79000951
...
...
@@ -255,7 +255,7 @@ void test_network_remotes__cant_save_inmem_remote(void)
{
git_remote
*
remote
;
cl_git_pass
(
git_remote_create_inmemory
(
&
remote
,
_repo
,
NULL
,
"git://github.com/libgit2/libgit2"
,
NULL
));
cl_git_pass
(
git_remote_create_inmemory
(
&
remote
,
_repo
,
"git://github.com/libgit2/libgit2"
,
NULL
));
cl_git_fail
(
git_remote_save
(
remote
));
git_remote_free
(
remote
);
...
...
@@ -282,12 +282,12 @@ void test_network_remotes__cannot_initialize_a_remote_with_an_invalid_name(void)
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_remote_create
_inmemory
(
&
remote
,
_repo
,
"Inv@{id"
,
"git://github.com/libgit2/libgit2"
,
NULL
));
git_remote_create
(
&
remote
,
_repo
,
"Inv@{id"
,
"git://github.com/libgit2/libgit2"
));
cl_assert_equal_p
(
remote
,
NULL
);
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_remote_create
_inmemory
(
&
remote
,
_repo
,
""
,
"git://github.com/libgit2/libgit2"
,
NULL
));
git_remote_create
(
&
remote
,
_repo
,
""
,
"git://github.com/libgit2/libgit2"
));
cl_assert_equal_p
(
remote
,
NULL
);
}
...
...
@@ -331,7 +331,7 @@ void test_network_remotes__check_structure_version(void)
git_remote_free
(
_remote
);
_remote
=
NULL
;
cl_git_pass
(
git_remote_create_inmemory
(
&
_remote
,
_repo
,
NULL
,
"test-protocol://localhost"
,
NULL
));
cl_git_pass
(
git_remote_create_inmemory
(
&
_remote
,
_repo
,
"test-protocol://localhost"
,
NULL
));
transport
.
version
=
0
;
cl_git_fail
(
git_remote_set_transport
(
_remote
,
&
transport
));
...
...
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