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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b76713af
Commit
b76713af
authored
May 01, 2018
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ENV['USE_SYSTEM_GIT_FOR_FETCH'] support
parent
a2e85860
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
36 deletions
+18
-36
ee/changelogs/unreleased/5224-remove-use_system_git_for_fetch.yml
...elogs/unreleased/5224-remove-use_system_git_for_fetch.yml
+5
-0
lib/gitlab/git/gitlab_projects.rb
lib/gitlab/git/gitlab_projects.rb
+13
-22
spec/lib/gitlab/git/gitlab_projects_spec.rb
spec/lib/gitlab/git/gitlab_projects_spec.rb
+0
-14
No files found.
ee/changelogs/unreleased/5224-remove-use_system_git_for_fetch.yml
0 → 100644
View file @
b76713af
---
title
:
Use of ENV['USE_SYSTEM_GIT_FOR_FETCH'] is no longer supported
merge_request
:
author
:
type
:
removed
lib/gitlab/git/gitlab_projects.rb
View file @
b76713af
...
...
@@ -73,32 +73,15 @@ module Gitlab
end
def
fetch_remote
(
name
,
timeout
,
force
:,
tags
:,
ssh_key:
nil
,
known_hosts:
nil
,
prune:
true
)
tags_option
=
tags
?
'--tags'
:
'--no-tags'
logger
.
info
"Fetching remote
#{
name
}
for repository
#{
repository_absolute_path
}
."
cmd
=
%W(
#{
git_fetch_binary
}
fetch
#{
name
}
--quiet)
cmd
<<
'--prune'
if
prune
cmd
<<
'--force'
if
force
cmd
<<
tags_option
cmd
=
fetch_remote_command
(
name
,
tags
,
prune
,
force
)
setup_ssh_auth
(
ssh_key
,
known_hosts
)
do
|
env
|
success
=
run_with_timeout
(
cmd
,
timeout
,
repository_absolute_path
,
env
)
unless
success
logger
.
error
"Fetching remote
#{
name
}
for repository
#{
repository_absolute_path
}
failed."
run_with_timeout
(
cmd
,
timeout
,
repository_absolute_path
,
env
).
tap
do
|
success
|
unless
success
logger
.
error
"Fetching remote
#{
name
}
for repository
#{
repository_absolute_path
}
failed."
end
end
success
end
end
# This is a workaround for Geo until we can ship git 2.16
# See https://gitlab.com/gitlab-org/gitlab-ee/issues/5214
def
git_fetch_binary
if
ENV
[
'USE_SYSTEM_GIT_FOR_FETCH'
]
==
'1'
'/usr/bin/git'
else
Gitlab
.
config
.
git
.
bin_path
end
end
...
...
@@ -224,6 +207,14 @@ module Gitlab
private
def
fetch_remote_command
(
name
,
tags
,
prune
,
force
)
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
fetch
#{
name
}
--quiet)
.
tap
do
|
cmd
|
cmd
<<
'--prune'
if
prune
cmd
<<
'--force'
if
force
cmd
<<
(
tags
?
'--tags'
:
'--no-tags'
)
end
end
def
git_import_repository
(
source
,
timeout
)
# Skip import if repo already exists
return
false
if
File
.
exist?
(
repository_absolute_path
)
...
...
spec/lib/gitlab/git/gitlab_projects_spec.rb
View file @
b76713af
...
...
@@ -160,20 +160,6 @@ describe Gitlab::Git::GitlabProjects do
expect
(
key
.
string
).
to
eq
(
'KNOWN HOSTS'
)
end
end
context
'with USE_SYSTEM_GIT_FOR_FETCH env'
do
let
(
:cmd
)
{
%W(/usr/bin/git fetch
#{
remote_name
}
--quiet --prune --tags)
}
before
do
stub_env
(
'USE_SYSTEM_GIT_FOR_FETCH'
,
'1'
)
end
it
'uses system git'
do
stub_spawn
(
cmd
,
600
,
tmp_repo_path
,
{},
success:
true
)
is_expected
.
to
be_truthy
end
end
end
describe
'#import_project'
do
...
...
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