Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
3f0c9e97
Commit
3f0c9e97
authored
Nov 20, 2017
by
Alejandro Rodríguez
Committed by
Rémy Coutable
Nov 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Gitlab::Git::Repository#remote_tags using unexisting variable
parent
cbee84ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
lib/gitlab/git/repository_mirroring.rb
lib/gitlab/git/repository_mirroring.rb
+2
-2
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+18
-5
No files found.
lib/gitlab/git/repository_mirroring.rb
View file @
3f0c9e97
...
@@ -78,7 +78,7 @@ module Gitlab
...
@@ -78,7 +78,7 @@ module Gitlab
def
list_remote_tags
(
remote
)
def
list_remote_tags
(
remote
)
tag_list
,
exit_code
,
error
=
nil
tag_list
,
exit_code
,
error
=
nil
cmd
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
--git-dir=
#{
full_
path
}
ls-remote --tags
#{
remote
}
)
cmd
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
--git-dir=
#{
path
}
ls-remote --tags
#{
remote
}
)
Open3
.
popen3
(
*
cmd
)
do
|
stdin
,
stdout
,
stderr
,
wait_thr
|
Open3
.
popen3
(
*
cmd
)
do
|
stdin
,
stdout
,
stderr
,
wait_thr
|
tag_list
=
stdout
.
read
tag_list
=
stdout
.
read
...
@@ -88,7 +88,7 @@ module Gitlab
...
@@ -88,7 +88,7 @@ module Gitlab
raise
RemoteError
,
error
unless
exit_code
.
zero?
raise
RemoteError
,
error
unless
exit_code
.
zero?
tag_list
.
split
(
'\n'
)
tag_list
.
split
(
"
\n
"
)
end
end
end
end
end
end
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
3f0c9e97
...
@@ -629,16 +629,29 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -629,16 +629,29 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
describe
'#remote_tags'
do
describe
'#remote_tags'
do
let
(
:remote_name
)
{
'upstream'
}
let
(
:target_commit_id
)
{
SeedRepo
::
Commit
::
ID
}
let
(
:target_commit_id
)
{
SeedRepo
::
Commit
::
ID
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:tag_name
)
{
'v0.0.1'
}
let
(
:tag_message
)
{
'My tag'
}
let
(
:remote_repository
)
do
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
TEST_MUTABLE_REPO_PATH
,
''
)
end
subject
{
repository
.
remote_tags
(
'upstream'
)
}
subject
{
repository
.
remote_tags
(
remote_name
)
}
it
'gets the remote tags'
do
before
do
expect
(
repository
).
to
receive
(
:list_remote_tags
).
with
(
'upstream'
)
repository
.
add_remote
(
remote_name
,
remote_repository
.
path
)
.
and_return
([
"
#{
target_commit_id
}
\t
refs/tags/v0.0.1
\n
"
])
remote_repository
.
add_tag
(
tag_name
,
user:
user
,
target:
target_commit_id
)
end
after
do
ensure_seeds
end
it
'gets the remote tags'
do
expect
(
subject
.
first
).
to
be_an_instance_of
(
Gitlab
::
Git
::
Tag
)
expect
(
subject
.
first
).
to
be_an_instance_of
(
Gitlab
::
Git
::
Tag
)
expect
(
subject
.
first
.
name
).
to
eq
(
'v0.0.1'
)
expect
(
subject
.
first
.
name
).
to
eq
(
tag_name
)
expect
(
subject
.
first
.
dereferenced_target
.
id
).
to
eq
(
target_commit_id
)
expect
(
subject
.
first
.
dereferenced_target
.
id
).
to
eq
(
target_commit_id
)
end
end
end
end
...
...
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