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
e16fc07f
Commit
e16fc07f
authored
Sep 13, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refspec: No remote tracking ref from a fetchspec-less remote
parent
9be2261e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
11 deletions
+30
-11
src/branch.c
+5
-3
tests-clar/network/remotelocal.c
+2
-2
tests-clar/network/remotes.c
+2
-2
tests-clar/refs/branches/foreach.c
+2
-2
tests-clar/refs/branches/tracking.c
+11
-0
tests-clar/refs/foreachglob.c
+2
-2
tests-clar/resources/testrepo.git/config
+5
-0
tests-clar/resources/testrepo.git/refs/heads/cannot-fetch
+1
-0
No files found.
src/branch.c
View file @
e16fc07f
...
...
@@ -248,9 +248,11 @@ int git_branch_tracking(
goto
cleanup
;
refspec
=
git_remote_fetchspec
(
remote
);
if
(
refspec
==
NULL
)
{
error
=
GIT_ENOTFOUND
;
goto
cleanup
;
if
(
refspec
==
NULL
||
refspec
->
src
==
NULL
||
refspec
->
dst
==
NULL
)
{
error
=
GIT_ENOTFOUND
;
goto
cleanup
;
}
if
(
git_refspec_transform_r
(
&
buf
,
refspec
,
merge_name
)
<
0
)
...
...
tests-clar/network/remotelocal.c
View file @
e16fc07f
...
...
@@ -107,7 +107,7 @@ void test_network_remotelocal__retrieve_advertised_references(void)
cl_git_pass
(
git_remote_ls
(
remote
,
&
count_ref__cb
,
&
how_many_refs
));
cl_assert_equal_i
(
how_many_refs
,
2
5
);
cl_assert_equal_i
(
how_many_refs
,
2
6
);
}
void
test_network_remotelocal__retrieve_advertised_references_from_spaced_repository
(
void
)
...
...
@@ -121,7 +121,7 @@ void test_network_remotelocal__retrieve_advertised_references_from_spaced_reposi
cl_git_pass
(
git_remote_ls
(
remote
,
&
count_ref__cb
,
&
how_many_refs
));
cl_assert_equal_i
(
how_many_refs
,
2
5
);
cl_assert_equal_i
(
how_many_refs
,
2
6
);
git_remote_free
(
remote
);
/* Disconnect from the "spaced repo" before the cleanup */
remote
=
NULL
;
...
...
tests-clar/network/remotes.c
View file @
e16fc07f
...
...
@@ -186,13 +186,13 @@ void test_network_remotes__list(void)
git_config
*
cfg
;
cl_git_pass
(
git_remote_list
(
&
list
,
_repo
));
cl_assert
(
list
.
count
==
2
);
cl_assert
(
list
.
count
==
3
);
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
==
3
);
cl_assert
(
list
.
count
==
4
);
git_strarray_free
(
&
list
);
git_config_free
(
cfg
);
...
...
tests-clar/refs/branches/foreach.c
View file @
e16fc07f
...
...
@@ -47,7 +47,7 @@ static void assert_retrieval(unsigned int flags, unsigned int expected_count)
void
test_refs_branches_foreach__retrieve_all_branches
(
void
)
{
assert_retrieval
(
GIT_BRANCH_LOCAL
|
GIT_BRANCH_REMOTE
,
1
3
);
assert_retrieval
(
GIT_BRANCH_LOCAL
|
GIT_BRANCH_REMOTE
,
1
4
);
}
void
test_refs_branches_foreach__retrieve_remote_branches
(
void
)
...
...
@@ -57,7 +57,7 @@ void test_refs_branches_foreach__retrieve_remote_branches(void)
void
test_refs_branches_foreach__retrieve_local_branches
(
void
)
{
assert_retrieval
(
GIT_BRANCH_LOCAL
,
1
1
);
assert_retrieval
(
GIT_BRANCH_LOCAL
,
1
2
);
}
struct
expectations
{
...
...
tests-clar/refs/branches/tracking.c
View file @
e16fc07f
...
...
@@ -67,3 +67,14 @@ void test_refs_branches_tracking__trying_to_retrieve_a_remote_tracking_reference
git_reference_free
(
branch
);
}
void
test_refs_branches_tracking__trying_to_retrieve_a_remote_tracking_reference_from_a_branch_with_no_fetchspec_returns_GIT_ENOTFOUND
(
void
)
{
git_reference
*
branch
,
*
tracking
;
cl_git_pass
(
git_reference_lookup
(
&
branch
,
repo
,
"refs/heads/cannot-fetch"
));
cl_assert_equal_i
(
GIT_ENOTFOUND
,
git_branch_tracking
(
&
tracking
,
branch
));
git_reference_free
(
branch
);
}
tests-clar/refs/foreachglob.c
View file @
e16fc07f
...
...
@@ -46,7 +46,7 @@ static void assert_retrieval(const char *glob, unsigned int flags, int expected_
void
test_refs_foreachglob__retrieve_all_refs
(
void
)
{
/* 8 heads (including one packed head) + 1 note + 2 remotes + 6 tags */
assert_retrieval
(
"*"
,
GIT_REF_LISTALL
,
2
0
);
assert_retrieval
(
"*"
,
GIT_REF_LISTALL
,
2
1
);
}
void
test_refs_foreachglob__retrieve_remote_branches
(
void
)
...
...
@@ -56,7 +56,7 @@ void test_refs_foreachglob__retrieve_remote_branches(void)
void
test_refs_foreachglob__retrieve_local_branches
(
void
)
{
assert_retrieval
(
"refs/heads/*"
,
GIT_REF_LISTALL
,
1
1
);
assert_retrieval
(
"refs/heads/*"
,
GIT_REF_LISTALL
,
1
2
);
}
void
test_refs_foreachglob__retrieve_partially_named_references
(
void
)
...
...
tests-clar/resources/testrepo.git/config
View file @
e16fc07f
...
...
@@ -6,6 +6,8 @@
[remote "test"]
url = git://github.com/libgit2/libgit2
fetch = +refs/heads/*:refs/remotes/test/*
[remote "joshaber"]
url = git://github.com/libgit2/libgit2
[remote "test_with_pushurl"]
url = git://github.com/libgit2/fetchlibgit2
...
...
@@ -18,3 +20,6 @@
[branch "track-local"]
remote = .
merge = refs/heads/master
[branch "cannot-fetch"]
remote = joshaber
merge = refs/heads/cannot-fetch
tests-clar/resources/testrepo.git/refs/heads/cannot-fetch
0 → 100644
View file @
e16fc07f
a4a7dce85cf63874e984719f4fdd239f5145052f
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