Commit 6e361ed5 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2017-08-25

* upstream/master: (39 commits)
  Fix searching for files by path
  Fix invite by email address duplication
  Revert "Merge branch 'mk-reenable-mysql-tests-on-all-branches' into 'master'"
  Revert "Merge branch 'sh-sidekiq-backtrace' into 'master'"
  Add missing third argument to `Git::Repository#initialize` in spec
  New doc: how to install GitLab on Azure
  Enable 5 lines of Sidekiq backtrace lines to aid in debugging
  Reenable MySQL tests on all branches
  Add `:nested_groups` metadata to `Groups::NestedCreateService` specs
  Re-allow appearances.description_html to be NULL
  Remove leftover API helper for removed CI API
  Define ldap methods at runtime
  Changed all font-weight values to 400 and 600
  Use gitaly-proto 0.31.0
  Avoid committer = lines
  Reword job to pipeline on the chart view
  Remove underscore-rails gem
  Hide group title on sidebar collapse; use more generic class for titles
  Add tests for Committer#==
  Added repo_service_spec for commitFlash and corrected repo_commit-Secion api spec
  ...
parents bab59bce 4a2cc381
...@@ -217,9 +217,6 @@ gem 'kubeclient', '~> 2.2.0' ...@@ -217,9 +217,6 @@ gem 'kubeclient', '~> 2.2.0'
# d3 # d3
gem 'd3_rails', '~> 3.5.0' gem 'd3_rails', '~> 3.5.0'
# underscore-rails
gem 'underscore-rails', '~> 1.8.0'
# Sanitize user input # Sanitize user input
gem 'sanitize', '~> 2.0' gem 'sanitize', '~> 2.0'
gem 'babosa', '~> 1.0.2' gem 'babosa', '~> 1.0.2'
...@@ -417,7 +414,7 @@ group :ed25519 do ...@@ -417,7 +414,7 @@ group :ed25519 do
end end
# Gitaly GRPC client # Gitaly GRPC client
gem 'gitaly', '~> 0.30.0' gem 'gitaly-proto', '~> 0.31.0', require: 'gitaly'
gem 'toml-rb', '~> 0.3.15', require: false gem 'toml-rb', '~> 0.3.15', require: false
......
...@@ -299,7 +299,7 @@ GEM ...@@ -299,7 +299,7 @@ GEM
po_to_json (>= 1.0.0) po_to_json (>= 1.0.0)
rails (>= 3.2.0) rails (>= 3.2.0)
gherkin-ruby (0.3.2) gherkin-ruby (0.3.2)
gitaly (0.30.0) gitaly-proto (0.31.0)
google-protobuf (~> 3.1) google-protobuf (~> 3.1)
grpc (~> 1.0) grpc (~> 1.0)
github-linguist (4.7.6) github-linguist (4.7.6)
...@@ -929,7 +929,6 @@ GEM ...@@ -929,7 +929,6 @@ GEM
uglifier (2.7.2) uglifier (2.7.2)
execjs (>= 0.3.0) execjs (>= 0.3.0)
json (>= 1.8.0) json (>= 1.8.0)
underscore-rails (1.8.3)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.2) unf_ext (0.0.7.2)
...@@ -1054,7 +1053,7 @@ DEPENDENCIES ...@@ -1054,7 +1053,7 @@ DEPENDENCIES
gettext (~> 3.2.2) gettext (~> 3.2.2)
gettext_i18n_rails (~> 1.8.0) gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.2.0) gettext_i18n_rails_js (~> 1.2.0)
gitaly (~> 0.30.0) gitaly-proto (~> 0.31.0)
github-linguist (~> 4.7.0) github-linguist (~> 4.7.0)
gitlab-flowdock-git-hook (~> 1.0.1) gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-license (~> 1.0) gitlab-license (~> 1.0)
...@@ -1202,7 +1201,6 @@ DEPENDENCIES ...@@ -1202,7 +1201,6 @@ DEPENDENCIES
truncato (~> 0.7.8) truncato (~> 0.7.8)
u2f (~> 0.2.1) u2f (~> 0.2.1)
uglifier (~> 2.7.2) uglifier (~> 2.7.2)
underscore-rails (~> 1.8.0)
unf (~> 0.1.4) unf (~> 0.1.4)
unicorn (~> 5.1.0) unicorn (~> 5.1.0)
unicorn-worker-killer (~> 0.4.4) unicorn-worker-killer (~> 0.4.4)
......
...@@ -97,18 +97,17 @@ const Api = { ...@@ -97,18 +97,17 @@ const Api = {
.done(projects => callback(projects)); .done(projects => callback(projects));
}, },
commitMultiple(id, data, callback) { commitMultiple(id, data) {
// see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
const url = Api.buildUrl(Api.commitPath) const url = Api.buildUrl(Api.commitPath)
.replace(':id', id); .replace(':id', id);
return $.ajax({ return this.wrapAjaxCall({
url, url,
type: 'POST', type: 'POST',
contentType: 'application/json; charset=utf-8', contentType: 'application/json; charset=utf-8',
data: JSON.stringify(data), data: JSON.stringify(data),
dataType: 'json', dataType: 'json',
}) });
.done(commitData => callback(commitData))
.fail(message => callback(message.responseJSON));
}, },
// Return text for a specific license // Return text for a specific license
......
...@@ -42,7 +42,9 @@ export default { ...@@ -42,7 +42,9 @@ export default {
actions, actions,
}; };
Store.submitCommitsLoading = true; Store.submitCommitsLoading = true;
Service.commitFiles(payload, this.resetCommitState); Service.commitFiles(payload)
.then(this.resetCommitState)
.catch(() => Flash('An error occured while committing your changes'));
}, },
resetCommitState() { resetCommitState() {
......
...@@ -65,15 +65,17 @@ const RepoService = { ...@@ -65,15 +65,17 @@ const RepoService = {
return urlArray.join('/'); return urlArray.join('/');
}, },
commitFiles(payload, cb) { commitFiles(payload) {
Api.commitMultiple(Store.projectId, payload, (data) => { return Api.commitMultiple(Store.projectId, payload)
if (data.short_id && data.stats) { .then(this.commitFlash);
Flash(`Your changes have been committed. Commit ${data.short_id} with ${data.stats.additions} additions, ${data.stats.deletions} deletions.`, 'notice'); },
} else {
Flash(data.message); commitFlash(data) {
} if (data.short_id && data.stats) {
cb(); window.Flash(`Your changes have been committed. Commit ${data.short_id} with ${data.stats.additions} additions, ${data.stats.deletions} deletions.`, 'notice');
}); } else {
window.Flash(data.message);
}
}, },
}; };
......
...@@ -588,9 +588,10 @@ function UsersSelect(currentUser, els) { ...@@ -588,9 +588,10 @@ function UsersSelect(currentUser, els) {
if (showEmailUser && data.results.length === 0 && query.term.match(/^[^@]+@[^@]+$/)) { if (showEmailUser && data.results.length === 0 && query.term.match(/^[^@]+@[^@]+$/)) {
var trimmed = query.term.trim(); var trimmed = query.term.trim();
emailUser = { emailUser = {
name: "Invite \"" + query.term + "\"", name: "Invite \"" + query.term + "\" by email",
username: trimmed, username: trimmed,
id: trimmed id: trimmed,
invite: true
}; };
data.results.unshift(emailUser); data.results.unshift(emailUser);
} }
...@@ -642,7 +643,7 @@ UsersSelect.prototype.formatResult = function(user) { ...@@ -642,7 +643,7 @@ UsersSelect.prototype.formatResult = function(user) {
} else { } else {
avatar = gon.default_avatar_url; avatar = gon.default_avatar_url;
} }
return "<div class='user-result " + (!user.username ? 'no-username' : void 0) + "'> <div class='user-image'><img class='avatar avatar-inline s32' src='" + avatar + "'></div> <div class='user-name dropdown-menu-user-full-name'>" + user.name + "</div> <div class='user-username dropdown-menu-user-username'>" + ("@" + user.username || "") + "</div> </div>"; return "<div class='user-result " + (!user.username ? 'no-username' : void 0) + "'> <div class='user-image'><img class='avatar avatar-inline s32' src='" + avatar + "'></div> <div class='user-name dropdown-menu-user-full-name'>" + user.name + "</div> <div class='user-username dropdown-menu-user-username'>" + (!user.invite ? "@" + _.escape(user.username) : "") + "</div> </div>";
}; };
UsersSelect.prototype.formatSelection = function(user) { UsersSelect.prototype.formatSelection = function(user) {
......
...@@ -70,8 +70,7 @@ $new-sidebar-collapsed-width: 50px; ...@@ -70,8 +70,7 @@ $new-sidebar-collapsed-width: 50px;
background-color: $white-light; background-color: $white-light;
} }
.project-title, .sidebar-context-title {
.group-title {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
...@@ -109,7 +108,7 @@ $new-sidebar-collapsed-width: 50px; ...@@ -109,7 +108,7 @@ $new-sidebar-collapsed-width: 50px;
} }
.badge, .badge,
.project-title { .sidebar-context-title {
display: none; display: none;
} }
......
...@@ -840,6 +840,7 @@ a.allowed-to-push { ...@@ -840,6 +840,7 @@ a.allowed-to-push {
label { label {
margin-top: 6px; margin-top: 6px;
font-weight: $gl-font-weight-normal; font-weight: $gl-font-weight-normal;
<<<<<<< HEAD
} }
} }
...@@ -847,6 +848,8 @@ a.allowed-to-push { ...@@ -847,6 +848,8 @@ a.allowed-to-push {
.protected-branch-merge-access-list { .protected-branch-merge-access-list {
a { a {
color: $white-light; color: $white-light;
=======
>>>>>>> upstream/master
} }
} }
......
...@@ -11,6 +11,14 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController ...@@ -11,6 +11,14 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
end end
end end
if Gitlab::LDAP::Config.enabled?
Gitlab::LDAP::Config.available_servers.each do |server|
define_method server['provider_name'] do
ldap
end
end
end
# Extend the standard message generation to accept our custom exception # Extend the standard message generation to accept our custom exception
def failure_message def failure_message
exception = env["omniauth.error"] exception = env["omniauth.error"]
......
...@@ -6,14 +6,6 @@ class SessionsController < Devise::SessionsController ...@@ -6,14 +6,6 @@ class SessionsController < Devise::SessionsController
skip_before_action :check_two_factor_requirement, only: [:destroy] skip_before_action :check_two_factor_requirement, only: [:destroy]
# Explicitly call protect from forgery before anything else. Otherwise the
# CSFR-token might be cleared before authentication is done. This was the case
# when LDAP was enabled and the `OmniauthCallbacksController` is loaded
#
# *Note:* `prepend: true` is the default for rails4, but this will be changed
# to `prepend: false` in rails5.
protect_from_forgery prepend: true, with: :exception
prepend_before_action :check_initial_setup, only: [:new] prepend_before_action :check_initial_setup, only: [:new]
prepend_before_action :authenticate_with_two_factor, prepend_before_action :authenticate_with_two_factor,
if: :two_factor_enabled?, only: [:create] if: :two_factor_enabled?, only: [:create]
......
...@@ -50,7 +50,10 @@ module Ci ...@@ -50,7 +50,10 @@ module Ci
before_save :ensure_token before_save :ensure_token
before_destroy { unscoped_project } before_destroy { unscoped_project }
after_create :execute_hooks after_create do |build|
run_after_commit { BuildHooksWorker.perform_async(build.id) }
end
after_commit :update_project_statistics_after_save, on: [:create, :update] after_commit :update_project_statistics_after_save, on: [:create, :update]
after_commit :update_project_statistics, on: :destroy after_commit :update_project_statistics, on: :destroy
......
...@@ -17,6 +17,10 @@ module Ci ...@@ -17,6 +17,10 @@ module Ci
validates :pipeline, presence: true, unless: :importing? validates :pipeline, presence: true, unless: :importing?
validates :name, presence: true, unless: :importing? validates :name, presence: true, unless: :importing?
after_initialize do |stage|
self.status = DEFAULT_STATUS if self.status.nil?
end
state_machine :status, initial: :created do state_machine :status, initial: :created do
event :enqueue do event :enqueue do
transition created: :pending transition created: :pending
......
...@@ -1272,7 +1272,7 @@ class Repository ...@@ -1272,7 +1272,7 @@ class Repository
end end
def initialize_raw_repository def initialize_raw_repository
Gitlab::Git::Repository.new(project.repository_storage, disk_path + '.git') Gitlab::Git::Repository.new(project.repository_storage, disk_path + '.git', Gitlab::GlRepository.gl_repository(project, false))
end end
def circuit_breaker def circuit_breaker
......
...@@ -17,7 +17,7 @@ module Commits ...@@ -17,7 +17,7 @@ module Commits
new_commit = create_commit! new_commit = create_commit!
success(result: new_commit) success(result: new_commit)
rescue ValidationError, ChangeError, Gitlab::Git::Index::IndexError, Repository::CommitError, GitHooksService::PreReceiveError => ex rescue ValidationError, ChangeError, Gitlab::Git::Index::IndexError, Repository::CommitError, Gitlab::Git::HooksService::PreReceiveError => ex
error(ex.message) error(ex.message)
end end
......
...@@ -14,7 +14,7 @@ class CreateBranchService < BaseService ...@@ -14,7 +14,7 @@ class CreateBranchService < BaseService
else else
error('Invalid reference name') error('Invalid reference name')
end end
rescue GitHooksService::PreReceiveError => ex rescue Gitlab::Git::HooksService::PreReceiveError => ex
error(ex.message) error(ex.message)
end end
......
...@@ -16,7 +16,7 @@ class DeleteBranchService < BaseService ...@@ -16,7 +16,7 @@ class DeleteBranchService < BaseService
else else
error('Failed to remove branch') error('Failed to remove branch')
end end
rescue GitHooksService::PreReceiveError => ex rescue Gitlab::Git::HooksService::PreReceiveError => ex
error(ex.message) error(ex.message)
end end
......
class GitHooksService
PreReceiveError = Class.new(StandardError)
attr_accessor :oldrev, :newrev, :ref
def execute(user, project, oldrev, newrev, ref)
@project = project
@user = Gitlab::GlId.gl_id(user)
@oldrev = oldrev
@newrev = newrev
@ref = ref
%w(pre-receive update).each do |hook_name|
status, message = run_hook(hook_name)
unless status
raise PreReceiveError, message
end
end
yield(self).tap do
run_hook('post-receive')
end
end
private
def run_hook(name)
hook = Gitlab::Git::Hook.new(name, @project)
hook.trigger(@user, oldrev, newrev, ref)
end
end
class GitOperationService class GitOperationService
attr_reader :user, :repository attr_reader :committer, :repository
def initialize(committer, new_repository)
committer = Gitlab::Git::Committer.from_user(committer) if committer.is_a?(User)
@committer = committer
def initialize(new_user, new_repository)
@user = new_user
@repository = new_repository @repository = new_repository
end end
...@@ -118,9 +120,9 @@ class GitOperationService ...@@ -118,9 +120,9 @@ class GitOperationService
end end
def with_hooks(ref, newrev, oldrev) def with_hooks(ref, newrev, oldrev)
GitHooksService.new.execute( Gitlab::Git::HooksService.new.execute(
user, committer,
repository.project, repository,
oldrev, oldrev,
newrev, newrev,
ref) do |service| ref) do |service|
......
...@@ -78,7 +78,7 @@ module MergeRequests ...@@ -78,7 +78,7 @@ module MergeRequests
raise MergeError, 'Conflicts detected during merge' unless commit_id raise MergeError, 'Conflicts detected during merge' unless commit_id
merge_request.update(merge_commit_sha: commit_id) merge_request.update(merge_commit_sha: commit_id)
rescue GitHooksService::PreReceiveError => e rescue Gitlab::Git::HooksService::PreReceiveError => e
raise MergeError, e.message raise MergeError, e.message
rescue StandardError => e rescue StandardError => e
raise MergeError, "Something went wrong during merge: #{e.message}" raise MergeError, "Something went wrong during merge: #{e.message}"
......
...@@ -13,7 +13,7 @@ module Tags ...@@ -13,7 +13,7 @@ module Tags
new_tag = repository.add_tag(current_user, tag_name, target, message) new_tag = repository.add_tag(current_user, tag_name, target, message)
rescue Rugged::TagError rescue Rugged::TagError
return error("Tag #{tag_name} already exists") return error("Tag #{tag_name} already exists")
rescue GitHooksService::PreReceiveError => ex rescue Gitlab::Git::HooksService::PreReceiveError => ex
return error(ex.message) return error(ex.message)
end end
......
...@@ -21,7 +21,7 @@ module Tags ...@@ -21,7 +21,7 @@ module Tags
else else
error('Failed to remove tag') error('Failed to remove tag')
end end
rescue GitHooksService::PreReceiveError => ex rescue Gitlab::Git::HooksService::PreReceiveError => ex
error(ex.message) error(ex.message)
end end
......
...@@ -13,7 +13,7 @@ class ValidateNewBranchService < BaseService ...@@ -13,7 +13,7 @@ class ValidateNewBranchService < BaseService
end end
success success
rescue GitHooksService::PreReceiveError => ex rescue Gitlab::Git::HooksService::PreReceiveError => ex
error(ex.message) error(ex.message)
end end
end end
.nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) } .nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) }
<<<<<<< HEAD
.context-header .context-header
= link_to admin_root_path, title: 'Admin Overview' do = link_to admin_root_path, title: 'Admin Overview' do
.avatar-container.s40.settings-avatar .avatar-container.s40.settings-avatar
...@@ -114,6 +115,17 @@ ...@@ -114,6 +115,17 @@
- if akismet_enabled? - if akismet_enabled?
= nav_link(controller: :spam_logs) do = nav_link(controller: :spam_logs) do
= link_to admin_spam_logs_path, title: "Spam Logs" do = link_to admin_spam_logs_path, title: "Spam Logs" do
=======
.nav-sidebar-inner-scroll
.context-header
= link_to admin_root_path, title: 'Admin Overview' do
.avatar-container.s40.settings-avatar
= icon('wrench')
.sidebar-context-title Admin Area
%ul.sidebar-top-level-items
= nav_link(controller: %w(dashboard admin projects users groups jobs runners cohorts), html_options: {class: 'home'}) do
= link_to admin_root_path, title: 'Overview', class: 'shortcuts-tree' do
>>>>>>> upstream/master
.nav-icon-container .nav-icon-container
= custom_icon('overview') = custom_icon('overview')
%span.nav-item-name %span.nav-item-name
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
= link_to group_path(@group), title: @group.name do = link_to group_path(@group), title: @group.name do
.avatar-container.s40.group-avatar .avatar-container.s40.group-avatar
= image_tag group_icon(@group), class: "avatar s40 avatar-tile" = image_tag group_icon(@group), class: "avatar s40 avatar-tile"
.group-title .sidebar-context-title
= @group.name = @group.name
%ul.sidebar-top-level-items %ul.sidebar-top-level-items
= nav_link(path: ['groups#show', 'groups#activity', 'groups#subgroups', 'analytics#show'], html_options: { class: 'home' }) do = nav_link(path: ['groups#show', 'groups#activity', 'groups#subgroups', 'analytics#show'], html_options: { class: 'home' }) do
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
= link_to profile_path, title: 'Profile Settings' do = link_to profile_path, title: 'Profile Settings' do
.avatar-container.s40.settings-avatar .avatar-container.s40.settings-avatar
= icon('user') = icon('user')
.project-title User Settings .sidebar-context-title User Settings
%ul.sidebar-top-level-items %ul.sidebar-top-level-items
= nav_link(path: 'profiles#show', html_options: {class: 'home'}) do = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do
= link_to profile_path, title: 'Profile Settings' do = link_to profile_path, title: 'Profile Settings' do
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
= link_to project_path(@project), title: @project.name do = link_to project_path(@project), title: @project.name do
.avatar-container.s40.project-avatar .avatar-container.s40.project-avatar
= project_icon(@project, alt: @project.name, class: 'avatar s40 avatar-tile') = project_icon(@project, alt: @project.name, class: 'avatar s40 avatar-tile')
.project-title .sidebar-context-title
= @project.name = @project.name
%ul.sidebar-top-level-items %ul.sidebar-top-level-items
= nav_link(path: ['projects#show', 'projects#activity', 'cycle_analytics#show'], html_options: { class: 'home' }) do = nav_link(path: ['projects#show', 'projects#activity', 'cycle_analytics#show'], html_options: { class: 'home' }) do
......
...@@ -14,19 +14,19 @@ ...@@ -14,19 +14,19 @@
.prepend-top-default .prepend-top-default
%p.light %p.light
= _("Jobs for last week") = _("Pipelines for last week")
(#{date_from_to(Date.today - 7.days, Date.today)}) (#{date_from_to(Date.today - 7.days, Date.today)})
%canvas#weekChart{ height: 200 } %canvas#weekChart{ height: 200 }
.prepend-top-default .prepend-top-default
%p.light %p.light
= _("Jobs for last month") = _("Pipelines for last month")
(#{date_from_to(Date.today - 30.days, Date.today)}) (#{date_from_to(Date.today - 30.days, Date.today)})
%canvas#monthChart{ height: 200 } %canvas#monthChart{ height: 200 }
.prepend-top-default .prepend-top-default
%p.light %p.light
= _("Jobs for last year") = _("Pipelines for last year")
%canvas#yearChart.padded{ height: 250 } %canvas#yearChart.padded{ height: 250 }
%script#pipelinesChartsData{ type: "application/json" } %script#pipelinesChartsData{ type: "application/json" }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
- if runner.locked? - if runner.locked?
= icon('lock', class: 'has-tooltip', title: 'Locked to current projects') = icon('lock', class: 'has-tooltip', title: 'Locked to current projects')
%small %small.edit-runner
= link_to edit_project_runner_path(@project, runner) do = link_to edit_project_runner_path(@project, runner) do
%i.fa.fa-edit.btn %i.fa.fa-edit.btn
- else - else
......
---
title: Fix invite by email address duplication
merge_request:
author:
type: fixed
---
title: Fix searching for files by path
merge_request: 13798
author:
type: fixed
---
title: Fire hooks asynchronously when creating a new job to improve performance
merge_request: 13734
author:
type: changed
---
title: Re-allow appearances.description_html to be NULL
merge_request:
author:
type: fixed
---
title: Reword job to pipeline to reflect what the graphs are really about
merge_request:
author:
type: fixed
...@@ -6,12 +6,6 @@ if Gitlab::LDAP::Config.enabled? ...@@ -6,12 +6,6 @@ if Gitlab::LDAP::Config.enabled?
const_set(server['provider_class'], Class.new(LDAP)) const_set(server['provider_class'], Class.new(LDAP))
end end
end end
OmniauthCallbacksController.class_eval do
Gitlab::LDAP::Config.available_servers.each do |server|
alias_method server['provider_name'], :ldap
end
end
end end
OmniAuth.config.full_host = Settings.gitlab['base_url'] OmniAuth.config.full_host = Settings.gitlab['base_url']
......
...@@ -15,7 +15,7 @@ class Gitlab::Seeder::CycleAnalytics ...@@ -15,7 +15,7 @@ class Gitlab::Seeder::CycleAnalytics
# to disable the `pre_receive` hook in order to remove this # to disable the `pre_receive` hook in order to remove this
# dependency on the GitLab API. # dependency on the GitLab API.
def stub_git_pre_receive! def stub_git_pre_receive!
GitHooksService.class_eval do Gitlab::Git::HooksService.class_eval do
def run_hook(name) def run_hook(name)
[true, ''] [true, '']
end end
......
...@@ -11,7 +11,7 @@ class MigrateRepoSize < ActiveRecord::Migration ...@@ -11,7 +11,7 @@ class MigrateRepoSize < ActiveRecord::Migration
path = File.join(namespace_path, project['project_path'] + '.git') path = File.join(namespace_path, project['project_path'] + '.git')
begin begin
repo = Gitlab::Git::Repository.new('default', path) repo = Gitlab::Git::Repository.new('default', path, '')
if repo.empty? if repo.empty?
print '-' print '-'
else else
......
...@@ -7,7 +7,7 @@ class CleanupAppearancesSchema < ActiveRecord::Migration ...@@ -7,7 +7,7 @@ class CleanupAppearancesSchema < ActiveRecord::Migration
# Set this constant to true if this migration requires downtime. # Set this constant to true if this migration requires downtime.
DOWNTIME = false DOWNTIME = false
NOT_NULL_COLUMNS = %i[title description description_html created_at updated_at] NOT_NULL_COLUMNS = %i[title description created_at updated_at]
TIME_COLUMNS = %i[created_at updated_at] TIME_COLUMNS = %i[created_at updated_at]
......
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AllowAppearancesDescriptionHtmlNull < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
def up
change_column_null :appearances, :description_html, true
end
def down
# This column should not have a `NOT NULL` class, so we don't want to revert
# back to re-adding it.
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170820100558) do ActiveRecord::Schema.define(version: 20170824162758) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -35,7 +35,7 @@ ActiveRecord::Schema.define(version: 20170820100558) do ...@@ -35,7 +35,7 @@ ActiveRecord::Schema.define(version: 20170820100558) do
t.integer "updated_by" t.integer "updated_by"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.text "description_html", null: false t.text "description_html"
t.integer "cached_markdown_version" t.integer "cached_markdown_version"
end end
......
...@@ -76,7 +76,8 @@ Learn how to deploy a static website with [GitLab Pages](../user/project/pages/i ...@@ -76,7 +76,8 @@ Learn how to deploy a static website with [GitLab Pages](../user/project/pages/i
## Install and maintain GitLab ## Install and maintain GitLab
Install, upgrade, integrate, migrate to GitLab: [Admin](../README.md#administrator-documentation), [install](../install/README.md),
upgrade, integrate, migrate to GitLab:
| Article title | Category | Publishing date | | Article title | Category | Publishing date |
| :------------ | :------: | --------------: | | :------------ | :------: | --------------: |
......
...@@ -18,9 +18,17 @@ the hardware requirements. ...@@ -18,9 +18,17 @@ the hardware requirements.
Useful for unsupported systems like *BSD. For an overview of the directory Useful for unsupported systems like *BSD. For an overview of the directory
structure, read the [structure documentation](structure.md). structure, read the [structure documentation](structure.md).
- [Docker](https://docs.gitlab.com/omnibus/docker/) - Install GitLab using Docker. - [Docker](https://docs.gitlab.com/omnibus/docker/) - Install GitLab using Docker.
## Install GitLab on cloud providers
- [Installing in Kubernetes](kubernetes/index.md) - Install GitLab into a Kubernetes - [Installing in Kubernetes](kubernetes/index.md) - Install GitLab into a Kubernetes
Cluster using our official Helm Chart Repository. Cluster using our official Helm Chart Repository.
- Testing only! [DigitalOcean and Docker Machine](digitaloceandocker.md) - - [Install GitLab on OpenShift](../articles/openshift_and_gitlab/index.md)
- [Install GitLab on DC/OS](https://mesosphere.com/blog/gitlab-dcos/) via [GitLab-Mesosphere integration](https://about.gitlab.com/2016/09/16/announcing-gitlab-and-mesosphere/)
- [Install GitLab on Azure](azure/index.md)
- [Install GitLab on Google Cloud Platform](google_cloud_platform/index.md)
- [Install on AWS](https://about.gitlab.com/aws/)
- _Testing only!_ [DigitalOcean and Docker Machine](digitaloceandocker.md) -
Quickly test any version of GitLab on DigitalOcean using Docker Machine. Quickly test any version of GitLab on DigitalOcean using Docker Machine.
- [GitLab Pivotal Tile](pivotal/index.md) - Install and configure GitLab - [GitLab Pivotal Tile](pivotal/index.md) - Install and configure GitLab
Enterprise Edition Premium on Pivotal Cloud Foundry. Enterprise Edition Premium on Pivotal Cloud Foundry.
......
This diff is collapsed.
...@@ -38,9 +38,9 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps ...@@ -38,9 +38,9 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
step 'page should have CI graphs' do step 'page should have CI graphs' do
expect(page).to have_content 'Overall' expect(page).to have_content 'Overall'
expect(page).to have_content 'Jobs for last week' expect(page).to have_content 'Pipelines for last week'
expect(page).to have_content 'Jobs for last month' expect(page).to have_content 'Pipelines for last month'
expect(page).to have_content 'Jobs for last year' expect(page).to have_content 'Pipelines for last year'
expect(page).to have_content 'Commit duration in minutes for last 30 commits' expect(page).to have_content 'Commit duration in minutes for last 30 commits'
end end
......
...@@ -35,7 +35,10 @@ class Spinach::Features::ProjectPages < Spinach::FeatureSteps ...@@ -35,7 +35,10 @@ class Spinach::Features::ProjectPages < Spinach::FeatureSteps
end end
step 'pages are deployed' do step 'pages are deployed' do
pipeline = @project.pipelines.create(ref: 'HEAD', sha: @project.commit('HEAD').sha) pipeline = @project.pipelines.create(ref: 'HEAD',
sha: @project.commit('HEAD').sha,
source: :push)
build = build(:ci_build, build = build(:ci_build,
project: @project, project: @project,
pipeline: pipeline, pipeline: pipeline,
...@@ -43,6 +46,7 @@ class Spinach::Features::ProjectPages < Spinach::FeatureSteps ...@@ -43,6 +46,7 @@ class Spinach::Features::ProjectPages < Spinach::FeatureSteps
artifacts_file: fixture_file_upload(Rails.root + 'spec/fixtures/pages.zip'), artifacts_file: fixture_file_upload(Rails.root + 'spec/fixtures/pages.zip'),
artifacts_metadata: fixture_file_upload(Rails.root + 'spec/fixtures/pages.zip.meta') artifacts_metadata: fixture_file_upload(Rails.root + 'spec/fixtures/pages.zip.meta')
) )
result = ::Projects::UpdatePagesService.new(@project, build).execute result = ::Projects::UpdatePagesService.new(@project, build).execute
expect(result[:status]).to eq(:success) expect(result[:status]).to eq(:success)
end end
......
...@@ -6,27 +6,48 @@ module Gitlab ...@@ -6,27 +6,48 @@ module Gitlab
attr_reader :project, :ref attr_reader :project, :ref
delegate :repository, to: :project
def initialize(project, ref) def initialize(project, ref)
@project = project @project = project
@ref = ref @ref = ref
end end
def find(query) def find(query)
blobs = project.repository.search_files_by_content(query, ref).first(BATCH_SIZE) by_content = find_by_content(query)
found_file_names = Set.new
results = blobs.map do |blob| already_found = Set.new(by_content.map(&:filename))
blob = Gitlab::ProjectSearchResults.parse_search_result(blob) by_filename = find_by_filename(query, except: already_found)
found_file_names << blob.filename
[blob.filename, blob] (by_content + by_filename)
end .sort_by(&:filename)
.map { |blob| [blob.filename, blob] }
end
project.repository.search_files_by_name(query, ref).first(BATCH_SIZE).each do |filename| private
results << [filename, OpenStruct.new(ref: ref)] unless found_file_names.include?(filename)
end
results.sort_by(&:first) def find_by_content(query)
results = repository.search_files_by_content(query, ref).first(BATCH_SIZE)
results.map { |result| Gitlab::ProjectSearchResults.parse_search_result(result) }
end
def find_by_filename(query, except: [])
filenames = repository.search_files_by_name(query, ref).first(BATCH_SIZE)
filenames.delete_if { |filename| except.include?(filename) } unless except.empty?
blob_refs = filenames.map { |filename| [ref, filename] }
blobs = Gitlab::Git::Blob.batch(repository, blob_refs, blob_size_limit: 1024)
blobs.map do |blob|
Gitlab::SearchResults::FoundBlob.new(
id: blob.id,
filename: blob.path,
basename: File.basename(blob.path),
ref: ref,
startline: 1,
data: blob.data
)
end
end end
end end
end end
module Gitlab
module Git
class Committer
attr_reader :name, :email, :gl_id
def self.from_user(user)
new(user.name, user.email, Gitlab::GlId.gl_id(user))
end
def initialize(name, email, gl_id)
@name = name
@email = email
@gl_id = gl_id
end
def ==(other)
[name, email, gl_id] == [other.name, other.email, other.gl_id]
end
end
end
end
# Gitaly note: JV: looks like this is only used by GitHooksService in # Gitaly note: JV: looks like this is only used by Gitlab::Git::HooksService in
# app/services. We shouldn't bother migrating this until we know how # app/services. We shouldn't bother migrating this until we know how
# GitHooksService will be migrated. # Gitlab::Git::HooksService will be migrated.
module Gitlab module Gitlab
module Git module Git
class Hook class Hook
GL_PROTOCOL = 'web'.freeze GL_PROTOCOL = 'web'.freeze
attr_reader :name, :repo_path, :path attr_reader :name, :path, :repository
def initialize(name, project) def initialize(name, repository)
@name = name @name = name
@project = project @repository = repository
@repo_path = project.repository.path
@path = File.join(repo_path.strip, 'hooks', name) @path = File.join(repo_path.strip, 'hooks', name)
end end
def repo_path
repository.path
end
def exists? def exists?
File.exist?(path) File.exist?(path)
end end
...@@ -44,7 +47,7 @@ module Gitlab ...@@ -44,7 +47,7 @@ module Gitlab
'GL_ID' => gl_id, 'GL_ID' => gl_id,
'PWD' => repo_path, 'PWD' => repo_path,
'GL_PROTOCOL' => GL_PROTOCOL, 'GL_PROTOCOL' => GL_PROTOCOL,
'GL_REPOSITORY' => Gitlab::GlRepository.gl_repository(@project, false) 'GL_REPOSITORY' => repository.gl_repository
} }
options = { options = {
......
module Gitlab
module Git
class HooksService
PreReceiveError = Class.new(StandardError)
attr_accessor :oldrev, :newrev, :ref
def execute(committer, repository, oldrev, newrev, ref)
@repository = repository
@gl_id = committer.gl_id
@oldrev = oldrev
@newrev = newrev
@ref = ref
%w(pre-receive update).each do |hook_name|
status, message = run_hook(hook_name)
unless status
raise PreReceiveError, message
end
end
yield(self).tap do
run_hook('post-receive')
end
end
private
def run_hook(name)
hook = Gitlab::Git::Hook.new(name, @repository)
hook.trigger(@gl_id, oldrev, newrev, ref)
end
end
end
end
...@@ -49,13 +49,14 @@ module Gitlab ...@@ -49,13 +49,14 @@ module Gitlab
# Rugged repo object # Rugged repo object
attr_reader :rugged attr_reader :rugged
attr_reader :storage attr_reader :storage, :gl_repository, :relative_path
# 'path' must be the path to a _bare_ git repository, e.g. # 'path' must be the path to a _bare_ git repository, e.g.
# /path/to/my-repo.git # /path/to/my-repo.git
def initialize(storage, relative_path) def initialize(storage, relative_path, gl_repository)
@storage = storage @storage = storage
@relative_path = relative_path @relative_path = relative_path
@gl_repository = gl_repository
storage_path = Gitlab.config.repositories.storages[@storage]['path'] storage_path = Gitlab.config.repositories.storages[@storage]['path']
@path = File.join(storage_path, @relative_path) @path = File.join(storage_path, @relative_path)
......
...@@ -8,8 +8,8 @@ msgid "" ...@@ -8,8 +8,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: gitlab 1.0.0\n" "Project-Id-Version: gitlab 1.0.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-18 14:15+0530\n" "POT-Creation-Date: 2017-08-24 09:29+0200\n"
"PO-Revision-Date: 2017-08-18 14:15+0530\n" "PO-Revision-Date: 2017-08-24 09:29+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
...@@ -517,15 +517,6 @@ msgstr "" ...@@ -517,15 +517,6 @@ msgstr ""
msgid "Issue events" msgid "Issue events"
msgstr "" msgstr ""
msgid "Jobs for last month"
msgstr ""
msgid "Jobs for last week"
msgstr ""
msgid "Jobs for last year"
msgstr ""
msgid "LFSStatus|Disabled" msgid "LFSStatus|Disabled"
msgstr "" msgstr ""
...@@ -766,6 +757,15 @@ msgstr "" ...@@ -766,6 +757,15 @@ msgstr ""
msgid "Pipelines charts" msgid "Pipelines charts"
msgstr "" msgstr ""
msgid "Pipelines for last month"
msgstr ""
msgid "Pipelines for last week"
msgstr ""
msgid "Pipelines for last year"
msgstr ""
msgid "Pipeline|all" msgid "Pipeline|all"
msgstr "" msgstr ""
......
...@@ -99,6 +99,6 @@ feature 'Import/Export - project import integration test', js: true do ...@@ -99,6 +99,6 @@ feature 'Import/Export - project import integration test', js: true do
end end
def project_hook_exists?(project) def project_hook_exists?(project)
Gitlab::Git::Hook.new('post-receive', project).exists? Gitlab::Git::Hook.new('post-receive', project.repository.raw_repository).exists?
end end
end end
require 'spec_helper' require 'spec_helper'
describe "Runners" do feature 'Runners' do
let(:user) { create(:user) } given(:user) { create(:user) }
before do background do
sign_in(user) sign_in(user)
end end
describe "specific runners" do context 'when a project has enabled shared_runners' do
before do given(:project) { create(:project) }
@project = FactoryGirl.create :project, shared_runners_enabled: false
@project.team << [user, :master]
@project2 = FactoryGirl.create :project background do
@project2.team << [user, :master] project.add_master(user)
end
@project3 = FactoryGirl.create :project context 'when a specific runner is activated on the project' do
@project3.team << [user, :developer] given(:specific_runner) { create(:ci_runner, :specific) }
@shared_runner = FactoryGirl.create :ci_runner, :shared background do
@specific_runner = FactoryGirl.create :ci_runner project.runners << specific_runner
@specific_runner2 = FactoryGirl.create :ci_runner end
@specific_runner3 = FactoryGirl.create :ci_runner
@project.runners << @specific_runner
@project2.runners << @specific_runner2
@project3.runners << @specific_runner3
visit runners_path(@project) scenario 'user sees the specific runner' do
end visit runners_path(project)
before do within '.activated-specific-runners' do
expect(page).not_to have_content(@specific_runner3.display_name) expect(page).to have_content(specific_runner.display_name)
expect(page).not_to have_content(@specific_runner3.display_name) end
end
it "places runners in right places" do click_on specific_runner.short_sha
expect(page.find(".available-specific-runners")).to have_content(@specific_runner2.display_name)
expect(page.find(".activated-specific-runners")).to have_content(@specific_runner.display_name)
expect(page.find(".available-shared-runners")).to have_content(@shared_runner.display_name)
end
it "enables specific runner for project" do expect(page).to have_content(specific_runner.platform)
within ".available-specific-runners" do
click_on "Enable for this project"
end end
expect(page.find(".activated-specific-runners")).to have_content(@specific_runner2.display_name) scenario 'user removes an activated specific runner if this is last project for that runners' do
end visit runners_path(project)
it "disables specific runner for project" do within '.activated-specific-runners' do
@project2.runners << @specific_runner click_on 'Remove Runner'
visit runners_path(@project) end
within ".activated-specific-runners" do expect(page).not_to have_content(specific_runner.display_name)
click_on "Disable for this project"
end end
expect(page.find(".available-specific-runners")).to have_content(@specific_runner.display_name) context 'when a runner has a tag' do
end background do
specific_runner.update(tag_list: ['tag'])
end
it "removes specific runner for project if this is last project for that runners" do scenario 'user edits runner not to run untagged jobs' do
within ".activated-specific-runners" do visit runners_path(project)
click_on "Remove Runner"
end
expect(Ci::Runner.exists?(id: @specific_runner)).to be_falsey within '.activated-specific-runners' do
end first('.edit-runner > a').click
end end
describe "shared runners" do expect(page.find_field('runner[run_untagged]')).to be_checked
before do
@project = FactoryGirl.create :project, shared_runners_enabled: false
@project.team << [user, :master]
visit runners_path(@project)
end
it "enables shared runners" do uncheck 'runner_run_untagged'
click_on "Enable shared Runners" click_button 'Save changes'
expect(@project.reload.shared_runners_enabled).to be_truthy
end
end
describe "shared runners description" do expect(page).to have_content 'Can run untagged jobs No'
let(:shared_runners_text) { 'custom **shared** runners description' } end
let(:shared_runners_html) { 'custom shared runners description' } end
before do context 'when a shared runner is activated on the project' do
stub_application_setting(shared_runners_text: shared_runners_text) given!(:shared_runner) { create(:ci_runner, :shared) }
project = FactoryGirl.create :project, shared_runners_enabled: false
project.team << [user, :master]
visit runners_path(project)
end
it "sees shared runners description" do scenario 'user sees CI/CD setting page' do
expect(page.find(".shared-runners-description")).to have_content(shared_runners_html) visit runners_path(project)
end
end
describe "show page" do expect(page.find('.available-shared-runners')).to have_content(shared_runner.display_name)
before do end
@project = FactoryGirl.create :project end
@project.team << [user, :master]
@specific_runner = FactoryGirl.create :ci_runner
@project.runners << @specific_runner
end end
it "shows runner information" do context 'when a specific runner exists in another project' do
visit runners_path(@project) given(:another_project) { create(:project) }
click_on @specific_runner.short_sha given(:specific_runner) { create(:ci_runner, :specific) }
expect(page).to have_content(@specific_runner.platform)
end
end
feature 'configuring runners ability to picking untagged jobs' do background do
given(:project) { create(:project) } another_project.add_master(user)
given(:runner) { create(:ci_runner) } another_project.runners << specific_runner
end
background do scenario 'user enables and disables a specific runner' do
project.team << [user, :master] visit runners_path(project)
project.runners << runner
end within '.available-specific-runners' do
click_on 'Enable for this project'
end
scenario 'user checks default configuration' do expect(page.find('.activated-specific-runners')).to have_content(specific_runner.display_name)
visit project_runner_path(project, runner)
expect(page).to have_content 'Can run untagged jobs Yes' within '.activated-specific-runners' do
click_on 'Disable for this project'
end
expect(page.find('.available-specific-runners')).to have_content(specific_runner.display_name)
end
end end
context 'when runner has tags' do context 'when application settings have shared_runners_text' do
before do given(:shared_runners_text) { 'custom **shared** runners description' }
runner.update_attribute(:tag_list, ['tag']) given(:shared_runners_html) { 'custom shared runners description' }
background do
stub_application_setting(shared_runners_text: shared_runners_text)
end end
scenario 'user wants to prevent runner from running untagged job' do scenario 'user sees shared runners description' do
visit runners_path(project) visit runners_path(project)
page.within('.activated-specific-runners') do
first('small > a').click
end
uncheck 'runner_run_untagged' expect(page.find('.shared-runners-description')).to have_content(shared_runners_html)
click_button 'Save changes'
expect(page).to have_content 'Can run untagged jobs No'
expect(runner.reload.run_untagged?).to eq false
end end
end end
end end
context 'when a project has disabled shared_runners' do
given(:project) { create(:project, shared_runners_enabled: false) }
background do
project.add_master(user)
end
scenario 'user enables shared runners' do
visit runners_path(project)
click_on 'Enable shared Runners'
expect(page.find('.shared-runners-description')).to have_content('Disable shared Runners')
end
end
end end
...@@ -36,8 +36,8 @@ feature 'Master deletes tag' do ...@@ -36,8 +36,8 @@ feature 'Master deletes tag' do
context 'when pre-receive hook fails', js: true do context 'when pre-receive hook fails', js: true do
before do before do
allow_any_instance_of(GitHooksService).to receive(:execute) allow_any_instance_of(Gitlab::Git::HooksService).to receive(:execute)
.and_raise(GitHooksService::PreReceiveError, 'Do not delete tags') .and_raise(Gitlab::Git::HooksService::PreReceiveError, 'Do not delete tags')
end end
scenario 'shows the error message' do scenario 'shows the error message' do
......
import Vue from 'vue'; import Vue from 'vue';
import repoCommitSection from '~/repo/components/repo_commit_section.vue'; import repoCommitSection from '~/repo/components/repo_commit_section.vue';
import RepoStore from '~/repo/stores/repo_store'; import RepoStore from '~/repo/stores/repo_store';
import Api from '~/api'; import RepoService from '~/repo/services/repo_service';
describe('RepoCommitSection', () => { describe('RepoCommitSection', () => {
const branch = 'master'; const branch = 'master';
...@@ -111,7 +111,7 @@ describe('RepoCommitSection', () => { ...@@ -111,7 +111,7 @@ describe('RepoCommitSection', () => {
expect(submitCommit.disabled).toBeFalsy(); expect(submitCommit.disabled).toBeFalsy();
spyOn(vm, 'makeCommit').and.callThrough(); spyOn(vm, 'makeCommit').and.callThrough();
spyOn(Api, 'commitMultiple'); spyOn(RepoService, 'commitFiles').and.callFake(() => Promise.resolve());
submitCommit.click(); submitCommit.click();
...@@ -119,10 +119,9 @@ describe('RepoCommitSection', () => { ...@@ -119,10 +119,9 @@ describe('RepoCommitSection', () => {
expect(vm.makeCommit).toHaveBeenCalled(); expect(vm.makeCommit).toHaveBeenCalled();
expect(submitCommit.querySelector('.fa-spinner.fa-spin')).toBeTruthy(); expect(submitCommit.querySelector('.fa-spinner.fa-spin')).toBeTruthy();
const args = Api.commitMultiple.calls.allArgs()[0]; const args = RepoService.commitFiles.calls.allArgs()[0];
const { commit_message, actions, branch: payloadBranch } = args[1]; const { commit_message, actions, branch: payloadBranch } = args[0];
expect(args[0]).toBe(projectId);
expect(commit_message).toBe(commitMessage); expect(commit_message).toBe(commitMessage);
expect(actions.length).toEqual(2); expect(actions.length).toEqual(2);
expect(payloadBranch).toEqual(branch); expect(payloadBranch).toEqual(branch);
......
import axios from 'axios'; import axios from 'axios';
import RepoService from '~/repo/services/repo_service'; import RepoService from '~/repo/services/repo_service';
import RepoStore from '~/repo/stores/repo_store';
import Api from '~/api';
describe('RepoService', () => { describe('RepoService', () => {
it('has default json format param', () => { it('has default json format param', () => {
...@@ -118,4 +120,52 @@ describe('RepoService', () => { ...@@ -118,4 +120,52 @@ describe('RepoService', () => {
}).catch(done.fail); }).catch(done.fail);
}); });
}); });
describe('commitFiles', () => {
it('calls commitMultiple and .then commitFlash', (done) => {
const projectId = 'projectId';
const payload = {};
RepoStore.projectId = projectId;
spyOn(Api, 'commitMultiple').and.returnValue(Promise.resolve());
spyOn(RepoService, 'commitFlash');
const apiPromise = RepoService.commitFiles(payload);
expect(Api.commitMultiple).toHaveBeenCalledWith(projectId, payload);
apiPromise.then(() => {
expect(RepoService.commitFlash).toHaveBeenCalled();
done();
}).catch(done.fail);
});
});
describe('commitFlash', () => {
it('calls Flash with data.message', () => {
const data = {
message: 'message',
};
spyOn(window, 'Flash');
RepoService.commitFlash(data);
expect(window.Flash).toHaveBeenCalledWith(data.message);
});
it('calls Flash with success string if short_id and stats', () => {
const data = {
short_id: 'short_id',
stats: {
additions: '4',
deletions: '5',
},
};
spyOn(window, 'Flash');
RepoService.commitFlash(data);
expect(window.Flash).toHaveBeenCalledWith(`Your changes have been committed. Commit ${data.short_id} with ${data.stats.additions} additions, ${data.stats.deletions} deletions.`, 'notice');
});
});
}); });
...@@ -7,15 +7,23 @@ describe Gitlab::FileFinder do ...@@ -7,15 +7,23 @@ describe Gitlab::FileFinder do
it 'finds by name' do it 'finds by name' do
results = finder.find('files') results = finder.find('files')
expect(results.map(&:first)).to include('files/images/wm.svg')
filename, blob = results.find { |_, blob| blob.filename == 'files/images/wm.svg' }
expect(filename).to eq('files/images/wm.svg')
expect(blob).to be_a(Gitlab::SearchResults::FoundBlob)
expect(blob.ref).to eq(finder.ref)
expect(blob.data).not_to be_empty
end end
it 'finds by content' do it 'finds by content' do
results = finder.find('files') results = finder.find('files')
blob = results.select { |result| result.first == "CHANGELOG" }.flatten.last filename, blob = results.find { |_, blob| blob.filename == 'CHANGELOG' }
expect(blob.filename).to eq("CHANGELOG") expect(filename).to eq('CHANGELOG')
expect(blob).to be_a(Gitlab::SearchResults::FoundBlob)
expect(blob.ref).to eq(finder.ref)
expect(blob.data).not_to be_empty
end end
end end
end end
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Blame, seed_helper: true do describe Gitlab::Git::Blame, seed_helper: true do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') }
let(:blame) do let(:blame) do
Gitlab::Git::Blame.new(repository, SeedRepo::Commit::ID, "CONTRIBUTING.md") Gitlab::Git::Blame.new(repository, SeedRepo::Commit::ID, "CONTRIBUTING.md")
end end
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Blob, seed_helper: true do describe Gitlab::Git::Blob, seed_helper: true do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') }
describe 'initialize' do describe 'initialize' do
let(:blob) { Gitlab::Git::Blob.new(name: 'test') } let(:blob) { Gitlab::Git::Blob.new(name: 'test') }
......
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Branch, seed_helper: true do describe Gitlab::Git::Branch, seed_helper: true do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') }
subject { repository.branches } subject { repository.branches }
......
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Commit, seed_helper: true do describe Gitlab::Git::Commit, seed_helper: true do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') }
let(:commit) { described_class.find(repository, SeedRepo::Commit::ID) } let(:commit) { described_class.find(repository, SeedRepo::Commit::ID) }
let(:rugged_commit) do let(:rugged_commit) do
repository.rugged.lookup(SeedRepo::Commit::ID) repository.rugged.lookup(SeedRepo::Commit::ID)
...@@ -9,7 +9,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -9,7 +9,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
describe "Commit info" do describe "Commit info" do
before do before do
repo = Gitlab::Git::Repository.new('default', TEST_REPO_PATH).rugged repo = Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '').rugged
@committer = { @committer = {
email: 'mike@smith.com', email: 'mike@smith.com',
...@@ -59,7 +59,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -59,7 +59,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
after do after do
# Erase the new commit so other tests get the original repo # Erase the new commit so other tests get the original repo
repo = Gitlab::Git::Repository.new('default', TEST_REPO_PATH).rugged repo = Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '').rugged
repo.references.update("refs/heads/master", SeedRepo::LastCommit::ID) repo.references.update("refs/heads/master", SeedRepo::LastCommit::ID)
end end
end end
...@@ -144,7 +144,7 @@ describe Gitlab::Git::Commit, seed_helper: true do ...@@ -144,7 +144,7 @@ describe Gitlab::Git::Commit, seed_helper: true do
end end
context 'with broken repo' do context 'with broken repo' do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_BROKEN_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_BROKEN_REPO_PATH, '') }
it 'returns nil' do it 'returns nil' do
expect(described_class.find(repository, SeedRepo::Commit::ID)).to be_nil expect(described_class.find(repository, SeedRepo::Commit::ID)).to be_nil
......
require 'spec_helper'
describe Gitlab::Git::Committer do
let(:name) { 'Jane Doe' }
let(:email) { 'janedoe@example.com' }
let(:gl_id) { 'user-123' }
subject { described_class.new(name, email, gl_id) }
describe '#==' do
def eq_other(name, email, gl_id)
eq(described_class.new(name, email, gl_id))
end
it { expect(subject).to eq_other(name, email, gl_id) }
it { expect(subject).not_to eq_other(nil, nil, nil) }
it { expect(subject).not_to eq_other(name + 'x', email, gl_id) }
it { expect(subject).not_to eq_other(name, email + 'x', gl_id) }
it { expect(subject).not_to eq_other(name, email, gl_id + 'x') }
end
end
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Compare, seed_helper: true do describe Gitlab::Git::Compare, seed_helper: true do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') }
let(:compare) { Gitlab::Git::Compare.new(repository, SeedRepo::BigCommit::ID, SeedRepo::Commit::ID, straight: false) } let(:compare) { Gitlab::Git::Compare.new(repository, SeedRepo::BigCommit::ID, SeedRepo::Commit::ID, straight: false) }
let(:compare_straight) { Gitlab::Git::Compare.new(repository, SeedRepo::BigCommit::ID, SeedRepo::Commit::ID, straight: true) } let(:compare_straight) { Gitlab::Git::Compare.new(repository, SeedRepo::BigCommit::ID, SeedRepo::Commit::ID, straight: true) }
......
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Diff, seed_helper: true do describe Gitlab::Git::Diff, seed_helper: true do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') }
before do before do
@raw_diff_hash = { @raw_diff_hash = {
......
...@@ -10,7 +10,8 @@ describe Gitlab::Git::Hook do ...@@ -10,7 +10,8 @@ describe Gitlab::Git::Hook do
describe "#trigger" do describe "#trigger" do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:repo_path) { project.repository.path } let(:repository) { project.repository.raw_repository }
let(:repo_path) { repository.path }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:gl_id) { Gitlab::GlId.gl_id(user) } let(:gl_id) { Gitlab::GlId.gl_id(user) }
...@@ -48,7 +49,7 @@ describe Gitlab::Git::Hook do ...@@ -48,7 +49,7 @@ describe Gitlab::Git::Hook do
it "returns success with no errors" do it "returns success with no errors" do
create_hook(hook_name) create_hook(hook_name)
hook = described_class.new(hook_name, project) hook = described_class.new(hook_name, repository)
blank = Gitlab::Git::BLANK_SHA blank = Gitlab::Git::BLANK_SHA
ref = Gitlab::Git::BRANCH_REF_PREFIX + 'new_branch' ref = Gitlab::Git::BRANCH_REF_PREFIX + 'new_branch'
...@@ -66,7 +67,7 @@ describe Gitlab::Git::Hook do ...@@ -66,7 +67,7 @@ describe Gitlab::Git::Hook do
context "when the hook is unsuccessful" do context "when the hook is unsuccessful" do
it "returns failure with errors" do it "returns failure with errors" do
create_failing_hook(hook_name) create_failing_hook(hook_name)
hook = described_class.new(hook_name, project) hook = described_class.new(hook_name, repository)
blank = Gitlab::Git::BLANK_SHA blank = Gitlab::Git::BLANK_SHA
ref = Gitlab::Git::BRANCH_REF_PREFIX + 'new_branch' ref = Gitlab::Git::BRANCH_REF_PREFIX + 'new_branch'
...@@ -80,7 +81,7 @@ describe Gitlab::Git::Hook do ...@@ -80,7 +81,7 @@ describe Gitlab::Git::Hook do
context "when the hook doesn't exist" do context "when the hook doesn't exist" do
it "returns success with no errors" do it "returns success with no errors" do
hook = described_class.new('unknown_hook', project) hook = described_class.new('unknown_hook', repository)
blank = Gitlab::Git::BLANK_SHA blank = Gitlab::Git::BLANK_SHA
ref = Gitlab::Git::BRANCH_REF_PREFIX + 'new_branch' ref = Gitlab::Git::BRANCH_REF_PREFIX + 'new_branch'
......
require 'spec_helper' require 'spec_helper'
describe GitHooksService do describe Gitlab::Git::HooksService, seed_helper: true do
include RepoHelpers let(:committer) { Gitlab::Git::Committer.new('Jane Doe', 'janedoe@example.com', 'user-456') }
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, 'project-123') }
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:service) { described_class.new } let(:service) { described_class.new }
before do before do
@blankrev = Gitlab::Git::BLANK_SHA @blankrev = Gitlab::Git::BLANK_SHA
@oldrev = sample_commit.parent_id @oldrev = SeedRepo::Commit::PARENT_ID
@newrev = sample_commit.id @newrev = SeedRepo::Commit::ID
@ref = 'refs/heads/feature' @ref = 'refs/heads/feature'
end end
...@@ -20,7 +18,7 @@ describe GitHooksService do ...@@ -20,7 +18,7 @@ describe GitHooksService do
hook = double(trigger: [true, nil]) hook = double(trigger: [true, nil])
expect(Gitlab::Git::Hook).to receive(:new).exactly(3).times.and_return(hook) expect(Gitlab::Git::Hook).to receive(:new).exactly(3).times.and_return(hook)
service.execute(user, project, @blankrev, @newrev, @ref) { } service.execute(committer, repository, @blankrev, @newrev, @ref) { }
end end
end end
...@@ -30,8 +28,8 @@ describe GitHooksService do ...@@ -30,8 +28,8 @@ describe GitHooksService do
expect(service).not_to receive(:run_hook).with('post-receive') expect(service).not_to receive(:run_hook).with('post-receive')
expect do expect do
service.execute(user, project, @blankrev, @newrev, @ref) service.execute(committer, repository, @blankrev, @newrev, @ref)
end.to raise_error(GitHooksService::PreReceiveError) end.to raise_error(Gitlab::Git::HooksService::PreReceiveError)
end end
end end
...@@ -42,8 +40,8 @@ describe GitHooksService do ...@@ -42,8 +40,8 @@ describe GitHooksService do
expect(service).not_to receive(:run_hook).with('post-receive') expect(service).not_to receive(:run_hook).with('post-receive')
expect do expect do
service.execute(user, project, @blankrev, @newrev, @ref) service.execute(committer, repository, @blankrev, @newrev, @ref)
end.to raise_error(GitHooksService::PreReceiveError) end.to raise_error(Gitlab::Git::HooksService::PreReceiveError)
end end
end end
end end
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::Index, seed_helper: true do describe Gitlab::Git::Index, seed_helper: true do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') }
let(:index) { described_class.new(repository) } let(:index) { described_class.new(repository) }
before do before do
......
...@@ -17,7 +17,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -17,7 +17,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
end end
end end
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') }
describe "Respond to" do describe "Respond to" do
subject { repository } subject { repository }
...@@ -56,14 +56,14 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -56,14 +56,14 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe "#rugged" do describe "#rugged" do
describe 'when storage is broken', broken_storage: true do describe 'when storage is broken', broken_storage: true do
it 'raises a storage exception when storage is not available' do it 'raises a storage exception when storage is not available' do
broken_repo = described_class.new('broken', 'a/path.git') broken_repo = described_class.new('broken', 'a/path.git', '')
expect { broken_repo.rugged }.to raise_error(Gitlab::Git::Storage::Inaccessible) expect { broken_repo.rugged }.to raise_error(Gitlab::Git::Storage::Inaccessible)
end end
end end
it 'raises a no repository exception when there is no repo' do it 'raises a no repository exception when there is no repo' do
broken_repo = described_class.new('default', 'a/path.git') broken_repo = described_class.new('default', 'a/path.git', '')
expect { broken_repo.rugged }.to raise_error(Gitlab::Git::Repository::NoRepository) expect { broken_repo.rugged }.to raise_error(Gitlab::Git::Repository::NoRepository)
end end
...@@ -257,7 +257,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -257,7 +257,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
end end
describe '#submodule_url_for' do describe '#submodule_url_for' do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') }
let(:ref) { 'master' } let(:ref) { 'master' }
def submodule_url(path) def submodule_url(path)
...@@ -295,7 +295,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -295,7 +295,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
end end
context '#submodules' do context '#submodules' do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') }
context 'where repo has submodules' do context 'where repo has submodules' do
let(:submodules) { repository.send(:submodules, 'master') } let(:submodules) { repository.send(:submodules, 'master') }
...@@ -391,7 +391,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -391,7 +391,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe "#delete_branch" do describe "#delete_branch" do
before(:all) do before(:all) do
@repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH) @repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '')
@repo.delete_branch("feature") @repo.delete_branch("feature")
end end
...@@ -407,7 +407,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -407,7 +407,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe "#create_branch" do describe "#create_branch" do
before(:all) do before(:all) do
@repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH) @repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '')
end end
it "should create a new branch" do it "should create a new branch" do
...@@ -445,7 +445,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -445,7 +445,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe "#remote_delete" do describe "#remote_delete" do
before(:all) do before(:all) do
@repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH) @repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '')
@repo.remote_delete("expendable") @repo.remote_delete("expendable")
end end
...@@ -461,7 +461,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -461,7 +461,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe "#remote_add" do describe "#remote_add" do
before(:all) do before(:all) do
@repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH) @repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '')
@repo.remote_add("new_remote", SeedHelper::GITLAB_GIT_TEST_REPO_URL) @repo.remote_add("new_remote", SeedHelper::GITLAB_GIT_TEST_REPO_URL)
end end
...@@ -477,7 +477,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -477,7 +477,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe "#remote_update" do describe "#remote_update" do
before(:all) do before(:all) do
@repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH) @repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '')
@repo.remote_update("expendable", url: TEST_NORMAL_REPO_PATH) @repo.remote_update("expendable", url: TEST_NORMAL_REPO_PATH)
end end
...@@ -506,7 +506,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -506,7 +506,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
before(:context) do before(:context) do
# Add new commits so that there's a renamed file in the commit history # Add new commits so that there's a renamed file in the commit history
repo = Gitlab::Git::Repository.new('default', TEST_REPO_PATH).rugged repo = Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '').rugged
@commit_with_old_name_id = new_commit_edit_old_file(repo) @commit_with_old_name_id = new_commit_edit_old_file(repo)
@rename_commit_id = new_commit_move_file(repo) @rename_commit_id = new_commit_move_file(repo)
@commit_with_new_name_id = new_commit_edit_new_file(repo) @commit_with_new_name_id = new_commit_edit_new_file(repo)
...@@ -514,7 +514,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -514,7 +514,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
after(:context) do after(:context) do
# Erase our commits so other tests get the original repo # Erase our commits so other tests get the original repo
repo = Gitlab::Git::Repository.new('default', TEST_REPO_PATH).rugged repo = Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '').rugged
repo.references.update("refs/heads/master", SeedRepo::LastCommit::ID) repo.references.update("refs/heads/master", SeedRepo::LastCommit::ID)
end end
...@@ -849,7 +849,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -849,7 +849,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe '#autocrlf' do describe '#autocrlf' do
before(:all) do before(:all) do
@repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH) @repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '')
@repo.rugged.config['core.autocrlf'] = true @repo.rugged.config['core.autocrlf'] = true
end end
...@@ -864,7 +864,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -864,7 +864,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe '#autocrlf=' do describe '#autocrlf=' do
before(:all) do before(:all) do
@repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH) @repo = Gitlab::Git::Repository.new('default', TEST_MUTABLE_REPO_PATH, '')
@repo.rugged.config['core.autocrlf'] = false @repo.rugged.config['core.autocrlf'] = false
end end
...@@ -933,7 +933,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -933,7 +933,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
context 'with local and remote branches' do context 'with local and remote branches' do
let(:repository) do let(:repository) do
Gitlab::Git::Repository.new('default', File.join(TEST_MUTABLE_REPO_PATH, '.git')) Gitlab::Git::Repository.new('default', File.join(TEST_MUTABLE_REPO_PATH, '.git'), '')
end end
before do before do
...@@ -980,7 +980,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -980,7 +980,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
context 'with local and remote branches' do context 'with local and remote branches' do
let(:repository) do let(:repository) do
Gitlab::Git::Repository.new('default', File.join(TEST_MUTABLE_REPO_PATH, '.git')) Gitlab::Git::Repository.new('default', File.join(TEST_MUTABLE_REPO_PATH, '.git'), '')
end end
before do before do
...@@ -1186,7 +1186,7 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -1186,7 +1186,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
describe '#local_branches' do describe '#local_branches' do
before(:all) do before(:all) do
@repo = Gitlab::Git::Repository.new('default', File.join(TEST_MUTABLE_REPO_PATH, '.git')) @repo = Gitlab::Git::Repository.new('default', File.join(TEST_MUTABLE_REPO_PATH, '.git'), '')
end end
after(:all) do after(:all) do
......
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Tag, seed_helper: true do describe Gitlab::Git::Tag, seed_helper: true do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') }
shared_examples 'Gitlab::Git::Repository#tags' do shared_examples 'Gitlab::Git::Repository#tags' do
describe 'first tag' do describe 'first tag' do
......
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Tree, seed_helper: true do describe Gitlab::Git::Tree, seed_helper: true do
let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH) } let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '') }
context :repo do context :repo do
let(:tree) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID) } let(:tree) { Gitlab::Git::Tree.where(repository, SeedRepo::Commit::ID) }
......
...@@ -396,7 +396,7 @@ describe Gitlab::GitAccess do ...@@ -396,7 +396,7 @@ describe Gitlab::GitAccess do
def stub_git_hooks def stub_git_hooks
# Running the `pre-receive` hook is expensive, and not necessary for this test. # Running the `pre-receive` hook is expensive, and not necessary for this test.
allow_any_instance_of(GitHooksService).to receive(:execute) do |service, &block| allow_any_instance_of(Gitlab::Git::HooksService).to receive(:execute) do |service, &block|
block.call(service) block.call(service)
end end
end end
......
...@@ -34,7 +34,7 @@ describe Gitlab::ImportExport::RepoRestorer do ...@@ -34,7 +34,7 @@ describe Gitlab::ImportExport::RepoRestorer do
it 'has the webhooks' do it 'has the webhooks' do
restorer.restore restorer.restore
expect(Gitlab::Git::Hook.new('post-receive', project)).to exist expect(Gitlab::Git::Hook.new('post-receive', project.repository.raw_repository)).to exist
end end
end end
end end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment