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
Léo-Paul Géneau
gitlab-ce
Commits
17319343
Commit
17319343
authored
Oct 09, 2017
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `Gitlab::Git::Repository#fetch` command
parent
d6170ce4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+6
-0
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+15
-0
No files found.
lib/gitlab/git/repository.rb
View file @
17319343
...
...
@@ -1082,6 +1082,12 @@ module Gitlab
@has_visible_content
=
has_local_branches?
end
def
fetch
(
remote
=
'origin'
)
args
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
fetch
#{
remote
}
)
popen
(
args
,
@path
).
last
.
zero?
end
def
gitaly_repository
Gitlab
::
GitalyClient
::
Util
.
repository
(
@storage
,
@relative_path
,
@gl_repository
)
end
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
17319343
...
...
@@ -1489,6 +1489,21 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
describe
'#fetch'
do
let
(
:git_path
)
{
Gitlab
.
config
.
git
.
bin_path
}
let
(
:remote_name
)
{
'my_remote'
}
subject
{
repository
.
fetch
(
remote_name
)
}
it
'fetches the remote and returns true if the command was successful'
do
expect
(
repository
).
to
receive
(
:popen
)
.
with
(
%W(
#{
git_path
}
fetch
#{
remote_name
}
)
,
repository
.
path
)
.
and_return
([
''
,
0
])
expect
(
subject
).
to
be
(
true
)
end
end
def
create_remote_branch
(
repository
,
remote_name
,
branch_name
,
source_branch_name
)
source_branch
=
repository
.
branches
.
find
{
|
branch
|
branch
.
name
==
source_branch_name
}
rugged
=
repository
.
rugged
...
...
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