summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock4
-rw-r--r--app/assets/javascripts/calendar.js.coffee2
-rw-r--r--app/assets/stylesheets/framework/common.scss22
-rw-r--r--app/assets/stylesheets/framework/mixins.scss1
-rw-r--r--app/assets/stylesheets/pages/profile.scss4
-rw-r--r--app/controllers/application_controller.rb22
-rw-r--r--app/models/concerns/sortable.rb10
-rw-r--r--app/models/repository.rb12
-rw-r--r--app/services/projects/create_service.rb2
-rw-r--r--app/views/users/show.html.haml6
-rw-r--r--config/initializers/2_app.rb6
-rw-r--r--db/migrate/20151020145526_add_services_template_index.rb5
-rw-r--r--db/schema.rb1
-rw-r--r--doc/development/shell_commands.md20
-rw-r--r--lib/backup/repository.rb6
-rw-r--r--lib/gitlab/force_push_check.rb2
-rw-r--r--lib/gitlab/git_ref_validator.rb2
-rw-r--r--lib/gitlab/upgrader.rb8
-rw-r--r--lib/tasks/gitlab/check.rake2
-rw-r--r--lib/tasks/gitlab/shell.rake10
-rw-r--r--spec/benchmarks/models/user_spec.rb10
-rw-r--r--spec/benchmarks/services/projects/create_service_spec.rb28
-rw-r--r--spec/models/project_wiki_spec.rb2
-rw-r--r--spec/models/user_spec.rb12
-rw-r--r--spec/requests/api/repositories_spec.rb4
-rw-r--r--spec/support/test_env.rb8
27 files changed, 145 insertions, 68 deletions
diff --git a/Gemfile b/Gemfile
index 8379e5eea17..0bac8978160 100644
--- a/Gemfile
+++ b/Gemfile
@@ -64,7 +64,7 @@ gem 'rack-cors', '~> 0.4.0', require: 'rack/cors'
# Format dates and times
# based on human-friendly examples
-gem "stamp", '~> 0.5.0'
+gem "stamp", '~> 0.6.0'
# Enumeration fields
gem 'enumerize', '~> 0.7.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index c9ba4959ddf..dce728baf18 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -691,7 +691,7 @@ GEM
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
- stamp (0.5.0)
+ stamp (0.6.0)
state_machine (1.2.0)
stringex (2.5.2)
systemu (2.6.5)
@@ -912,7 +912,7 @@ DEPENDENCIES
spring-commands-spinach (~> 1.0.0)
spring-commands-teaspoon (~> 0.0.2)
sprockets (~> 2.12.3)
- stamp (~> 0.5.0)
+ stamp (~> 0.6.0)
state_machine (~> 1.2.0)
task_list (~> 1.0.2)
teaspoon (~> 1.0.0)
diff --git a/app/assets/javascripts/calendar.js.coffee b/app/assets/javascripts/calendar.js.coffee
index 2b1e20d3225..97621236924 100644
--- a/app/assets/javascripts/calendar.js.coffee
+++ b/app/assets/javascripts/calendar.js.coffee
@@ -25,7 +25,7 @@ class @Calendar
30
]
legendCellPadding: 3
- cellSize: $('.user-calendar').width() / 76
+ cellSize: $('.user-calendar').width() / 73
onClick: (date, count) ->
formated_date = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate()
$.ajax
diff --git a/app/assets/stylesheets/framework/common.scss b/app/assets/stylesheets/framework/common.scss
index 3d0b71e066e..41287d52f69 100644
--- a/app/assets/stylesheets/framework/common.scss
+++ b/app/assets/stylesheets/framework/common.scss
@@ -389,12 +389,32 @@ table {
.center-middle-menu {
@include nav-menu;
+ padding: 0;
text-align: center;
margin: -$gl-padding;
- height: auto;
margin-top: 0;
margin-bottom: 0;
+ height: 58px;
border-bottom: 1px solid $border-color;
+
+ li {
+ &:after {
+ content: "|";
+ color: $border-gray-light;
+ }
+
+ &:last-child {
+ &:after {
+ content: none;
+ }
+ }
+
+ > a {
+ display: inline-block;
+ text-transform: uppercase;
+ font-size: 13px;
+ }
+ }
}
.dropzone .dz-preview .dz-progress {
diff --git a/app/assets/stylesheets/framework/mixins.scss b/app/assets/stylesheets/framework/mixins.scss
index fe078d016d7..b9c179f2881 100644
--- a/app/assets/stylesheets/framework/mixins.scss
+++ b/app/assets/stylesheets/framework/mixins.scss
@@ -137,6 +137,7 @@
&:hover, &:active, &:focus {
text-decoration: none;
+ outline: none;
}
}
diff --git a/app/assets/stylesheets/pages/profile.scss b/app/assets/stylesheets/pages/profile.scss
index bc1ad21305a..1d6ca0dfc13 100644
--- a/app/assets/stylesheets/pages/profile.scss
+++ b/app/assets/stylesheets/pages/profile.scss
@@ -75,7 +75,3 @@
text-decoration: none;
}
}
-
-.cal-heatmap-container {
- margin: 0 auto;
-}
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 1b0609e279e..0d182e8eb04 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -59,13 +59,8 @@ class ApplicationController < ActionController::Base
end
def authenticate_user!(*args)
- # If user is not signed-in and tries to access root_path - redirect him to landing page
- # Don't redirect to the default URL to prevent endless redirections
- if current_application_settings.home_page_url.present? &&
- current_application_settings.home_page_url.chomp('/') != Gitlab.config.gitlab['url'].chomp('/')
- if current_user.nil? && root_path == request.path
- redirect_to current_application_settings.home_page_url and return
- end
+ if redirect_to_home_page_url?
+ redirect_to current_application_settings.home_page_url and return
end
super(*args)
@@ -346,4 +341,17 @@ class ApplicationController < ActionController::Base
def git_import_enabled?
current_application_settings.import_sources.include?('git')
end
+
+ def redirect_to_home_page_url?
+ # If user is not signed-in and tries to access root_path - redirect him to landing page
+ # Don't redirect to the default URL to prevent endless redirections
+ return false unless current_application_settings.home_page_url.present?
+
+ home_page_url = current_application_settings.home_page_url.chomp('/')
+ root_urls = [Gitlab.config.gitlab['url'].chomp('/'), root_url.chomp('/')]
+
+ return false if root_urls.include?(home_page_url)
+
+ current_user.nil? && root_path == request.path
+ end
end
diff --git a/app/models/concerns/sortable.rb b/app/models/concerns/sortable.rb
index 0ad2654867d..913c747a1c3 100644
--- a/app/models/concerns/sortable.rb
+++ b/app/models/concerns/sortable.rb
@@ -8,12 +8,12 @@ module Sortable
included do
# By default all models should be ordered
# by created_at field starting from newest
- default_scope { order(created_at: :desc, id: :desc) }
+ default_scope { order(id: :desc) }
- scope :order_created_desc, -> { reorder(created_at: :desc, id: :desc) }
- scope :order_created_asc, -> { reorder(created_at: :asc, id: :asc) }
- scope :order_updated_desc, -> { reorder(updated_at: :desc, id: :desc) }
- scope :order_updated_asc, -> { reorder(updated_at: :asc, id: :asc) }
+ scope :order_created_desc, -> { reorder(created_at: :desc) }
+ scope :order_created_asc, -> { reorder(created_at: :asc) }
+ scope :order_updated_desc, -> { reorder(updated_at: :desc) }
+ scope :order_updated_asc, -> { reorder(updated_at: :asc) }
scope :order_name_asc, -> { reorder(name: :asc) }
scope :order_name_desc, -> { reorder(name: :desc) }
end
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 9266ba27f0a..f8c4cb1387b 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -89,7 +89,7 @@ class Repository
def find_commits_by_message(query)
# Limited to 1000 commits for now, could be parameterized?
- args = %W(git log --pretty=%H --max-count 1000 --grep=#{query})
+ args = %W(#{Gitlab.config.git.bin_path} log --pretty=%H --max-count 1000 --grep=#{query})
git_log_results = Gitlab::Popen.popen(args, path_to_repo).first.lines.map(&:chomp)
commits = git_log_results.map { |c| commit(c) }
@@ -296,7 +296,7 @@ class Repository
end
def last_commit_for_path(sha, path)
- args = %W(git rev-list --max-count=1 #{sha} -- #{path})
+ args = %W(#{Gitlab.config.git.bin_path} rev-list --max-count=1 #{sha} -- #{path})
sha = Gitlab::Popen.popen(args, path_to_repo).first.strip
commit(sha)
end
@@ -347,7 +347,7 @@ class Repository
end
def branch_names_contains(sha)
- args = %W(git branch --contains #{sha})
+ args = %W(#{Gitlab.config.git.bin_path} branch --contains #{sha})
names = Gitlab::Popen.popen(args, path_to_repo).first
if names.respond_to?(:split)
@@ -364,7 +364,7 @@ class Repository
end
def tag_names_contains(sha)
- args = %W(git tag --contains #{sha})
+ args = %W(#{Gitlab.config.git.bin_path} tag --contains #{sha})
names = Gitlab::Popen.popen(args, path_to_repo).first
if names.respond_to?(:split)
@@ -505,7 +505,7 @@ class Repository
def search_files(query, ref)
offset = 2
- args = %W(git grep -i -n --before-context #{offset} --after-context #{offset} -e #{query} #{ref || root_ref})
+ args = %W(#{Gitlab.config.git.bin_path} grep -i -n --before-context #{offset} --after-context #{offset} -e #{query} #{ref || root_ref})
Gitlab::Popen.popen(args, path_to_repo).first.scrub.split(/^--$/)
end
@@ -537,7 +537,7 @@ class Repository
end
def fetch_ref(source_path, source_ref, target_ref)
- args = %W(git fetch -f #{source_path} #{source_ref}:#{target_ref})
+ args = %W(#{Gitlab.config.git.bin_path} fetch -f #{source_path} #{source_ref}:#{target_ref})
Gitlab::Popen.popen(args, path_to_repo)
end
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb
index faf1ee008e7..5b84527eccf 100644
--- a/app/services/projects/create_service.rb
+++ b/app/services/projects/create_service.rb
@@ -94,8 +94,6 @@ module Projects
@project.team << [current_user, :master, current_user]
end
- @project.update_column(:last_activity_at, @project.created_at)
-
if @project.import?
@project.import_start
end
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index e22d93aae84..5a15c6c244a 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -73,7 +73,7 @@
.user-calendar-activities
-%ul.nav.center-middle-menu
+%ul.center-middle-menu
%li.active
= link_to "#activity", 'data-toggle' => 'tab' do
Activity
@@ -106,14 +106,14 @@
.contributed-projects
= render 'shared/projects/list',
projects: @contributed_projects.sort_by(&:star_count).reverse,
- projects_limit: 5, stars: true, avatar: false
+ projects_limit: 5, stars: true, avatar: true
- if @projects.present?
.tab-pane#personal
.personal-projects
= render 'shared/projects/list',
projects: @projects.sort_by(&:star_count).reverse,
- projects_limit: 10, stars: true, avatar: false
+ projects_limit: 10, stars: true, avatar: true
:coffeescript
$(".user-calendar").load("#{user_calendar_path}")
diff --git a/config/initializers/2_app.rb b/config/initializers/2_app.rb
index 688cdf5f4b0..35b150c9929 100644
--- a/config/initializers/2_app.rb
+++ b/config/initializers/2_app.rb
@@ -1,8 +1,8 @@
module Gitlab
- VERSION = File.read(Rails.root.join("VERSION")).strip
- REVISION = Gitlab::Popen.popen(%W(git log --pretty=format:%h -n 1)).first.chomp
-
def self.config
Settings
end
+
+ VERSION = File.read(Rails.root.join("VERSION")).strip
+ REVISION = Gitlab::Popen.popen(%W(#{config.git.bin_path} log --pretty=format:%h -n 1)).first.chomp
end
diff --git a/db/migrate/20151020145526_add_services_template_index.rb b/db/migrate/20151020145526_add_services_template_index.rb
new file mode 100644
index 00000000000..1b04f313565
--- /dev/null
+++ b/db/migrate/20151020145526_add_services_template_index.rb
@@ -0,0 +1,5 @@
+class AddServicesTemplateIndex < ActiveRecord::Migration
+ def change
+ add_index :services, :template
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4bde9f0b748..73fc83c3d6b 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -667,6 +667,7 @@ ActiveRecord::Schema.define(version: 20151026182941) do
add_index "services", ["created_at", "id"], name: "index_services_on_created_at_and_id", using: :btree
add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree
+ add_index "services", ["template"], name: "index_services_on_template", using: :btree
create_table "snippets", force: true do |t|
t.string "title"
diff --git a/doc/development/shell_commands.md b/doc/development/shell_commands.md
index 2d1d0fb4154..65cdd74bdb6 100644
--- a/doc/development/shell_commands.md
+++ b/doc/development/shell_commands.md
@@ -35,6 +35,16 @@ Gitlab::Popen.popen(%W(find /some/path -not -path /some/path -mmin +120 -delete)
This coding style could have prevented CVE-2013-4490.
+## Always use the configurable git binary path for git commands
+
+```ruby
+# Wrong
+system(*%W(git branch -d -- #{branch_name}))
+
+# Correct
+system(*%W(#{Gitlab.config.git.bin_path} branch -d -- #{branch_name}))
+```
+
## Bypass the shell by splitting commands into separate tokens
When we pass shell commands as a single string to Ruby, Ruby will let `/bin/sh` evaluate the entire string. Essentially, we are asking the shell to evaluate a one-line script. This creates a risk for shell injection attacks. It is better to split the shell command into tokens ourselves. Sometimes we use the scripting capabilities of the shell to change the working directory or set environment variables. All of this can also be achieved securely straight from Ruby
@@ -81,9 +91,9 @@ In the GitLab codebase, we avoid the option/argument ambiguity by _always_ using
```ruby
# Wrong
-system(*%W(git branch -d #{branch_name}))
+system(*%W(#{Gitlab.config.git.bin_path} branch -d #{branch_name}))
# Correct
-system(*%W(git branch -d -- #{branch_name}))
+system(*%W(#{Gitlab.config.git.bin_path} branch -d -- #{branch_name}))
```
This coding style could have prevented CVE-2013-4582.
@@ -94,9 +104,9 @@ Capturing the output of shell commands with backticks reads nicely, but you are
```ruby
# Wrong
-logs = `cd #{repo_dir} && git log`
+logs = `cd #{repo_dir} && #{Gitlab.config.git.bin_path} log`
# Correct
-logs, exit_status = Gitlab::Popen.popen(%W(git log), repo_dir)
+logs, exit_status = Gitlab::Popen.popen(%W(#{Gitlab.config.git.bin_path} log), repo_dir)
# Wrong
user = `whoami`
@@ -108,7 +118,7 @@ In other repositories, such as gitlab-shell you can also use `IO.popen`.
```ruby
# Safe IO.popen example
-logs = IO.popen(%W(git log), chdir: repo_dir) { |p| p.read }
+logs = IO.popen(%W(#{Gitlab.config.git.bin_path} log), chdir: repo_dir) { |p| p.read }
```
Note that unlike `Gitlab::Popen.popen`, `IO.popen` does not capture standard error.
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb
index 4d70f7883dd..a82a7e1f7bf 100644
--- a/lib/backup/repository.rb
+++ b/lib/backup/repository.rb
@@ -35,7 +35,7 @@ module Backup
if wiki.repository.empty?
$progress.puts " [SKIPPED]".cyan
else
- cmd = %W(git --git-dir=#{path_to_repo(wiki)} bundle create #{path_to_bundle(wiki)} --all)
+ cmd = %W(#{Gitlab.config.git.bin_path} --git-dir=#{path_to_repo(wiki)} bundle create #{path_to_bundle(wiki)} --all)
output, status = Gitlab::Popen.popen(cmd)
if status.zero?
$progress.puts " [DONE]".green
@@ -67,7 +67,7 @@ module Backup
FileUtils.mkdir_p(path_to_repo(project))
cmd = %W(tar -xf #{path_to_bundle(project)} -C #{path_to_repo(project)})
else
- cmd = %W(git init --bare #{path_to_repo(project)})
+ cmd = %W(#{Gitlab.config.git.bin_path} init --bare #{path_to_repo(project)})
end
if system(*cmd, silent)
@@ -87,7 +87,7 @@ module Backup
# that was initialized with ProjectWiki.new() and then
# try to restore with 'git clone --bare'.
FileUtils.rm_rf(path_to_repo(wiki))
- cmd = %W(git clone --bare #{path_to_bundle(wiki)} #{path_to_repo(wiki)})
+ cmd = %W(#{Gitlab.config.git.bin_path} clone --bare #{path_to_bundle(wiki)} #{path_to_repo(wiki)})
if system(*cmd, silent)
$progress.puts " [DONE]".green
diff --git a/lib/gitlab/force_push_check.rb b/lib/gitlab/force_push_check.rb
index fdb6a35c78d..93c6a5bb7f5 100644
--- a/lib/gitlab/force_push_check.rb
+++ b/lib/gitlab/force_push_check.rb
@@ -7,7 +7,7 @@ module Gitlab
if Gitlab::Git.blank_ref?(oldrev) || Gitlab::Git.blank_ref?(newrev)
false
else
- missed_refs, _ = Gitlab::Popen.popen(%W(git --git-dir=#{project.repository.path_to_repo} rev-list #{oldrev} ^#{newrev}))
+ missed_refs, _ = Gitlab::Popen.popen(%W(#{Gitlab.config.git.bin_path} --git-dir=#{project.repository.path_to_repo} rev-list #{oldrev} ^#{newrev}))
missed_refs.split("\n").size > 0
end
end
diff --git a/lib/gitlab/git_ref_validator.rb b/lib/gitlab/git_ref_validator.rb
index 39d17def930..4d83d8e72a8 100644
--- a/lib/gitlab/git_ref_validator.rb
+++ b/lib/gitlab/git_ref_validator.rb
@@ -6,7 +6,7 @@ module Gitlab
# Returns true for a valid reference name, false otherwise
def validate(ref_name)
Gitlab::Utils.system_silent(
- %W(git check-ref-format refs/#{ref_name}))
+ %W(#{Gitlab.config.git.bin_path} check-ref-format refs/#{ref_name}))
end
end
end
diff --git a/lib/gitlab/upgrader.rb b/lib/gitlab/upgrader.rb
index cf040971c6e..f3567f3ef85 100644
--- a/lib/gitlab/upgrader.rb
+++ b/lib/gitlab/upgrader.rb
@@ -50,15 +50,15 @@ module Gitlab
end
def fetch_git_tags
- remote_tags, _ = Gitlab::Popen.popen(%W(git ls-remote --tags https://gitlab.com/gitlab-org/gitlab-ce.git))
+ remote_tags, _ = Gitlab::Popen.popen(%W(#{Gitlab.config.git.bin_path} ls-remote --tags https://gitlab.com/gitlab-org/gitlab-ce.git))
remote_tags.split("\n").grep(/tags\/v#{current_version.major}/)
end
def update_commands
{
- "Stash changed files" => %W(git stash),
- "Get latest code" => %W(git fetch),
- "Switch to new version" => %W(git checkout v#{latest_version}),
+ "Stash changed files" => %W(#{Gitlab.config.git.bin_path} stash),
+ "Get latest code" => %W(#{Gitlab.config.git.bin_path} fetch),
+ "Switch to new version" => %W(#{Gitlab.config.git.bin_path} checkout v#{latest_version}),
"Install gems" => %W(bundle),
"Migrate DB" => %W(bundle exec rake db:migrate),
"Recompile assets" => %W(bundle exec rake assets:clean assets:precompile),
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index 2e73f792a9d..a25fac62cfc 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -824,7 +824,7 @@ namespace :gitlab do
repo_dirs = Dir.glob(File.join(namespace_dir, '*'))
repo_dirs.each do |dir|
puts "\nChecking repo at #{dir}"
- system(*%w(git fsck), chdir: dir)
+ system(*%W(#{Gitlab.config.git.bin_path} fsck), chdir: dir)
end
end
end
diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake
index 3c0cc763d17..dd61632e557 100644
--- a/lib/tasks/gitlab/shell.rake
+++ b/lib/tasks/gitlab/shell.rake
@@ -17,7 +17,7 @@ namespace :gitlab do
# Clone if needed
unless File.directory?(target_dir)
- system(*%W(git clone -- #{args.repo} #{target_dir}))
+ system(*%W(#{Gitlab.config.git.bin_path} clone -- #{args.repo} #{target_dir}))
end
# Make sure we're on the right tag
@@ -27,7 +27,7 @@ namespace :gitlab do
reseted = reset_to_commit(args)
unless reseted
- system(*%W(git fetch origin))
+ system(*%W(#{Gitlab.config.git.bin_path} fetch origin))
reset_to_commit(args)
end
@@ -128,14 +128,14 @@ namespace :gitlab do
end
def reset_to_commit(args)
- tag, status = Gitlab::Popen.popen(%W(git describe -- #{args.tag}))
+ tag, status = Gitlab::Popen.popen(%W(#{Gitlab.config.git.bin_path} describe -- #{args.tag}))
unless status.zero?
- tag, status = Gitlab::Popen.popen(%W(git describe -- origin/#{args.tag}))
+ tag, status = Gitlab::Popen.popen(%W(#{Gitlab.config.git.bin_path} describe -- origin/#{args.tag}))
end
tag = tag.strip
- system(*%W(git reset --hard #{tag}))
+ system(*%W(#{Gitlab.config.git.bin_path} reset --hard #{tag}))
end
end
diff --git a/spec/benchmarks/models/user_spec.rb b/spec/benchmarks/models/user_spec.rb
index 4cdba66939b..1be7a8d3ed9 100644
--- a/spec/benchmarks/models/user_spec.rb
+++ b/spec/benchmarks/models/user_spec.rb
@@ -1,6 +1,16 @@
require 'spec_helper'
describe User, benchmark: true do
+ describe '.all' do
+ before do
+ 10.times { create(:user) }
+ end
+
+ benchmark_subject { User.all.to_a }
+
+ it { is_expected.to iterate_per_second(500) }
+ end
+
describe '.by_login' do
before do
%w{Alice Bob Eve}.each do |name|
diff --git a/spec/benchmarks/services/projects/create_service_spec.rb b/spec/benchmarks/services/projects/create_service_spec.rb
new file mode 100644
index 00000000000..25ed48c34fd
--- /dev/null
+++ b/spec/benchmarks/services/projects/create_service_spec.rb
@@ -0,0 +1,28 @@
+require 'spec_helper'
+
+describe Projects::CreateService, benchmark: true do
+ describe '#execute' do
+ let(:user) { create(:user, :admin) }
+
+ let(:group) do
+ group = create(:group)
+
+ create(:group_member, group: group, user: user)
+
+ group
+ end
+
+ benchmark_subject do
+ name = SecureRandom.hex
+ service = described_class.new(user,
+ name: name,
+ path: name,
+ namespace_id: group.id,
+ visibility_level: Gitlab::VisibilityLevel::PUBLIC)
+
+ service.execute
+ end
+
+ it { is_expected.to iterate_per_second(0.5) }
+ end
+end
diff --git a/spec/models/project_wiki_spec.rb b/spec/models/project_wiki_spec.rb
index 94802dcfb79..9f6cdeeaa96 100644
--- a/spec/models/project_wiki_spec.rb
+++ b/spec/models/project_wiki_spec.rb
@@ -223,7 +223,7 @@ describe ProjectWiki do
def create_temp_repo(path)
FileUtils.mkdir_p path
- system(*%W(git init --quiet --bare -- #{path}))
+ system(*%W(#{Gitlab.config.git.bin_path} init --quiet --bare -- #{path}))
end
def remove_temp_repo(path)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index c71cfb3ebe3..49e0bfdd2ec 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -663,24 +663,24 @@ describe User do
@user1 = create :user, created_at: Date.today - 1, last_sign_in_at: Date.today - 1, name: 'Omega'
end
- it "sorts users as recently_signed_in" do
+ it "sorts users by the recent sign-in time" do
expect(User.sort('recent_sign_in').first).to eq(@user)
end
- it "sorts users as late_signed_in" do
+ it "sorts users by the oldest sign-in time" do
expect(User.sort('oldest_sign_in').first).to eq(@user1)
end
- it "sorts users as recently_created" do
+ it "sorts users in descending order by their creation time" do
expect(User.sort('created_desc').first).to eq(@user)
end
- it "sorts users as late_created" do
+ it "sorts users in ascending order by their creation time" do
expect(User.sort('created_asc').first).to eq(@user1)
end
- it "sorts users by name when nil is passed" do
- expect(User.sort(nil).first).to eq(@user)
+ it "sorts users by id in descending order when nil is passed" do
+ expect(User.sort(nil).first).to eq(@user1)
end
end
diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb
index 1149f7e7989..faf6b77a462 100644
--- a/spec/requests/api/repositories_spec.rb
+++ b/spec/requests/api/repositories_spec.rb
@@ -36,8 +36,8 @@ describe API::API, api: true do
it 'should create a new annotated tag' do
# Identity must be set in .gitconfig to create annotated tag.
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}))
+ system(*%W(#{Gitlab.config.git.bin_path} --git-dir=#{repo_path} config user.name #{user.name}))
+ system(*%W(#{Gitlab.config.git.bin_path} --git-dir=#{repo_path} config user.email #{user.email}))
post api("/projects/#{project.id}/repository/tags", user),
tag_name: 'v7.1.0',
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index d12ba25b71b..787670e9297 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -96,15 +96,15 @@ module TestEnv
clone_url = "https://gitlab.com/gitlab-org/#{repo_name}.git"
unless File.directory?(repo_path)
- system(*%W(git clone -q #{clone_url} #{repo_path}))
+ system(*%W(#{Gitlab.config.git.bin_path} clone -q #{clone_url} #{repo_path}))
end
Dir.chdir(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})
+ reset = %W(#{Gitlab.config.git.bin_path} update-ref refs/heads/#{branch} #{sha})
unless system(*reset)
- if system(*%w(git fetch origin))
+ if system(*%W(#{Gitlab.config.git.bin_path} fetch origin))
unless system(*reset)
raise 'The fetched test seed '\
'does not contain the required revision.'
@@ -117,7 +117,7 @@ module TestEnv
end
# We must copy bare repositories because we will push to them.
- system(git_env, *%W(git clone -q --bare #{repo_path} #{repo_path_bare}))
+ system(git_env, *%W(#{Gitlab.config.git.bin_path} clone -q --bare #{repo_path} #{repo_path_bare}))
end
def copy_repo(project)