Revert "Merge branch '1937-https-clone-url-username' into 'master'
This reverts commitc425f366bf
, reversing changes made to82f6c0f5ac
. Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
parent
c5b0c530bf
commit
fd376b3ed4
7 changed files with 11 additions and 29 deletions
|
@ -56,7 +56,7 @@ module ButtonHelper
|
|||
|
||||
content_tag (append_link ? :a : :span), protocol,
|
||||
class: klass,
|
||||
href: (project.http_url_to_repo(current_user) if append_link),
|
||||
href: (project.http_url_to_repo if append_link),
|
||||
data: {
|
||||
html: true,
|
||||
placement: placement,
|
||||
|
|
|
@ -276,7 +276,7 @@ module ProjectsHelper
|
|||
when 'ssh'
|
||||
project.ssh_url_to_repo
|
||||
else
|
||||
project.http_url_to_repo(current_user)
|
||||
project.http_url_to_repo
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -873,10 +873,8 @@ class Project < ActiveRecord::Base
|
|||
url_to_repo
|
||||
end
|
||||
|
||||
def http_url_to_repo(user = nil)
|
||||
credentials = Gitlab::UrlSanitizer.http_credentials_for_user(user)
|
||||
|
||||
Gitlab::UrlSanitizer.new("#{web_url}.git", credentials: credentials).full_url
|
||||
def http_url_to_repo
|
||||
"#{web_url}.git"
|
||||
end
|
||||
|
||||
def user_can_push_to_empty_repo?(user)
|
||||
|
|
|
@ -49,7 +49,7 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
|
|||
|
||||
step 'I should see an http link to the repository' do
|
||||
project = Project.find_by(name: 'Community')
|
||||
expect(page).to have_field('project_clone', with: project.http_url_to_repo(@user))
|
||||
expect(page).to have_field('project_clone', with: project.http_url_to_repo)
|
||||
end
|
||||
|
||||
step 'I should see an ssh link to the repository' do
|
||||
|
|
|
@ -32,7 +32,7 @@ feature 'Admin disables Git access protocol', feature: true do
|
|||
scenario 'shows only HTTP url' do
|
||||
visit_project
|
||||
|
||||
expect(page).to have_content("git clone #{project.http_url_to_repo(admin)}")
|
||||
expect(page).to have_content("git clone #{project.http_url_to_repo}")
|
||||
expect(page).not_to have_selector('#clone-dropdown')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -56,14 +56,8 @@ feature 'Developer views empty project instructions', feature: true do
|
|||
end
|
||||
|
||||
def expect_instructions_for(protocol)
|
||||
url =
|
||||
case protocol
|
||||
when 'ssh'
|
||||
project.ssh_url_to_repo
|
||||
when 'http'
|
||||
project.http_url_to_repo(developer)
|
||||
end
|
||||
msg = :"#{protocol.downcase}_url_to_repo"
|
||||
|
||||
expect(page).to have_content("git clone #{url}")
|
||||
expect(page).to have_content("git clone #{project.send(msg)}")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1909,19 +1909,9 @@ describe Project, models: true do
|
|||
describe '#http_url_to_repo' do
|
||||
let(:project) { create :empty_project }
|
||||
|
||||
context 'when no user is given' do
|
||||
it 'returns the url to the repo without a username' do
|
||||
expect(project.http_url_to_repo).to eq("#{project.web_url}.git")
|
||||
expect(project.http_url_to_repo).not_to include('@')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user is given' do
|
||||
it 'returns the url to the repo with the username' do
|
||||
user = build_stubbed(:user)
|
||||
|
||||
expect(project.http_url_to_repo(user)).to start_with("http://#{user.username}@")
|
||||
end
|
||||
it 'returns the url to the repo without a username' do
|
||||
expect(project.http_url_to_repo).to eq("#{project.web_url}.git")
|
||||
expect(project.http_url_to_repo).not_to include('@')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue