Merge branch 'master' into mentioned_inside_mr
This commit is contained in:
commit
150fc0cc68
35 changed files with 67 additions and 54 deletions
|
@ -1,7 +1,6 @@
|
|||
class Projects::BaseTreeController < Projects::ApplicationController
|
||||
include ExtractsPath
|
||||
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
end
|
||||
|
|
|
@ -3,7 +3,6 @@ class Projects::BlameController < Projects::ApplicationController
|
|||
include ExtractsPath
|
||||
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ class Projects::BlobController < Projects::ApplicationController
|
|||
include ExtractsPath
|
||||
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
before_filter :authorize_push_code!, only: [:destroy]
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
class Projects::BranchesController < Projects::ApplicationController
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
before_filter :authorize_download_code!
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# Not to be confused with CommitsController, plural.
|
||||
class Projects::CommitController < Projects::ApplicationController
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
before_filter :commit
|
||||
|
|
|
@ -4,7 +4,6 @@ class Projects::CommitsController < Projects::ApplicationController
|
|||
include ExtractsPath
|
||||
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
class Projects::CompareController < Projects::ApplicationController
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
class Projects::GraphsController < Projects::ApplicationController
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ class Projects::NetworkController < Projects::ApplicationController
|
|||
include ApplicationHelper
|
||||
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ class Projects::RawController < Projects::ApplicationController
|
|||
include ExtractsPath
|
||||
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ class Projects::RefsController < Projects::ApplicationController
|
|||
include ExtractsPath
|
||||
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
class Projects::RepositoriesController < Projects::ApplicationController
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
class Projects::TagsController < Projects::ApplicationController
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!
|
||||
before_filter :require_non_empty_project
|
||||
|
||||
before_filter :authorize_download_code!
|
||||
before_filter :authorize_push_code!, only: [:create]
|
||||
before_filter :authorize_admin_project!, only: [:destroy]
|
||||
|
|
|
@ -4,7 +4,6 @@ class ProjectsController < ApplicationController
|
|||
before_filter :repository, except: [:new, :create]
|
||||
|
||||
# Authorize
|
||||
before_filter :authorize_read_project!, except: [:index, :new, :create]
|
||||
before_filter :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive, :retry_import]
|
||||
|
||||
layout 'navless', only: [:new, :create, :fork]
|
||||
|
@ -52,8 +51,6 @@ class ProjectsController < ApplicationController
|
|||
return
|
||||
end
|
||||
|
||||
return authenticate_user! unless @project.public? || current_user
|
||||
|
||||
limit = (params[:limit] || 20).to_i
|
||||
@events = @project.events.recent
|
||||
@events = event_filter.apply_filter(@events)
|
||||
|
|
|
@ -186,10 +186,6 @@ class Event < ActiveRecord::Base
|
|||
data[:ref]["refs/heads"]
|
||||
end
|
||||
|
||||
def new_branch?
|
||||
commit_from =~ /^00000/
|
||||
end
|
||||
|
||||
def new_ref?
|
||||
commit_from =~ /^00000/
|
||||
end
|
||||
|
|
|
@ -37,13 +37,12 @@ class FlowdockService < Service
|
|||
end
|
||||
|
||||
def execute(push_data)
|
||||
repo_path = File.join(Gitlab.config.gitlab_shell.repos_path, "#{project.path_with_namespace}.git")
|
||||
Flowdock::Git.post(
|
||||
push_data[:ref],
|
||||
push_data[:before],
|
||||
push_data[:after],
|
||||
token: token,
|
||||
repo: repo_path,
|
||||
repo: project.repository.path_to_repo,
|
||||
repo_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}",
|
||||
commit_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/commit/%s",
|
||||
diff_url: "#{Gitlab.config.gitlab.url}/#{project.path_with_namespace}/compare/%s...%s",
|
||||
|
|
|
@ -38,14 +38,13 @@ class GemnasiumService < Service
|
|||
end
|
||||
|
||||
def execute(push_data)
|
||||
repo_path = File.join(Gitlab.config.gitlab_shell.repos_path, "#{project.path_with_namespace}.git")
|
||||
Gemnasium::GitlabService.execute(
|
||||
ref: push_data[:ref],
|
||||
before: push_data[:before],
|
||||
after: push_data[:after],
|
||||
token: token,
|
||||
api_key: api_key,
|
||||
repo: repo_path
|
||||
repo: project.repository.path_to_repo
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ class GitlabCiService < CiService
|
|||
end
|
||||
|
||||
def commit_status_path(sha)
|
||||
project_url + "/builds/#{sha}/status.json?token=#{token}"
|
||||
project_url + "/commits/#{sha}/status.json?token=#{token}"
|
||||
end
|
||||
|
||||
def get_ci_build(sha)
|
||||
|
@ -55,7 +55,7 @@ class GitlabCiService < CiService
|
|||
end
|
||||
|
||||
def build_page(sha)
|
||||
project_url + "/builds/#{sha}"
|
||||
project_url + "/commits/#{sha}"
|
||||
end
|
||||
|
||||
def builds_path
|
||||
|
|
|
@ -160,19 +160,19 @@ class GitPushService
|
|||
ref_parts = ref.split('/')
|
||||
|
||||
# Return if this is not a push to a branch (e.g. new commits)
|
||||
ref_parts[1] =~ /heads/ && oldrev != "0000000000000000000000000000000000000000"
|
||||
ref_parts[1] =~ /heads/ && oldrev != Gitlab::Git::BLANK_SHA
|
||||
end
|
||||
|
||||
def push_to_new_branch?(ref, oldrev)
|
||||
ref_parts = ref.split('/')
|
||||
|
||||
ref_parts[1] =~ /heads/ && oldrev == "0000000000000000000000000000000000000000"
|
||||
ref_parts[1] =~ /heads/ && oldrev == Gitlab::Git::BLANK_SHA
|
||||
end
|
||||
|
||||
def push_remove_branch?(ref, newrev)
|
||||
ref_parts = ref.split('/')
|
||||
|
||||
ref_parts[1] =~ /heads/ && newrev == "0000000000000000000000000000000000000000"
|
||||
ref_parts[1] =~ /heads/ && newrev == Gitlab::Git::BLANK_SHA
|
||||
end
|
||||
|
||||
def push_to_branch?(ref)
|
||||
|
|
|
@ -18,7 +18,7 @@ class SystemHooksService
|
|||
def build_event_data(model, event)
|
||||
data = {
|
||||
event_name: build_event_name(model, event),
|
||||
created_at: model.created_at
|
||||
created_at: model.created_at.xmlschema
|
||||
}
|
||||
|
||||
case model
|
||||
|
|
|
@ -26,6 +26,10 @@ class AttachmentUploader < CarrierWave::Uploader::Base
|
|||
Gitlab.config.gitlab.relative_url_root + "/files/#{model.class.to_s.underscore}/#{model.id}/#{file.filename}"
|
||||
end
|
||||
|
||||
def url
|
||||
Gitlab.config.gitlab.relative_url_root + super unless super.nil?
|
||||
end
|
||||
|
||||
def file_storage?
|
||||
self.class.storage == CarrierWave::Storage::File
|
||||
end
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
title:
|
||||
%code= @key.title
|
||||
%p
|
||||
If this key was added in error, you can remove it here:
|
||||
If this key was added in error, you can remove it under
|
||||
= link_to "SSH Keys", profile_keys_url
|
||||
|
|
|
@ -2,6 +2,6 @@ Hi <%= @user.name %>!
|
|||
|
||||
A new public key was added to your account:
|
||||
|
||||
title.................. <%= @key.title %>
|
||||
Title: <%= @key.title %>
|
||||
|
||||
If this key was added in error, you can remove it here: <%= profile_keys_url %>
|
||||
If this key was added in error, you can remove it at <%= profile_keys_url %>
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
tree_join(@commit.sha, @path)), class: 'btn btn-small'
|
||||
|
||||
- if allowed_tree_edit?
|
||||
= link_to '#modal-remove-blob', class: "remove-blob btn btn-small btn-remove", "data-toggle" => "modal" do
|
||||
= button_tag class: 'remove-blob btn btn-small btn-remove',
|
||||
'data-toggle' => 'modal', 'data-target' => '#modal-remove-blob' do
|
||||
Remove
|
||||
|
|
|
@ -199,7 +199,7 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
|
|||
# Make sure GitLab can write to the log/ and tmp/ directories
|
||||
sudo chown -R git log/
|
||||
sudo chown -R git tmp/
|
||||
sudo chmod -R u+rwX log/
|
||||
sudo chmod -R u+rwX,go-w log/
|
||||
sudo chmod -R u+rwX tmp/
|
||||
|
||||
# Create directory for satellites
|
||||
|
|
|
@ -29,7 +29,7 @@ class Spinach::Features::EventFilters < Spinach::FeatureSteps
|
|||
|
||||
step 'this project has push event' do
|
||||
data = {
|
||||
before: "0000000000000000000000000000000000000000",
|
||||
before: Gitlab::Git::BLANK_SHA,
|
||||
after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
|
||||
ref: "refs/heads/new_design",
|
||||
user_id: @user.id,
|
||||
|
|
|
@ -78,7 +78,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
|
|||
end
|
||||
|
||||
step 'I click on "Remove"' do
|
||||
click_link 'Remove'
|
||||
click_button 'Remove'
|
||||
end
|
||||
|
||||
step 'I click on "Remove file"' do
|
||||
|
|
|
@ -32,7 +32,7 @@ module SharedProject
|
|||
@project = Project.find_by(name: "Shop")
|
||||
|
||||
data = {
|
||||
before: "0000000000000000000000000000000000000000",
|
||||
before: Gitlab::Git::BLANK_SHA,
|
||||
after: "6d394385cf567f80a8fd85055db1ab4c5295806f",
|
||||
ref: "refs/heads/fix",
|
||||
user_id: @user.id,
|
||||
|
|
|
@ -91,7 +91,7 @@ module Backup
|
|||
protected
|
||||
|
||||
def path_to_repo(project)
|
||||
File.join(repos_path, project.path_with_namespace + '.git')
|
||||
project.repository.path_to_repo
|
||||
end
|
||||
|
||||
def path_to_bundle(project)
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace :gitlab do
|
|||
desc "GITLAB | Build missing projects"
|
||||
task build_missing_projects: :environment do
|
||||
Project.find_each(batch_size: 1000) do |project|
|
||||
path_to_repo = File.join(Gitlab.config.gitlab_shell.repos_path, "#{project.path_with_namespace}.git")
|
||||
path_to_repo = project.repository.path_to_repo
|
||||
if File.exists?(path_to_repo)
|
||||
print '-'
|
||||
else
|
||||
|
|
|
@ -36,7 +36,7 @@ describe Event do
|
|||
@user = project.owner
|
||||
|
||||
data = {
|
||||
before: "0000000000000000000000000000000000000000",
|
||||
before: Gitlab::Git::BLANK_SHA,
|
||||
after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
|
||||
ref: "refs/heads/master",
|
||||
user_id: @user.id,
|
||||
|
@ -60,7 +60,6 @@ describe Event do
|
|||
|
||||
it { @event.push?.should be_true }
|
||||
it { @event.proper?.should be_true }
|
||||
it { @event.new_branch?.should be_true }
|
||||
it { @event.tag?.should be_false }
|
||||
it { @event.branch_name.should == "master" }
|
||||
it { @event.author.should == @user }
|
||||
|
|
|
@ -34,11 +34,11 @@ describe GitlabCiService do
|
|||
end
|
||||
|
||||
describe :commit_status_path do
|
||||
it { @service.commit_status_path("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c/status.json?token=verySecret"}
|
||||
it { @service.commit_status_path("2ab7834c").should == "http://ci.gitlab.org/projects/2/commits/2ab7834c/status.json?token=verySecret"}
|
||||
end
|
||||
|
||||
describe :build_page do
|
||||
it { @service.build_page("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c"}
|
||||
it { @service.build_page("2ab7834c").should == "http://ci.gitlab.org/projects/2/commits/2ab7834c"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,8 +37,7 @@ describe API::API, api: true do
|
|||
context 'annotated tag' do
|
||||
it 'should create a new annotated tag' do
|
||||
# Identity must be set in .gitconfig to create annotated tag.
|
||||
repo_path = File.join(Gitlab.config.gitlab_shell.repos_path,
|
||||
project.path_with_namespace + '.git')
|
||||
repo_path = project.repository.path_to_repo
|
||||
system(*%W(git --git-dir=#{repo_path} config user.name #{user.name}))
|
||||
system(*%W(git --git-dir=#{repo_path} config user.email #{user.email}))
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ describe GitPushService do
|
|||
let (:service) { GitPushService.new }
|
||||
|
||||
before do
|
||||
@blankrev = '0000000000000000000000000000000000000000'
|
||||
@blankrev = Gitlab::Git::BLANK_SHA
|
||||
@oldrev = sample_commit.parent_id
|
||||
@newrev = sample_commit.id
|
||||
@ref = 'refs/heads/master'
|
||||
|
|
|
@ -3,6 +3,16 @@ require 'rspec/mocks'
|
|||
module TestEnv
|
||||
extend self
|
||||
|
||||
# When developing the seed repository, comment out the branch you will modify.
|
||||
BRANCH_SHA = {
|
||||
'feature' => '0b4bc9a',
|
||||
'feature_conflict' => 'bb5206f',
|
||||
'fix' => '12d65c8',
|
||||
'improve/awesome' => '5937ac0',
|
||||
'markdown' => '0ed8c6c',
|
||||
'master' => '5937ac0'
|
||||
}
|
||||
|
||||
# Test environment
|
||||
#
|
||||
# See gitlab.yml.example test section for paths
|
||||
|
@ -18,13 +28,13 @@ module TestEnv
|
|||
|
||||
if File.directory?(tmp_test_path)
|
||||
Dir.entries(tmp_test_path).each do |entry|
|
||||
unless ['.', '..', 'gitlab-shell'].include?(entry)
|
||||
unless ['.', '..', 'gitlab-shell', factory_repo_name].include?(entry)
|
||||
FileUtils.rm_r(File.join(tmp_test_path, entry))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
FileUtils.mkdir_p(tmp_test_path)
|
||||
FileUtils.mkdir_p(repos_path)
|
||||
|
||||
# Setup GitLab shell for test instance
|
||||
setup_gitlab_shell
|
||||
|
@ -49,13 +59,32 @@ module TestEnv
|
|||
clone_url = "https://gitlab.com/gitlab-org/#{factory_repo_name}.git"
|
||||
|
||||
unless File.directory?(factory_repo_path)
|
||||
git_cmd = %W(git clone --bare #{clone_url} #{factory_repo_path})
|
||||
system(*git_cmd)
|
||||
system(*%W(git clone #{clone_url} #{factory_repo_path}))
|
||||
end
|
||||
|
||||
Dir.chdir(factory_repo_path) do
|
||||
BRANCH_SHA.each do |branch, sha|
|
||||
# Try to reset without fetching to avoid using the network.
|
||||
reset = %W(git update-ref refs/heads/#{branch} #{sha})
|
||||
unless system(*reset)
|
||||
if system(*%w(git fetch origin))
|
||||
unless system(*reset)
|
||||
raise 'The fetched test seed '\
|
||||
'does not contain the required revision.'
|
||||
end
|
||||
else
|
||||
raise 'Could not fetch test seed repository.'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# We must copy bare repositories because we will push to them.
|
||||
system(*%W(git clone --bare #{factory_repo_path} #{factory_repo_path_bare}))
|
||||
end
|
||||
|
||||
def copy_repo(project)
|
||||
base_repo_path = File.expand_path(factory_repo_path)
|
||||
base_repo_path = File.expand_path(factory_repo_path_bare)
|
||||
target_repo_path = File.expand_path(repos_path + "/#{project.namespace.path}/#{project.path}.git")
|
||||
FileUtils.mkdir_p(target_repo_path)
|
||||
FileUtils.cp_r("#{base_repo_path}/.", target_repo_path)
|
||||
|
@ -69,7 +98,11 @@ module TestEnv
|
|||
private
|
||||
|
||||
def factory_repo_path
|
||||
@factory_repo_path ||= repos_path + "/root/#{factory_repo_name}.git"
|
||||
@factory_repo_path ||= Rails.root.join('tmp', 'tests', factory_repo_name)
|
||||
end
|
||||
|
||||
def factory_repo_path_bare
|
||||
factory_repo_path.to_s + '_bare'
|
||||
end
|
||||
|
||||
def factory_repo_name
|
||||
|
|
Loading…
Reference in a new issue