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
d6465e1a
Commit
d6465e1a
authored
May 07, 2013
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1557 from carlosmn/tagopt
remote: correctly interpret tagopt '--tags'
parents
33665410
505b5d0c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
13 deletions
+44
-13
src/fetch.c
+9
-3
src/remote.c
+18
-10
tests-clar/network/remote/local.c
+17
-0
No files found.
src/fetch.c
View file @
d6465e1a
...
...
@@ -34,10 +34,16 @@ static int filter_ref__cb(git_remote_head *head, void *payload)
if
(
!
p
->
found_head
&&
strcmp
(
head
->
name
,
GIT_HEAD_FILE
)
==
0
)
p
->
found_head
=
1
;
else
if
(
git_remote__matching_refspec
(
p
->
remote
,
head
->
name
))
else
if
(
p
->
remote
->
download_tags
==
GIT_REMOTE_DOWNLOAD_TAGS_ALL
)
{
/*
* If tagopt is --tags, then we only use the default
* tags refspec and ignore the remote's
*/
if
(
git_refspec_src_matches
(
p
->
tagspec
,
head
->
name
))
match
=
1
;
else
if
(
p
->
remote
->
download_tags
==
GIT_REMOTE_DOWNLOAD_TAGS_ALL
&&
git_refspec_src_matches
(
p
->
tagspec
,
head
->
name
))
else
return
0
;
}
else
if
(
git_remote__matching_refspec
(
p
->
remote
,
head
->
name
))
match
=
1
;
if
(
!
match
)
...
...
src/remote.c
View file @
d6465e1a
...
...
@@ -957,30 +957,38 @@ on_error:
int
git_remote_update_tips
(
git_remote
*
remote
)
{
git_refspec
*
spec
;
git_refspec
*
spec
,
tagspec
;
git_vector
refs
;
int
error
;
size_t
i
;
if
(
git_refspec__parse
(
&
tagspec
,
GIT_REFSPEC_TAGS
,
true
)
<
0
)
return
-
1
;
if
(
git_vector_init
(
&
refs
,
16
,
NULL
)
<
0
)
return
-
1
;
if
(
git_remote_ls
(
remote
,
store_refs
,
&
refs
)
<
0
)
goto
on_error
;
if
((
error
=
git_remote_ls
(
remote
,
store_refs
,
&
refs
))
<
0
)
goto
out
;
if
(
remote
->
download_tags
==
GIT_REMOTE_DOWNLOAD_TAGS_ALL
)
{
error
=
update_tips_for_spec
(
remote
,
&
tagspec
,
&
refs
);
goto
out
;
}
git_vector_foreach
(
&
remote
->
refspecs
,
i
,
spec
)
{
if
(
spec
->
push
)
continue
;
if
(
update_tips_for_spec
(
remote
,
spec
,
&
refs
)
<
0
)
goto
o
n_error
;
if
(
(
error
=
update_tips_for_spec
(
remote
,
spec
,
&
refs
)
)
<
0
)
goto
o
ut
;
}
out:
git_refspec__free
(
&
tagspec
);
git_vector_free
(
&
refs
);
return
0
;
on_error:
git_vector_free
(
&
refs
);
return
-
1
;
return
error
;
}
int
git_remote_connected
(
git_remote
*
remote
)
...
...
tests-clar/network/remote/local.c
View file @
d6465e1a
...
...
@@ -141,3 +141,20 @@ void test_network_remote_local__shorthand_fetch_refspec1(void)
cl_git_fail
(
git_reference_lookup
(
&
ref
,
repo
,
"refs/tags/hard_tag"
));
}
void
test_network_remote_local__tagopt
(
void
)
{
git_reference
*
ref
;
connect_to_local_repository
(
cl_fixture
(
"testrepo.git"
));
git_remote_set_autotag
(
remote
,
GIT_REMOTE_DOWNLOAD_TAGS_ALL
);
cl_git_pass
(
git_remote_download
(
remote
,
NULL
,
NULL
));
cl_git_pass
(
git_remote_update_tips
(
remote
));
cl_git_fail
(
git_reference_lookup
(
&
ref
,
repo
,
"refs/remotes/master"
));
cl_git_pass
(
git_reference_lookup
(
&
ref
,
repo
,
"refs/tags/hard_tag"
));
git_reference_free
(
ref
);
}
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