Commit e21deaee authored by Kamil Trzcinski's avatar Kamil Trzcinski

Merge remote-tracking branch 'origin/master' into ci-and-ce-sitting-in-a-tree-k-i-s-s-i-n-g

# Conflicts:
#	Gemfile.lock
parents 7e2dbcbe 0ad669bb
...@@ -3,10 +3,12 @@ Please view this file on the master branch, on stable branches it's out of date. ...@@ -3,10 +3,12 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.0.0 (unreleased) v 8.0.0 (unreleased)
- Bump rouge to 1.10.1 to remove warning noise and fix other syntax highlighting bugs (Stan Hu) - Bump rouge to 1.10.1 to remove warning noise and fix other syntax highlighting bugs (Stan Hu)
- Gracefully handle errors in syntax highlighting by leaving the block unformatted (Stan Hu) - Gracefully handle errors in syntax highlighting by leaving the block unformatted (Stan Hu)
- Add "replace" and "upload" functionalities to allow user replace existing file and upload new file into current repository
- Fix URL construction for merge requests, issues, notes, and commits for relative URL config (Stan Hu) - Fix URL construction for merge requests, issues, notes, and commits for relative URL config (Stan Hu)
- Fix emoji URLs in Markdown when relative_url_root is used (Stan Hu) - Fix emoji URLs in Markdown when relative_url_root is used (Stan Hu)
- Omit filename in Content-Disposition header in raw file download to avoid RFC 6266 encoding issues (Stan HU) - Omit filename in Content-Disposition header in raw file download to avoid RFC 6266 encoding issues (Stan HU)
- Fix broken Wiki Page History (Stan Hu) - Fix broken Wiki Page History (Stan Hu)
- Import forked repositories asynchronously to prevent large repositories from timing out (Stan Hu)
- Prevent anchors from being hidden by header (Stan Hu) - Prevent anchors from being hidden by header (Stan Hu)
- Fix bug where only the first 15 Bitbucket issues would be imported (Stan Hu) - Fix bug where only the first 15 Bitbucket issues would be imported (Stan Hu)
- Sort issues by creation date in Bitbucket importer (Stan Hu) - Sort issues by creation date in Bitbucket importer (Stan Hu)
...@@ -31,7 +33,7 @@ v 8.0.0 (unreleased) ...@@ -31,7 +33,7 @@ v 8.0.0 (unreleased)
- Fix 500 error when submit project snippet without body - Fix 500 error when submit project snippet without body
- Improve search page usability - Improve search page usability
- Bring more UI consistency in way how projects, snippets and groups lists are rendered - Bring more UI consistency in way how projects, snippets and groups lists are rendered
- Make all profiles public - Make all profiles and group public
- Fixed login failure when extern_uid changes (Joel Koglin) - Fixed login failure when extern_uid changes (Joel Koglin)
- Don't notify users without access to the project when they are (accidentally) mentioned in a note. - Don't notify users without access to the project when they are (accidentally) mentioned in a note.
- Retrieving oauth token with LDAP credentials - Retrieving oauth token with LDAP credentials
......
...@@ -167,7 +167,7 @@ gem "slack-notifier", "~> 1.0.0" ...@@ -167,7 +167,7 @@ gem "slack-notifier", "~> 1.0.0"
gem 'asana', '~> 0.0.6' gem 'asana', '~> 0.0.6'
# FogBugz integration # FogBugz integration
gem 'ruby-fogbugz' gem 'ruby-fogbugz', '~> 0.2.0'
# d3 # d3
gem 'd3_rails', '~> 3.5.5' gem 'd3_rails', '~> 3.5.5'
......
...@@ -274,8 +274,7 @@ GEM ...@@ -274,8 +274,7 @@ GEM
charlock_holmes (~> 0.6.6) charlock_holmes (~> 0.6.6)
escape_utils (~> 0.2.4) escape_utils (~> 0.2.4)
mime-types (~> 1.19) mime-types (~> 1.19)
gitlab_ci_meta (4.0) gitlab_emoji (0.1.1)
gitlab_emoji (0.1.0)
gemojione (~> 2.0) gemojione (~> 2.0)
gitlab_git (7.2.15) gitlab_git (7.2.15)
activesupport (~> 4.0) activesupport (~> 4.0)
...@@ -597,8 +596,8 @@ GEM ...@@ -597,8 +596,8 @@ GEM
powerpack (~> 0.0.6) powerpack (~> 0.0.6)
rainbow (>= 1.99.1, < 3.0) rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4) ruby-progressbar (~> 1.4)
ruby-fogbugz (0.1.1) ruby-fogbugz (0.2.0)
crack crack (~> 0.4)
ruby-progressbar (1.7.5) ruby-progressbar (1.7.5)
ruby-saml (1.0.0) ruby-saml (1.0.0)
nokogiri (>= 1.5.10) nokogiri (>= 1.5.10)
...@@ -888,8 +887,8 @@ DEPENDENCIES ...@@ -888,8 +887,8 @@ DEPENDENCIES
rerun (~> 0.10.0) rerun (~> 0.10.0)
rqrcode-rails3 (~> 0.1.7) rqrcode-rails3 (~> 0.1.7)
rspec-rails (~> 3.3.0) rspec-rails (~> 3.3.0)
rubocop (~> 0.28.0) rubocop (= 0.28.0)
ruby-fogbugz ruby-fogbugz (~> 0.2.0)
sanitize (~> 2.0) sanitize (~> 2.0)
sass-rails (~> 4.0.5) sass-rails (~> 4.0.5)
sdoc (~> 0.3.20) sdoc (~> 0.3.20)
...@@ -930,6 +929,3 @@ DEPENDENCIES ...@@ -930,6 +929,3 @@ DEPENDENCIES
webmock (~> 1.21.0) webmock (~> 1.21.0)
whenever (~> 0.8.4) whenever (~> 0.8.4)
wikicloth (= 0.8.1) wikicloth (= 0.8.1)
BUNDLED WITH
1.10.6
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
[![build status](https://ci.gitlab.com/projects/1/status.png?ref=master)](https://ci.gitlab.com/projects/1?ref=master) [![build status](https://ci.gitlab.com/projects/1/status.png?ref=master)](https://ci.gitlab.com/projects/1?ref=master)
[![Build Status](https://semaphoreci.com/api/v1/projects/2f1a5809-418b-4cc2-a1f4-819607579fe7/400484/shields_badge.svg)](https://semaphoreci.com/gitlabhq/gitlabhq) [![Build Status](https://semaphoreci.com/api/v1/projects/2f1a5809-418b-4cc2-a1f4-819607579fe7/400484/shields_badge.svg)](https://semaphoreci.com/gitlabhq/gitlabhq)
[![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.svg)](https://codeclimate.com/github/gitlabhq/gitlabhq) [![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.svg)](https://codeclimate.com/github/gitlabhq/gitlabhq)
[![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq?branch=master) [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.svg?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq?branch=master)
## Canonical source ## Canonical source
......
class @BlobFileDropzone
constructor: (form, method) ->
form_dropzone = form.find('.dropzone')
Dropzone.autoDiscover = false
dropzone = form_dropzone.dropzone(
autoDiscover: false
autoProcessQueue: false
url: form.attr('action')
# Rails uses a hidden input field for PUT
# http://stackoverflow.com/questions/21056482/how-to-set-method-put-in-form-tag-in-rails
method: method
clickable: true
uploadMultiple: false
paramName: "file"
maxFilesize: gon.max_file_size or 10
parallelUploads: 1
maxFiles: 1
addRemoveLinks: true
previewsContainer: '.dropzone-previews'
headers:
"X-CSRF-Token": $("meta[name=\"csrf-token\"]").attr("content")
success: (header, response) ->
window.location.href = response.filePath
return
error: (temp, errorMessage) ->
stripped = $("<div/>").html(errorMessage).text();
$('.dropzone-alerts').html('Error uploading file: \"' + stripped + '\"').show()
return
maxfilesexceeded: (file) ->
@removeFile file
return
removedfile: (file) ->
$('.dropzone-previews')[0].removeChild(file.previewTemplate)
$('.dropzone-alerts').html('').hide()
return true
sending: (file, xhr, formData) ->
formData.append('commit_message', form.find('#commit_message').val())
return
)
submitButton = form.find('#submit-all')[0]
submitButton.addEventListener 'click', (e) ->
e.preventDefault()
e.stopPropagation()
alert "Please select a file" if dropzone[0].dropzone.getQueuedFiles().length == 0
dropzone[0].dropzone.processQueue()
return false
...@@ -36,6 +36,11 @@ ...@@ -36,6 +36,11 @@
margin-bottom: 0; margin-bottom: 0;
} }
&.clear-block {
margin-bottom: $gl-padding - 1px;
padding-bottom: $gl-padding;
}
&.second-block { &.second-block {
margin-top: -1px; margin-top: -1px;
margin-bottom: 0; margin-bottom: 0;
...@@ -51,6 +56,6 @@ ...@@ -51,6 +56,6 @@
} }
.oneline { .oneline {
line-height: 44px; line-height: 42px;
} }
} }
...@@ -377,4 +377,8 @@ table { ...@@ -377,4 +377,8 @@ table {
height: 56px; height: 56px;
margin-top: -$gl-padding; margin-top: -$gl-padding;
padding-top: $gl-padding; padding-top: $gl-padding;
&.no-bottom {
margin-bottom: 0;
}
} }
...@@ -152,7 +152,6 @@ ...@@ -152,7 +152,6 @@
} }
.collapse-nav a { .collapse-nav a {
left: 0px;
width: $sidebar_collapsed_width; width: $sidebar_collapsed_width;
} }
...@@ -171,6 +170,7 @@ ...@@ -171,6 +170,7 @@
width: $sidebar_width; width: $sidebar_width;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
left: 0;
font-size: 13px; font-size: 13px;
background: transparent; background: transparent;
height: 40px; height: 40px;
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
width: 100%; width: 100%;
} }
.ace_gutter-cell {
background-color: $background-color;
}
.cancel-btn { .cancel-btn {
color: #B94A48; color: #B94A48;
&:hover { &:hover {
...@@ -32,14 +36,12 @@ ...@@ -32,14 +36,12 @@
.file-title { .file-title {
@extend .monospace; @extend .monospace;
font-size: 14px;
padding: 5px;
} }
.editor-ref { .editor-ref {
background: $background-color; background: $background-color;
padding: 11px 15px; padding: 11px 15px;
border-right: 1px solid #CCC; border-right: 1px solid $border-color;
display: inline-block; display: inline-block;
margin: -5px -5px; margin: -5px -5px;
margin-right: 10px; margin-right: 10px;
...@@ -50,5 +52,15 @@ ...@@ -50,5 +52,15 @@
display: inline-block; display: inline-block;
width: 200px; width: 200px;
} }
.form-control {
margin-top: -3px;
}
}
.form-actions {
margin: -$gl-padding;
margin-top: 0;
padding: $gl-padding
} }
} }
...@@ -235,8 +235,6 @@ ul.notes { ...@@ -235,8 +235,6 @@ ul.notes {
filter: alpha(opacity=0); filter: alpha(opacity=0);
&:hover { &:hover {
width: 38px;
font-size: 20px;
background: $gl-info; background: $gl-info;
color: #FFF; color: #FFF;
@include show-add-diff-note; @include show-add-diff-note;
......
...@@ -116,3 +116,15 @@ ...@@ -116,3 +116,15 @@
} }
#modal-remove-blob > .modal-dialog { width: 850px; } #modal-remove-blob > .modal-dialog { width: 850px; }
.blob-upload-dropzone-previews {
text-align: center;
border: 2px;
border-style: dashed;
min-height: 200px;
}
.upload-link {
font-weight: normal;
color: #0000EE;
}
class Dashboard::ProjectsController < Dashboard::ApplicationController class Dashboard::ProjectsController < Dashboard::ApplicationController
before_action :event_filter before_action :event_filter
def index
@projects = current_user.authorized_projects.sorted_by_activity.non_archived
@projects = @projects.includes(:namespace)
@last_push = current_user.recent_push
respond_to do |format|
format.html
format.atom do
event_filter
load_events
render layout: false
end
end
end
def starred def starred
@projects = current_user.starred_projects @projects = current_user.starred_projects
@projects = @projects.includes(:namespace, :forked_from_project, :tags) @projects = @projects.includes(:namespace, :forked_from_project, :tags)
......
class Dashboard::SnippetsController < Dashboard::ApplicationController
def index
@snippets = SnippetsFinder.new.execute(current_user,
filter: :by_user,
user: current_user,
scope: params[:scope]
)
@snippets = @snippets.page(params[:page]).per(PER_PAGE)
end
end
class DashboardController < Dashboard::ApplicationController class DashboardController < Dashboard::ApplicationController
before_action :load_projects, except: :activity
before_action :event_filter, only: :activity before_action :event_filter, only: :activity
respond_to :html respond_to :html
def show
@projects = @projects.includes(:namespace)
@last_push = current_user.recent_push
respond_to do |format|
format.html
format.atom do
event_filter
load_events
render layout: false
end
end
end
def merge_requests def merge_requests
@merge_requests = get_merge_requests_collection @merge_requests = get_merge_requests_collection
@merge_requests = @merge_requests.page(params[:page]).per(PER_PAGE) @merge_requests = @merge_requests.page(params[:page]).per(PER_PAGE)
...@@ -50,10 +35,6 @@ class DashboardController < Dashboard::ApplicationController ...@@ -50,10 +35,6 @@ class DashboardController < Dashboard::ApplicationController
protected protected
def load_projects
@projects = current_user.authorized_projects.sorted_by_activity.non_archived
end
def load_events def load_events
project_ids = project_ids =
if params[:filter] == "starred" if params[:filter] == "starred"
......
class Explore::ApplicationController < ApplicationController class Explore::ApplicationController < ApplicationController
skip_before_action :authenticate_user!, :reject_blocked
layout 'explore' layout 'explore'
end end
class Explore::GroupsController < Explore::ApplicationController class Explore::GroupsController < Explore::ApplicationController
skip_before_action :authenticate_user!,
:reject_blocked, :set_current_user_for_observers
def index def index
@groups = GroupsFinder.new.execute(current_user) @groups = GroupsFinder.new.execute(current_user)
@groups = @groups.search(params[:search]) if params[:search].present? @groups = @groups.search(params[:search]) if params[:search].present?
......
class Explore::ProjectsController < Explore::ApplicationController class Explore::ProjectsController < Explore::ApplicationController
skip_before_action :authenticate_user!,
:reject_blocked
def index def index
@projects = ProjectsFinder.new.execute(current_user) @projects = ProjectsFinder.new.execute(current_user)
@tags = @projects.tags_on(:tags) @tags = @projects.tags_on(:tags)
......
class Explore::SnippetsController < Explore::ApplicationController
def index
@snippets = SnippetsFinder.new.execute(current_user, filter: :all)
@snippets = @snippets.page(params[:page]).per(PER_PAGE)
end
end
...@@ -4,7 +4,7 @@ class GroupsController < Groups::ApplicationController ...@@ -4,7 +4,7 @@ class GroupsController < Groups::ApplicationController
before_action :group, except: [:new, :create] before_action :group, except: [:new, :create]
# Authorize # Authorize
before_action :authorize_read_group!, except: [:new, :create] before_action :authorize_read_group!, except: [:show, :new, :create]
before_action :authorize_admin_group!, only: [:edit, :update, :destroy, :projects] before_action :authorize_admin_group!, only: [:edit, :update, :destroy, :projects]
before_action :authorize_create_group!, only: [:new, :create] before_action :authorize_create_group!, only: [:new, :create]
...@@ -14,6 +14,10 @@ class GroupsController < Groups::ApplicationController ...@@ -14,6 +14,10 @@ class GroupsController < Groups::ApplicationController
layout :determine_layout layout :determine_layout
def index
redirect_to(current_user ? dashboard_groups_path : explore_groups_path)
end
def new def new
@group = Group.new @group = Group.new
end end
......
class HelpController < ApplicationController class HelpController < ApplicationController
skip_before_action :authenticate_user!, :reject_blocked
layout 'help' layout 'help'
def index def index
......
...@@ -2,7 +2,6 @@ class Import::FogbugzController < Import::BaseController ...@@ -2,7 +2,6 @@ class Import::FogbugzController < Import::BaseController
before_action :verify_fogbugz_import_enabled before_action :verify_fogbugz_import_enabled
before_action :user_map, only: [:new_user_map, :create_user_map] before_action :user_map, only: [:new_user_map, :create_user_map]
# Doesn't work yet due to bug in ruby-fogbugz, see below
rescue_from Fogbugz::AuthenticationException, with: :fogbugz_unauthorized rescue_from Fogbugz::AuthenticationException, with: :fogbugz_unauthorized
def new def new
...@@ -13,8 +12,8 @@ class Import::FogbugzController < Import::BaseController ...@@ -13,8 +12,8 @@ class Import::FogbugzController < Import::BaseController
begin begin
res = Gitlab::FogbugzImport::Client.new(import_params.symbolize_keys) res = Gitlab::FogbugzImport::Client.new(import_params.symbolize_keys)
rescue rescue
# Needed until https://github.com/firmafon/ruby-fogbugz/pull/9 is merged # If the URI is invalid various errors can occur
return redirect_to :back, alert: 'Could not authenticate with FogBugz, check your URL, email, and password' return redirect_to new_import_fogbugz_path, alert: 'Could not connect to FogBugz, check your URL'
end end
session[:fogbugz_token] = res.get_token session[:fogbugz_token] = res.get_token
session[:fogbugz_uri] = params[:uri] session[:fogbugz_uri] = params[:uri]
...@@ -92,8 +91,7 @@ class Import::FogbugzController < Import::BaseController ...@@ -92,8 +91,7 @@ class Import::FogbugzController < Import::BaseController
end end
def fogbugz_unauthorized(exception) def fogbugz_unauthorized(exception)
flash[:alert] = exception.message redirect_to new_import_fogbugz_path, alert: exception.message
redirect_to new_import_fogbugz_path
end end
def import_params def import_params
......
...@@ -24,7 +24,7 @@ class InvitesController < ApplicationController ...@@ -24,7 +24,7 @@ class InvitesController < ApplicationController
path = path =
if current_user if current_user
dashboard_path dashboard_projects_path
else else
new_user_session_path new_user_session_path
end end
...@@ -73,7 +73,7 @@ class InvitesController < ApplicationController ...@@ -73,7 +73,7 @@ class InvitesController < ApplicationController
path = group_path(group) path = group_path(group)
else else
label = "who knows what" label = "who knows what"
path = dashboard_path path = dashboard_projects_path
end end
[label, path] [label, path]
......
...@@ -14,7 +14,7 @@ class NamespacesController < ApplicationController ...@@ -14,7 +14,7 @@ class NamespacesController < ApplicationController
if user if user
redirect_to user_path(user) redirect_to user_path(user)
elsif group && can?(current_user, :read_group, group) elsif group
redirect_to group_path(group) redirect_to group_path(group)
elsif current_user.nil? elsif current_user.nil?
authenticate_user! authenticate_user!
......
...@@ -26,10 +26,16 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -26,10 +26,16 @@ class Projects::BlobController < Projects::ApplicationController
if result[:status] == :success if result[:status] == :success
flash[:notice] = "Your changes have been successfully committed" flash[:notice] = "Your changes have been successfully committed"
redirect_to namespace_project_blob_path(@project.namespace, @project, File.join(@target_branch, @file_path)) respond_to do |format|
format.html { redirect_to namespace_project_blob_path(@project.namespace, @project, File.join(@target_branch, @file_path)) }
format.json { render json: { message: "success", filePath: namespace_project_blob_path(@project.namespace, @project, File.join(@target_branch, @file_path)) } }
end
else else
flash[:alert] = result[:message] flash[:alert] = result[:message]
render :new respond_to do |format|
format.html { render :new }
format.json { render json: { message: "failed", filePath: namespace_project_new_blob_path(@project.namespace, @project, @id) } }
end
end end
end end
...@@ -45,10 +51,16 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -45,10 +51,16 @@ class Projects::BlobController < Projects::ApplicationController
if result[:status] == :success if result[:status] == :success
flash[:notice] = "Your changes have been successfully committed" flash[:notice] = "Your changes have been successfully committed"
redirect_to after_edit_path respond_to do |format|
format.html { redirect_to after_edit_path }
format.json { render json: { message: "success", filePath: after_edit_path } }
end
else else
flash[:alert] = result[:message] flash[:alert] = result[:message]
render :edit respond_to do |format|
format.html { render :edit }
format.json { render json: { message: "failed", filePath: namespace_project_new_blob_path(@project.namespace, @project, @id) } }
end
end end
end end
...@@ -146,11 +158,19 @@ class Projects::BlobController < Projects::ApplicationController ...@@ -146,11 +158,19 @@ class Projects::BlobController < Projects::ApplicationController
@file_path = @file_path =
if action_name.to_s == 'create' if action_name.to_s == 'create'
if params[:file].present?
params[:file_name] = params[:file].original_filename
end
File.join(@path, File.basename(params[:file_name])) File.join(@path, File.basename(params[:file_name]))
else else
@path @path
end end
if params[:file].present?
params[:content] = Base64.encode64(params[:file].read)
params[:encoding] = 'base64'
end
@commit_params = { @commit_params = {
file_path: @file_path, file_path: @file_path,
current_branch: @current_branch, current_branch: @current_branch,
......
...@@ -13,10 +13,14 @@ class Projects::ForksController < Projects::ApplicationController ...@@ -13,10 +13,14 @@ class Projects::ForksController < Projects::ApplicationController
@forked_project = ::Projects::ForkService.new(project, current_user, namespace: namespace).execute @forked_project = ::Projects::ForkService.new(project, current_user, namespace: namespace).execute
if @forked_project.saved? && @forked_project.forked? if @forked_project.saved? && @forked_project.forked?
if @forked_project.import_in_progress?
redirect_to namespace_project_import_path(@forked_project.namespace, @forked_project)
else
redirect_to( redirect_to(
namespace_project_path(@forked_project.namespace, @forked_project), namespace_project_path(@forked_project.namespace, @forked_project),
notice: 'Project was successfully forked.' notice: 'Project was successfully forked.'
) )
end
else else
render :error render :error
end end
......
...@@ -78,7 +78,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController ...@@ -78,7 +78,7 @@ class Projects::ProjectMembersController < Projects::ApplicationController
@project.project_members.find_by(user_id: current_user).destroy @project.project_members.find_by(user_id: current_user).destroy
respond_to do |format| respond_to do |format|
format.html { redirect_to dashboard_path } format.html { redirect_to dashboard_projects_path }
format.js { render nothing: true } format.js { render nothing: true }
end end
end end
......
...@@ -10,6 +10,10 @@ class ProjectsController < ApplicationController ...@@ -10,6 +10,10 @@ class ProjectsController < ApplicationController
layout :determine_layout layout :determine_layout
def index
redirect_to(current_user ? root_path : explore_root_path)
end
def new def new
@project = Project.new @project = Project.new
end end
...@@ -105,7 +109,7 @@ class ProjectsController < ApplicationController ...@@ -105,7 +109,7 @@ class ProjectsController < ApplicationController
if request.referer.include?('/admin') if request.referer.include?('/admin')
redirect_to admin_namespaces_projects_path redirect_to admin_namespaces_projects_path
else else
redirect_to dashboard_path redirect_to dashboard_projects_path
end end
rescue Projects::DestroyService::DestroyError => ex rescue Projects::DestroyService::DestroyError => ex
redirect_to edit_project_path(@project), alert: ex.message redirect_to edit_project_path(@project), alert: ex.message
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
# #
# For users who haven't customized the setting, we simply delegate to # For users who haven't customized the setting, we simply delegate to
# `DashboardController#show`, which is the default. # `DashboardController#show`, which is the default.
class RootController < DashboardController class RootController < Dashboard::ProjectsController
before_action :redirect_to_custom_dashboard, only: [:show] before_action :redirect_to_custom_dashboard, only: [:index]
def show def index
super super
end end
...@@ -20,6 +20,7 @@ class RootController < DashboardController ...@@ -20,6 +20,7 @@ class RootController < DashboardController
case current_user.dashboard case current_user.dashboard
when 'stars' when 'stars'
flash.keep
redirect_to starred_dashboard_projects_path redirect_to starred_dashboard_projects_path
else else
return return
......
...@@ -24,13 +24,9 @@ class SnippetsController < ApplicationController ...@@ -24,13 +24,9 @@ class SnippetsController < ApplicationController
scope: params[:scope] }). scope: params[:scope] }).
page(params[:page]).per(PER_PAGE) page(params[:page]).per(PER_PAGE)
if @user == current_user render 'index'
render 'current_user_index'
else else
render 'user_index' redirect_to(current_user ? dashboard_snippets_path : explore_snippets_path)
end
else
@snippets = SnippetsFinder.new.execute(current_user, filter: :all).page(params[:page]).per(PER_PAGE)
end end
end end
......
...@@ -201,7 +201,7 @@ module ApplicationHelper ...@@ -201,7 +201,7 @@ module ApplicationHelper
class: "#{html_class} js-timeago", class: "#{html_class} js-timeago",
datetime: time.getutc.iso8601, datetime: time.getutc.iso8601,
title: time.in_time_zone.stamp('Aug 21, 2011 9:23pm'), title: time.in_time_zone.stamp('Aug 21, 2011 9:23pm'),
data: { toggle: 'tooltip', placement: placement } data: { toggle: 'tooltip', placement: placement, container: 'body' }
element += javascript_tag "$('.js-timeago').timeago()" unless skip_js element += javascript_tag "$('.js-timeago').timeago()" unless skip_js
......
...@@ -17,6 +17,14 @@ module GitlabRoutingHelper ...@@ -17,6 +17,14 @@ module GitlabRoutingHelper
namespace_project_path(project.namespace, project, *args) namespace_project_path(project.namespace, project, *args)
end end
def project_files_path(project, *args)
namespace_project_tree_path(project.namespace, project, @ref || project.repository.root_ref)
end
def project_commits_path(project, *args)
namespace_project_commits_path(project.namespace, project, @ref || project.repository.root_ref)
end
def activity_project_path(project, *args) def activity_project_path(project, *args)
activity_namespace_project_path(project.namespace, project, *args) activity_namespace_project_path(project.namespace, project, *args)
end end
......
...@@ -43,24 +43,22 @@ module ProjectsHelper ...@@ -43,24 +43,22 @@ module ProjectsHelper
end end
end end
def project_title(project) def project_title(project, name = nil, url = nil)
namespace_link =
if project.group if project.group
content_tag :span do link_to(simple_sanitize(project.group.name), group_path(project.group))
link_to(
simple_sanitize(project.group.name), group_path(project.group)
) + ' / ' +
link_to(simple_sanitize(project.name),
project_path(project))
end
else else
owner = project.namespace.owner owner = project.namespace.owner
content_tag :span do link_to(simple_sanitize(owner.name), user_path(owner))
link_to(
simple_sanitize(owner.name), user_path(owner)
) + ' / ' +
link_to(simple_sanitize(project.name),
project_path(project))
end end
project_link = link_to(simple_sanitize(project.name), project_path(project))
full_title = namespace_link + ' / ' + project_link
full_title += ' &middot; '.html_safe + link_to(simple_sanitize(name), url) if name
content_tag :span do
full_title
end end
end end
...@@ -315,6 +313,45 @@ module ProjectsHelper ...@@ -315,6 +313,45 @@ module ProjectsHelper
end end
end end
def current_ref
@ref || @repository.try(:root_ref)
end
def detect_project_title(project)
name, url =
if current_controller? 'wikis'
['Wiki', get_project_wiki_path(project)]
elsif current_controller? 'project_members'
['Members', namespace_project_project_members_path(project.namespace, project)]
elsif current_controller? 'labels'
['Labels', namespace_project_labels_path(project.namespace, project)]
elsif current_controller? 'members'
['Members', project_files_path(project)]
elsif current_controller? 'commits'
['Commits', project_commits_path(project)]
elsif current_controller? 'graphs'
['Graphs', namespace_project_graph_path(project.namespace, project, current_ref)]
elsif current_controller? 'network'
['Network', namespace_project_network_path(project.namespace, project, current_ref)]
elsif current_controller? 'milestones'
['Milestones', namespace_project_milestones_path(project.namespace, project)]
elsif current_controller? 'snippets'
['Snippets', namespace_project_snippets_path(project.namespace, project)]
elsif current_controller? 'issues'
['Issues', namespace_project_issues_path(project.namespace, project)]
elsif current_controller? 'merge_requests'
['Merge Requests', namespace_project_merge_requests_path(project.namespace, project)]
elsif current_controller? 'tree', 'blob'
['Files', project_files_path(project)]
elsif current_path? 'projects#activity'
['Activity', activity_project_path(project)]
else
[nil, nil]
end
project_title(project, name, url)
end
private private
def filename_path(project, filename) def filename_path(project, filename)
......
...@@ -144,7 +144,7 @@ class Project < ActiveRecord::Base ...@@ -144,7 +144,7 @@ class Project < ActiveRecord::Base
validates_uniqueness_of :path, scope: :namespace_id validates_uniqueness_of :path, scope: :namespace_id
validates :import_url, validates :import_url,
format: { with: /\A#{URI.regexp(%w(ssh git http https))}\z/, message: 'should be a valid url' }, format: { with: /\A#{URI.regexp(%w(ssh git http https))}\z/, message: 'should be a valid url' },
if: :import? if: :external_import?
validates :star_count, numericality: { greater_than_or_equal_to: 0 } validates :star_count, numericality: { greater_than_or_equal_to: 0 }
validate :check_limit, on: :create validate :check_limit, on: :create
validate :avatar_type, validate :avatar_type,
...@@ -275,14 +275,24 @@ class Project < ActiveRecord::Base ...@@ -275,14 +275,24 @@ class Project < ActiveRecord::Base
end end
def add_import_job def add_import_job
if forked?
unless RepositoryForkWorker.perform_async(id, forked_from_project.path_with_namespace, self.namespace.path)
import_fail
end
else
RepositoryImportWorker.perform_in(2.seconds, id) RepositoryImportWorker.perform_in(2.seconds, id)
end end
end
def clear_import_data def clear_import_data
self.import_data.destroy if self.import_data self.import_data.destroy if self.import_data
end end
def import? def import?
external_import? || forked?
end
def external_import?
import_url.present? import_url.present?
end end
...@@ -702,14 +712,8 @@ class Project < ActiveRecord::Base ...@@ -702,14 +712,8 @@ class Project < ActiveRecord::Base
end end
def create_repository def create_repository
if forked? # Forked import is handled asynchronously
if gitlab_shell.fork_repository(forked_from_project.path_with_namespace, self.namespace.path) unless forked?
true
else
errors.add(:base, 'Failed to fork repository via gitlab-shell')
false
end
else
if gitlab_shell.add_repository(path_with_namespace) if gitlab_shell.add_repository(path_with_namespace)
true true
else else
......
...@@ -34,6 +34,12 @@ class SlackService < Service ...@@ -34,6 +34,12 @@ class SlackService < Service
'slack' 'slack'
end end
def help
'This service sends notifications to your Slack channel.<br/>
To setup this Service you need to create a new <b>"Incoming webhook"</b> in your Slack integration panel,
and enter the Webhook URL below.'
end
def fields def fields
[ [
{ type: 'text', name: 'webhook', { type: 'text', name: 'webhook',
......
...@@ -19,10 +19,12 @@ module Files ...@@ -19,10 +19,12 @@ module Files
end end
unless project.empty_repo? unless project.empty_repo?
@file_path.slice!(0) if @file_path.start_with?('/')
blob = repository.blob_at_branch(@current_branch, @file_path) blob = repository.blob_at_branch(@current_branch, @file_path)
if blob if blob
raise_error("Your changes could not be committed, because file with such name exists") raise_error("Your changes could not be committed because a file with the same name already exists")
end end
end end
end end
......
...@@ -55,9 +55,7 @@ module Projects ...@@ -55,9 +55,7 @@ module Projects
@project.save @project.save
if @project.persisted? && !@project.import? if @project.persisted? && !@project.import?
unless @project.create_repository raise 'Failed to create repository' unless @project.create_repository
raise 'Failed to create repository'
end
end end
end end
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
- if current_user - if current_user
%ul.nav.nav-pills.event_filter.pull-right %ul.nav.nav-pills.event_filter.pull-right
%li.pull-right %li.pull-right
= link_to dashboard_path(:atom, { private_token: current_user.private_token }), class: 'rss-btn' do = link_to dashboard_projects_path(:atom, { private_token: current_user.private_token }), class: 'rss-btn' do
%i.fa.fa-rss %i.fa.fa-rss
= render 'shared/event_filter' = render 'shared/event_filter'
......
%ul.center-top-menu %ul.center-top-menu
= nav_link(page: [dashboard_groups_path]) do = nav_link(page: dashboard_groups_path) do
= link_to dashboard_groups_path, title: 'Your groups', data: {placement: 'right'} do = link_to dashboard_groups_path, title: 'Your groups', data: {placement: 'right'} do
Your Groups Your Groups
= nav_link(page: [explore_groups_path]) do = nav_link(page: explore_groups_path) do
= link_to explore_groups_path, title: 'Explore groups', data: {placement: 'bottom'} do = link_to explore_groups_path, title: 'Explore groups', data: {placement: 'bottom'} do
Explore Groups Explore Groups
%ul.center-top-menu %ul.center-top-menu
= nav_link(path: ['dashboard#show', 'root#show']) do = nav_link(path: ['projects#index', 'root#index']) do
= link_to dashboard_path, title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do = link_to dashboard_projects_path, title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do
Your Projects Your Projects
= nav_link(page: starred_dashboard_projects_path) do = nav_link(page: starred_dashboard_projects_path) do
= link_to starred_dashboard_projects_path, title: 'Starred Projects', data: {placement: 'right'} do = link_to starred_dashboard_projects_path, title: 'Starred Projects', data: {placement: 'right'} do
......
%ul.center-top-menu
= nav_link(page: dashboard_snippets_path, html_options: {class: 'home'}) do
= link_to dashboard_snippets_path, title: 'Your snippets', data: {placement: 'right'} do
Your Snippets
= nav_link(page: explore_snippets_path) do
= link_to explore_snippets_path, title: 'Explore snippets', data: {placement: 'right'} do
Explore Snippets
= content_for :meta_tags do = content_for :meta_tags do
- if current_user - if current_user
= auto_discovery_link_tag(:atom, dashboard_url(format: :atom, private_token: current_user.private_token), title: "All activity") = auto_discovery_link_tag(:atom, dashboard_projects_url(format: :atom, private_token: current_user.private_token), title: "All activity")
- page_title "Activity"
- header_title "Activity", activity_dashboard_path - header_title "Activity", activity_dashboard_path
= render 'dashboard/activity_head' = render 'dashboard/activity_head'
%section.activities %section.activities
......
xml.instruct! xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
xml.title "Activity" xml.title "Activity"
xml.link href: dashboard_url(format: :atom, private_token: current_user.try(:private_token)), rel: "self", type: "application/atom+xml" xml.link href: dashboard_projects_url(format: :atom, private_token: current_user.try(:private_token)), rel: "self", type: "application/atom+xml"
xml.link href: dashboard_url, rel: "alternate", type: "text/html" xml.link href: dashboard_projects_url, rel: "alternate", type: "text/html"
xml.id dashboard_url xml.id dashboard_projects_url
xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any? xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any?
@events.each do |event| @events.each do |event|
......
= content_for :meta_tags do = content_for :meta_tags do
- if current_user - if current_user
= auto_discovery_link_tag(:atom, dashboard_url(format: :atom, private_token: current_user.private_token), title: "All activity") = auto_discovery_link_tag(:atom, dashboard_projects_url(format: :atom, private_token: current_user.private_token), title: "All activity")
- page_title "Projects"
- header_title "Projects", root_path
- header_title "Projects", (current_user ? root_path : explore_root_path)
= render 'dashboard/projects_head' = render 'dashboard/projects_head'
- if @last_push - if @last_push
......
- page_title "Starred Projects" - page_title "Starred Projects"
- header_title "Projects", (current_user ? root_path : explore_root_path) - header_title "Projects", projects_path
= render 'dashboard/projects_head' = render 'dashboard/projects_head'
- if @projects.any? - if @projects.any?
= render 'dashboard/projects' = render 'projects'
- else - else
%h3 You don't have starred projects yet %h3 You don't have starred projects yet
%p.slead Visit project page and press on star icon and it will appear on this page. %p.slead Visit project page and press on star icon and it will appear on this page.
- page_title "Your Snippets" - page_title "Snippets"
= render 'head' - header_title "Snippets", dashboard_snippets_path
= render 'dashboard/snippets_head'
.gray-content-block .gray-content-block
.pull-right .pull-right
...@@ -11,26 +13,26 @@ ...@@ -11,26 +13,26 @@
%ul.nav.nav-tabs.prepend-top-20 %ul.nav.nav-tabs.prepend-top-20
= nav_tab :scope, nil do = nav_tab :scope, nil do
= link_to user_snippets_path(@user) do = link_to dashboard_snippets_path do
All All
%span.badge %span.badge
= @user.snippets.count = current_user.snippets.count
= nav_tab :scope, 'are_private' do = nav_tab :scope, 'are_private' do
= link_to user_snippets_path(@user, scope: 'are_private') do = link_to dashboard_snippets_path(scope: 'are_private') do
Private Private
%span.badge %span.badge
= @user.snippets.are_private.count = current_user.snippets.are_private.count
= nav_tab :scope, 'are_internal' do = nav_tab :scope, 'are_internal' do
= link_to user_snippets_path(@user, scope: 'are_internal') do = link_to dashboard_snippets_path(scope: 'are_internal') do
Internal Internal
%span.badge %span.badge
= @user.snippets.are_internal.count = current_user.snippets.are_internal.count
= nav_tab :scope, 'are_public' do = nav_tab :scope, 'are_public' do
= link_to user_snippets_path(@user, scope: 'are_public') do = link_to dashboard_snippets_path(scope: 'are_public') do
Public Public
%span.badge %span.badge
= @user.snippets.are_public.count = current_user.snippets.are_public.count
.my-snippets .my-snippets
= render 'snippets' = render 'snippets/snippets'
- if show_last_push_widget?(event) - if show_last_push_widget?(event)
.gray-content-block.clear-block
.event-last-push .event-last-push
.event-last-push-text .event-last-push-text
%span You pushed to %span You pushed to
...@@ -11,4 +12,3 @@ ...@@ -11,4 +12,3 @@
.pull-right .pull-right
= link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn btn-info btn-sm" do = link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn btn-info btn-sm" do
Create Merge Request Create Merge Request
%hr
.explore-title
%h3
Explore GitLab
%p.lead
Discover projects, groups and snippets. Share your projects with others
%br
- page_title "Groups" - page_title "Groups"
- header_title "Groups", (current_user ? dashboard_groups_path : explore_groups_path) - header_title "Groups", dashboard_groups_path
- if current_user - if current_user
= render 'dashboard/groups_head' = render 'dashboard/groups_head'
- else
= render 'explore/head'
.gray-content-block.clearfix .gray-content-block.clearfix
.pull-left .pull-left
= form_tag explore_groups_path, method: :get, class: 'form-inline form-tiny' do |f| = form_tag explore_groups_path, method: :get, class: 'form-inline form-tiny' do |f|
......
- page_title "Projects" - page_title "Projects"
- header_title "Projects", root_path
- if current_user - if current_user
= render 'dashboard/projects_head' = render 'dashboard/projects_head'
- else
= render 'explore/head'
.gray-content-block.clearfix .gray-content-block.clearfix
= render 'filter' = render 'filter'
= render 'projects', projects: @projects = render 'projects', projects: @projects
......
- page_title "Starred Projects" - page_title "Projects"
- header_title "Projects", root_path
- if current_user - if current_user
= render 'dashboard/projects_head' = render 'dashboard/projects_head'
- else
= render 'explore/head'
.explore-trending-block .explore-trending-block
.gray-content-block .gray-content-block
......
- page_title "Trending Projects" - page_title "Projects"
- header_title "Projects", root_path
- if current_user - if current_user
= render 'dashboard/projects_head' = render 'dashboard/projects_head'
- else - else
.explore-title = render 'explore/head'
%h3
Explore GitLab
%p.lead
Discover projects and groups. Share your projects with others
%br
.explore-trending-block .explore-trending-block
.gray-content-block .gray-content-block
.pull-right .pull-right
......
- page_title "Snippets"
- header_title "Snippets", snippets_path
- if current_user
= render 'dashboard/snippets_head'
- else
= render 'explore/head'
.gray-content-block
- if current_user
.pull-right
= link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do
Add new snippet
.oneline
Public snippets created by you and other users are listed here
= render 'snippets/snippets'
- header_title group_title(@group, "Settings", edit_group_path(@group))
- @blank_container = true - @blank_container = true
.panel.panel-default .panel.panel-default
.panel-heading .panel-heading
%strong= @group.name %strong= @group.name
......
- page_title "Projects" - page_title "Projects"
- header_title group_title(@group, "Projects", projects_group_path(@group))
.panel.panel-default .panel.panel-default
.panel-heading .panel-heading
%strong= @group.name %strong= @group.name
......
- unless can?(current_user, :read_group, @group)
- @disable_search_panel = true
= content_for :meta_tags do = content_for :meta_tags do
- if current_user - if current_user
= auto_discovery_link_tag(:atom, group_url(@group, format: :atom, private_token: current_user.private_token), title: "#{@group.name} activity") = auto_discovery_link_tag(:atom, group_url(@group, format: :atom, private_token: current_user.private_token), title: "#{@group.name} activity")
...@@ -16,13 +19,13 @@ ...@@ -16,13 +19,13 @@
= render 'shared/show_aside' = render 'shared/show_aside'
- if can?(current_user, :read_group, @group)
.row .row
%section.activities.col-md-7 %section.activities.col-md-7
.hidden-xs .hidden-xs
- if current_user - if current_user
= render "events/event_last_push", event: @last_push = render "events/event_last_push", event: @last_push
- if current_user
%ul.nav.nav-pills.event_filter.pull-right %ul.nav.nav-pills.event_filter.pull-right
%li %li
= link_to group_path(@group, { format: :atom, private_token: current_user.private_token }), title: "Feed", class: 'rss-btn' do = link_to group_path(@group, { format: :atom, private_token: current_user.private_token }), title: "Feed", class: 'rss-btn' do
...@@ -35,3 +38,6 @@ ...@@ -35,3 +38,6 @@
= spinner = spinner
%aside.side.col-md-5 %aside.side.col-md-5
= render "projects", projects: @projects = render "projects", projects: @projects
- else
%p
This group does not have public projects
- page_title @file.humanize, *@category.split("/").reverse.map(&:humanize) - page_title @file.humanize, *@category.split("/").reverse.map(&:humanize)
.documentation.wiki .documentation.wiki
= markdown @markdown.gsub('$your_email', current_user.email) = markdown @markdown.gsub('$your_email', current_user.try(:email) || "email@example.com")
...@@ -6,10 +6,14 @@ ...@@ -6,10 +6,14 @@
= brand_header_logo = brand_header_logo
.gitlab-text-container .gitlab-text-container
%h3 GitLab %h3 GitLab
- if defined?(sidebar) && sidebar - if defined?(sidebar) && sidebar
= render "layouts/nav/#{sidebar}" = render "layouts/nav/#{sidebar}"
- elsif current_user - elsif current_user
= render 'layouts/nav/dashboard' = render 'layouts/nav/dashboard'
- else
= render 'layouts/nav/explore'
.collapse-nav .collapse-nav
= render partial: 'layouts/collapse_button' = render partial: 'layouts/collapse_button'
- if current_user - if current_user
......
...@@ -31,5 +31,5 @@ ...@@ -31,5 +31,5 @@
.container .container
.footer-links .footer-links
= link_to "Explore", explore_root_path = link_to "Explore", explore_root_path
= link_to "Documentation", "http://doc.gitlab.com/" = link_to "Help", help_path
= link_to "About GitLab", "https://about.gitlab.com/" = link_to "About GitLab", "https://about.gitlab.com/"
- page_title "Explore" - page_title "Explore"
- if current_user - unless current_user
- unless @header_title
- header_title "Projects", (current_user ? root_path : explore_root_path)
- else
- header_title "Explore GitLab", explore_root_path - header_title "Explore GitLab", explore_root_path
- sidebar "dashboard"
= render template: "layouts/application" = render template: "layouts/application"
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
.navbar-collapse.collapse .navbar-collapse.collapse
%ul.nav.navbar-nav.pull-right %ul.nav.navbar-nav.pull-right
- unless @disable_search_panel
%li.hidden-sm.hidden-xs %li.hidden-sm.hidden-xs
= render 'layouts/search' = render 'layouts/search'
%li.visible-sm.visible-xs %li.visible-sm.visible-xs
......
%ul.nav.nav-sidebar %ul.nav.nav-sidebar
= nav_link(path: ['dashboard#show', 'root#show', 'projects#trending', 'projects#starred', 'projects#index'], html_options: {class: 'home'}) do = nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'projects#index'], html_options: {class: 'home'}) do
= link_to (current_user ? root_path : explore_root_path), title: 'Home', class: 'shortcuts-activity', data: {placement: 'right'} do = link_to root_path, title: 'Projects', data: {placement: 'right'} do
= icon('home fw') = icon('home fw')
%span %span
Projects Projects
= nav_link(path: 'dashboard#activity') do = nav_link(path: 'dashboard#activity') do
= link_to activity_dashboard_path, title: 'Activity', data: {placement: 'right'} do = link_to activity_dashboard_path, class: 'shortcuts-activity', title: 'Activity', data: {placement: 'right'} do
= icon('dashboard fw') = icon('dashboard fw')
%span %span
Activity Activity
= nav_link(controller: :groups) do = nav_link(controller: :groups) do
= link_to (current_user ? dashboard_groups_path : explore_groups_path), title: 'Groups', data: {placement: 'right'} do = link_to dashboard_groups_path, title: 'Groups', data: {placement: 'right'} do
= icon('group fw') = icon('group fw')
%span %span
Groups Groups
- if current_user
= nav_link(controller: :milestones) do = nav_link(controller: :milestones) do
= link_to dashboard_milestones_path, title: 'Milestones', data: {placement: 'right'} do = link_to dashboard_milestones_path, title: 'Milestones', data: {placement: 'right'} do
= icon('clock-o fw') = icon('clock-o fw')
...@@ -33,7 +32,7 @@ ...@@ -33,7 +32,7 @@
Merge Requests Merge Requests
%span.count= current_user.assigned_merge_requests.opened.count %span.count= current_user.assigned_merge_requests.opened.count
= nav_link(controller: :snippets) do = nav_link(controller: :snippets) do
= link_to (current_user ? user_snippets_path(current_user) : snippets_path), title: 'Your snippets', data: {placement: 'right'} do = link_to dashboard_snippets_path, title: 'Your snippets', data: {placement: 'right'} do
= icon('clipboard fw') = icon('clipboard fw')
%span %span
Snippets Snippets
...@@ -42,10 +41,8 @@ ...@@ -42,10 +41,8 @@
= icon('question-circle fw') = icon('question-circle fw')
%span %span
Help Help
- if current_user
%li.separate-item
= nav_link(controller: :profile) do = nav_link(controller: :profile) do
= link_to profile_path, title: 'Profile settings', data: {toggle: 'tooltip', placement: 'bottom'} do = link_to profile_path, title: 'Profile settings', data: {placement: 'bottom'} do
= icon('user fw') = icon('user fw')
%span %span
Profile Settings Profile Settings
%ul.nav.nav-sidebar
= nav_link(path: ['dashboard#show', 'root#show', 'projects#trending', 'projects#starred', 'projects#index'], html_options: {class: 'home'}) do
= link_to explore_root_path, title: 'Projects', data: {placement: 'right'} do
= icon('home fw')
%span
Projects
= nav_link(controller: :groups) do
= link_to explore_groups_path, title: 'Groups', data: {placement: 'right'} do
= icon('group fw')
%span
Groups
= nav_link(controller: :snippets) do
= link_to explore_snippets_path, title: 'Snippets', data: {placement: 'right'} do
= icon('clipboard fw')
%span
Snippets
= nav_link(controller: :help) do
= link_to help_path, title: 'Help', data: {placement: 'right'} do
= icon('question-circle fw')
%span
Help
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
= link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do = link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do
= icon('caret-square-o-left fw') = icon('caret-square-o-left fw')
%span %span
Back to Dashboard Back to dashboard
%li.separate-item %li.separate-item
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
= icon('dashboard fw') = icon('dashboard fw')
%span %span
Group Group
- if can?(current_user, :read_group, @group)
- if current_user - if current_user
= nav_link(controller: [:group, :milestones]) do = nav_link(controller: [:group, :milestones]) do
= link_to group_milestones_path(@group), title: 'Milestones', data: {placement: 'right'} do = link_to group_milestones_path(@group), title: 'Milestones', data: {placement: 'right'} do
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
= link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do = link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do
= icon('caret-square-o-left fw') = icon('caret-square-o-left fw')
%span %span
Back to Dashboard Back to dashboard
%li.separate-item %li.separate-item
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
= link_to group_path(@project.group), title: 'Back to group', data: {placement: 'right'}, class: 'back-link' do = link_to group_path(@project.group), title: 'Back to group', data: {placement: 'right'}, class: 'back-link' do
= icon('caret-square-o-left fw') = icon('caret-square-o-left fw')
%span %span
Back to Group Back to group
- else - else
= nav_link do = nav_link do
= link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do = link_to root_path, title: 'Back to dashboard', data: {placement: 'right'}, class: 'back-link' do
= icon('caret-square-o-left fw') = icon('caret-square-o-left fw')
%span %span
Back to Dashboard Back to dashboard
%li.separate-item %li.separate-item
...@@ -26,28 +26,28 @@ ...@@ -26,28 +26,28 @@
Activity Activity
- if project_nav_tab? :files - if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame edit_tree new_tree)) do = nav_link(controller: %w(tree blob blame edit_tree new_tree)) do
= link_to namespace_project_tree_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Files', class: 'shortcuts-tree', data: {placement: 'right'} do = link_to project_files_path(@project), title: 'Files', class: 'shortcuts-tree', data: {placement: 'right'} do
= icon('files-o fw') = icon('files-o fw')
%span %span
Files Files
- if project_nav_tab? :commits - if project_nav_tab? :commits
= nav_link(controller: %w(commit commits compare repositories tags branches)) do = nav_link(controller: %w(commit commits compare repositories tags branches)) do
= link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Commits', class: 'shortcuts-commits', data: {placement: 'right'} do = link_to project_commits_path(@project), title: 'Commits', class: 'shortcuts-commits', data: {placement: 'right'} do
= icon('history fw') = icon('history fw')
%span %span
Commits Commits
- if project_nav_tab? :network - if project_nav_tab? :network
= nav_link(controller: %w(network)) do = nav_link(controller: %w(network)) do
= link_to namespace_project_network_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Network', class: 'shortcuts-network', data: {placement: 'right'} do = link_to namespace_project_network_path(@project.namespace, @project, current_ref), title: 'Network', class: 'shortcuts-network', data: {placement: 'right'} do
= icon('code-fork fw') = icon('code-fork fw')
%span %span
Network Network
- if project_nav_tab? :graphs - if project_nav_tab? :graphs
= nav_link(controller: %w(graphs)) do = nav_link(controller: %w(graphs)) do
= link_to namespace_project_graph_path(@project.namespace, @project, @ref || @repository.root_ref), title: 'Graphs', class: 'shortcuts-graphs', data: {placement: 'right'} do = link_to namespace_project_graph_path(@project.namespace, @project, current_ref), title: 'Graphs', class: 'shortcuts-graphs', data: {placement: 'right'} do
= icon('area-chart fw') = icon('area-chart fw')
%span %span
Graphs Graphs
......
- page_title @project.name_with_namespace - page_title @project.name_with_namespace
- header_title project_title(@project) - header_title detect_project_title(@project)
- sidebar "project" unless sidebar - sidebar "project" unless sidebar
- content_for :scripts_body_top do - content_for :scripts_body_top do
......
- page_title 'Snippets' - header_title "Snippets", snippets_path
- if current_user
- header_title "Snippets", user_snippets_path(current_user)
- else
- header_title 'Snippets', snippets_path
- sidebar "dashboard"
= render template: "layouts/application" = render template: "layouts/application"
- if event = last_push_event - if event = last_push_event
- if show_last_push_widget?(event) - if show_last_push_widget?(event)
.hidden-xs.center
.slead .gray-content-block.top-block.clear-block.hidden-xs
.event-last-push
.event-last-push-text
%span You pushed to %span You pushed to
= link_to namespace_project_commits_path(event.project.namespace, event.project, event.ref_name) do = link_to namespace_project_commits_path(event.project.namespace, event.project, event.ref_name) do
%strong= event.ref_name %strong= event.ref_name
branch branch
#{time_ago_with_tooltip(event.created_at)} #{time_ago_with_tooltip(event.created_at)}
%div .pull-right
= link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn btn-info btn-sm" do = link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn btn-info btn-sm" do
Create Merge Request Create Merge Request
%hr
- page_title "Activity"
= render 'projects/activity' = render 'projects/activity'
...@@ -17,6 +17,6 @@ ...@@ -17,6 +17,6 @@
tree_join(@commit.sha, @path)), class: 'btn btn-sm' tree_join(@commit.sha, @path)), class: 'btn btn-sm'
- if allowed_tree_edit? - if allowed_tree_edit?
= button_tag class: 'remove-blob btn btn-sm btn-remove', .btn-group{:role => "group"}
'data-toggle' => 'modal', 'data-target' => '#modal-remove-blob' do %button.btn.btn-default{class: 'btn-primary', href: '#modal-replace-blob', 'data-target' => '#modal-replace-blob', 'data-toggle' => 'modal'} Replace
Remove %button.btn.btn-default{class: 'btn-remove', href: '#modal-remove-blob', 'data-target' => '#modal-remove-blob', 'data-toggle' => 'modal'} Remove
#modal-replace-blob.modal
.modal-dialog
.modal-content
.modal-header
%a.close{href: "#", "data-dismiss" => "modal"} ×
%h3.page-title Replace #{@blob.name}
%p.light
From branch
%strong= @ref
.modal-body
= form_tag namespace_project_update_blob_path(@project.namespace, @project, @id), method: :put, class: 'blob-file-upload-form-js form-horizontal' do
.dropzone
.dropzone-previews{class: "blob-upload-dropzone-previews"}
%p.dz-message{class: "hint"}<
Attach files by dragging & dropping or&nbsp;
%a{href: '#', class: "markdown-selector"}>click to upload
%br
.dropzone-alerts{class: "alert alert-danger data", "data-dismiss" => "alert", style: "display:none"}
= render 'shared/commit_message_container', params: params,
placeholder: 'Replace this file because...'
.form-group
.col-sm-offset-2.col-sm-10
= button_tag 'Replace file', class: 'btn btn-small btn-primary btn-replace-file', id: 'submit-all'
= link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal"
:coffeescript
disableButtonIfEmptyField $('.blob-file-upload-form-js').find('#commit_message'), '.btn-replace-file'
new BlobFileDropzone($('.blob-file-upload-form-js'), 'put')
#modal-upload-blob.modal
.modal-dialog
.modal-content
.modal-header
%a.close{href: "#", "data-dismiss" => "modal"} ×
%h3.page-title Upload
%p.light
From branch
%strong= @ref
.modal-body
= form_tag namespace_project_create_blob_path(@project.namespace, @project, @id), method: :post, class: 'blob-file-upload-form-js form-horizontal' do
.dropzone
.dropzone-previews{class: "blob-upload-dropzone-previews"}
%p.dz-message{class: "hint"}<
Attach files by dragging & dropping or&nbsp;
%a{href: '#', class: "markdown-selector"}>click to upload
%br
.dropzone-alerts{class: "alert alert-danger data", "data-dismiss" => "alert", style: "display:none"}
= render 'shared/commit_message_container', params: params,
placeholder: 'Upload this file because...'
.form-group
.col-sm-offset-2.col-sm-10
= button_tag 'Upload file', class: 'btn btn-small btn-primary btn-upload-file', id: 'submit-all'
= link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal"
:coffeescript
disableButtonIfEmptyField $('.blob-file-upload-form-js').find('#commit_message'), '.btn-upload-file'
new BlobFileDropzone($('.blob-file-upload-form-js'), 'post')
- page_title "Edit", @blob.path, @ref - page_title "Edit", @blob.path, @ref
.file-editor .file-editor
%ul.nav.nav-tabs.js-edit-mode %ul.center-top-menu.no-bottom.js-edit-mode
%li.active %li.active
= link_to '#editor' do = link_to '#editor' do
%i.fa.fa-edit %i.fa.fa-edit
......
- page_title "New File", @ref %h3.page-title<
%h3.page-title New file Create new file or&nbsp;
%a.upload-link{href: '#modal-upload-blob', 'data-target' => '#modal-upload-blob', 'data-toggle' => 'modal'}>upload existing one
.file-title
= render 'projects/blob/upload'
%br
.file-editor .file-editor
= form_tag(namespace_project_create_blob_path(@project.namespace, @project, @id), method: :post, class: 'form-horizontal form-new-file js-requires-input') do = form_tag(namespace_project_create_blob_path(@project.namespace, @project, @id), method: :post, class: 'form-horizontal form-new-file js-requires-input') do
= render 'projects/blob/editor', ref: @ref = render 'projects/blob/editor', ref: @ref
......
...@@ -10,3 +10,4 @@ ...@@ -10,3 +10,4 @@
- if allowed_tree_edit? - if allowed_tree_edit?
= render 'projects/blob/remove' = render 'projects/blob/remove'
= render 'projects/blob/replace'
%ul.center-top-menu %ul.center-top-menu
= nav_link(controller: [:commit, :commits]) do = nav_link(controller: [:commit, :commits]) do
= link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref) do = link_to namespace_project_commits_path(@project.namespace, @project, current_ref) do
Commits Commits
%span.badge= number_with_delimiter(@repository.commit_count) %span.badge= number_with_delimiter(@repository.commit_count)
= nav_link(controller: :compare) do = nav_link(controller: :compare) do
= link_to namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: @ref || @repository.root_ref) do = link_to namespace_project_compare_index_path(@project.namespace, @project, from: @repository.root_ref, to: current_ref) do
Compare Compare
= nav_link(html_options: {class: branches_tab_class}) do = nav_link(html_options: {class: branches_tab_class}) do
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
= render "home_panel" = render "home_panel"
.center.light-well .gray-content-block.center
%h3.page-title %h3.page-title
The repository for this project is empty The repository for this project is empty
%p %p
......
...@@ -3,7 +3,11 @@ ...@@ -3,7 +3,11 @@
.center .center
%h2 %h2
%i.fa.fa-spinner.fa-spin %i.fa.fa-spinner.fa-spin
- if @project.forked?
Forking in progress.
- else
Import in progress. Import in progress.
- unless @project.forked?
%p.monospace git clone --bare #{hidden_pass_url(@project.import_url)} %p.monospace git clone --bare #{hidden_pass_url(@project.import_url)}
%p Please wait while we import the repository for you. Refresh at will. %p Please wait while we import the repository for you. Refresh at will.
:javascript :javascript
......
- page_title "Labels" - page_title "Labels"
- if can? current_user, :admin_label, @project
.gray-content-block.top-block
- if can? current_user, :admin_label, @project
= link_to new_namespace_project_label_path(@project.namespace, @project), class: "pull-right btn btn-new" do = link_to new_namespace_project_label_path(@project.namespace, @project), class: "pull-right btn btn-new" do
New label New label
%h3.page-title .oneline
Labels Labels can be applied to issues and merge requests.
%hr
.labels .labels
- if @labels.present? - if @labels.present?
%ul.bordered-list.manage-labels-list %ul.content-list.manage-labels-list
= render @labels = render @labels
= paginate @labels, theme: 'gitlab' = paginate @labels, theme: 'gitlab'
- else - else
......
- page_title "Members" - page_title "Members"
%h3.page-title
Users with access to this project
%p.light .gray-content-block.top-block
Read more about project permissions .clearfix.js-toggle-container
%strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink"
%hr
.clearfix.js-toggle-container
= form_tag namespace_project_project_members_path(@project.namespace, @project), method: :get, class: 'form-inline member-search-form' do = form_tag namespace_project_project_members_path(@project.namespace, @project), method: :get, class: 'form-inline member-search-form' do
.form-group .form-group
= search_field_tag :search, params[:search], { placeholder: 'Find existing member by name', class: 'form-control search-text-input' } = search_field_tag :search, params[:search], { placeholder: 'Find existing member by name', class: 'form-control search-text-input' }
...@@ -25,6 +18,11 @@ ...@@ -25,6 +18,11 @@
.js-toggle-content.hide.new-group-member-holder .js-toggle-content.hide.new-group-member-holder
= render "new_project_member" = render "new_project_member"
%p.prepend-top-default.light
Users with access to this project are listed below.
Read more about project permissions
%strong= link_to "here", help_page_path("permissions", "permissions"), class: "vlink"
= render "team", members: @project_members = render "team", members: @project_members
- if @group - if @group
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
.project-stats.gray-content-block .project-stats.gray-content-block
%ul.nav.nav-pills %ul.nav.nav-pills
%li %li
= link_to namespace_project_commits_path(@project.namespace, @project, @ref || @repository.root_ref) do = link_to namespace_project_commits_path(@project.namespace, @project, current_ref) do
= pluralize(number_with_delimiter(@project.commit_count), 'commit') = pluralize(number_with_delimiter(@project.commit_count), 'commit')
%li %li
= link_to namespace_project_branches_path(@project.namespace, @project) do = link_to namespace_project_branches_path(@project.namespace, @project) do
......
%ul.center-top-menu
= nav_link(page: user_snippets_path(current_user), html_options: {class: 'home'}) do
= link_to user_snippets_path(current_user), title: 'Your snippets', data: {placement: 'right'} do
Your Snippets
= nav_link(page: snippets_path) do
= link_to snippets_path, title: 'Explore snippets', data: {placement: 'right'} do
Explore Snippets
- page_title "Public Snippets" - page_title "By #{@user.name}", "Snippets"
- if current_user
= render 'head' %ol.breadcrumb
%li
.gray-content-block = link_to snippets_path do
- if current_user Snippets
.pull-right %li
= link_to new_snippet_path, class: "btn btn-new", title: "New Snippet" do = @user.name
Add new snippet .pull-right.hidden-xs
= link_to user_path(@user) do
.oneline #{@user.name} profile page
Public snippets created by you and other users are listed here
= render 'snippets' = render 'snippets'
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
.back-link .back-link
- if @snippet.author == current_user - if @snippet.author == current_user
= link_to user_snippets_path(current_user) do = link_to dashboard_snippets_path do
&larr; your snippets &larr; your snippets
- else - else
= link_to snippets_path do = link_to explore_snippets_path do
&larr; explore snippets &larr; explore snippets
.file-holder .file-holder
......
- page_title "Snippets", @user.name
%ol.breadcrumb
%li
= link_to snippets_path do
Snippets
%li
= @user.name
.pull-right.hidden-xs
= link_to user_path(@user) do
#{@user.name} profile page
= render 'snippets'
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
- if @user == current_user - if @user == current_user
.pull-right.hidden-xs .pull-right.hidden-xs
= link_to profile_path, class: 'btn btn-sm' do = link_to profile_path, class: 'btn btn-sm' do
%i.fa.fa-pencil-square-o = icon('user')
Edit Profile settings Profile settings
- elsif current_user - elsif current_user
.pull-right .pull-right
%span.dropdown %span.dropdown
......
class RepositoryForkWorker
include Sidekiq::Worker
include Gitlab::ShellAdapter
sidekiq_options queue: :gitlab_shell
def perform(project_id, source_path, target_path)
project = Project.find_by_id(project_id)
unless project.present?
logger.error("Project #{project_id} no longer exists!")
return
end
result = gitlab_shell.fork_repository(source_path, target_path)
unless result
logger.error("Unable to fork project #{project_id} for repository #{source_path} -> #{target_path}")
project.import_fail
project.save
return
end
if project.valid_repo?
ProjectCacheWorker.perform_async(project.id)
project.import_finish
else
project.import_fail
logger.error("Project #{id} had an invalid repository after fork")
end
project.save
end
end
...@@ -242,6 +242,7 @@ Gitlab::Application.routes.draw do ...@@ -242,6 +242,7 @@ Gitlab::Application.routes.draw do
end end
resources :groups, only: [:index] resources :groups, only: [:index]
resources :snippets, only: [:index]
root to: 'projects#trending' root to: 'projects#trending'
end end
...@@ -362,24 +363,25 @@ Gitlab::Application.routes.draw do ...@@ -362,24 +363,25 @@ Gitlab::Application.routes.draw do
# #
# Dashboard Area # Dashboard Area
# #
resource :dashboard, controller: 'dashboard', only: [:show] do resource :dashboard, controller: 'dashboard', only: [] do
member do
get :issues get :issues
get :merge_requests get :merge_requests
get :activity get :activity
end
scope module: :dashboard do scope module: :dashboard do
resources :milestones, only: [:index, :show] resources :milestones, only: [:index, :show]
resources :groups, only: [:index] resources :groups, only: [:index]
resources :snippets, only: [:index]
resources :projects, only: [] do resources :projects, only: [:index] do
collection do collection do
get :starred get :starred
end end
end end
end end
root to: "dashboard/projects#index"
end end
# #
...@@ -403,7 +405,7 @@ Gitlab::Application.routes.draw do ...@@ -403,7 +405,7 @@ Gitlab::Application.routes.draw do
end end
end end
resources :projects, constraints: { id: /[^\/]+/ }, only: [:new, :create] resources :projects, constraints: { id: /[^\/]+/ }, only: [:index, :new, :create]
devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :sessions, confirmations: :confirmations } devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations , passwords: :passwords, sessions: :sessions, confirmations: :confirmations }
...@@ -411,7 +413,7 @@ Gitlab::Application.routes.draw do ...@@ -411,7 +413,7 @@ Gitlab::Application.routes.draw do
get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error
end end
root to: "root#show" root to: "root#index"
# #
# Project Area # Project Area
...@@ -455,6 +457,16 @@ Gitlab::Application.routes.draw do ...@@ -455,6 +457,16 @@ Gitlab::Application.routes.draw do
to: 'blob#destroy', to: 'blob#destroy',
constraints: { id: /.+/, format: false } constraints: { id: /.+/, format: false }
) )
put(
'/blob/*id',
to: 'blob#update',
constraints: { id: /.+/, format: false }
)
post(
'/blob/*id',
to: 'blob#create',
constraints: { id: /.+/, format: false }
)
end end
scope do scope do
......
...@@ -369,4 +369,7 @@ For more information see similar questions on postgresql issue tracker[here](htt ...@@ -369,4 +369,7 @@ For more information see similar questions on postgresql issue tracker[here](htt
## Note ## Note
This documentation is for GitLab CE. This documentation is for GitLab CE.
We backup GitLab.com and make sure your data is secure, but you can't use these methods to export / backup your data yourself from GitLab.com. We backup GitLab.com and make sure your data is secure, but you can't use these methods
to export / backup your data yourself from GitLab.com.
Issues are stored in the database. They can't be stored in Git itself.
...@@ -10,9 +10,9 @@ months after this vulnerability became known the GitLab installation guide ...@@ -10,9 +10,9 @@ months after this vulnerability became known the GitLab installation guide
still contained instructions that would install the outdated, 'vulnerable' Git still contained instructions that would install the outdated, 'vulnerable' Git
version 2.1.2. version 2.1.2.
Run the following command to get your current Git version. Run the following command to get your current Git version:
``` ```sh
/usr/local/bin/git --version /usr/local/bin/git --version
``` ```
...@@ -63,39 +63,44 @@ sudo -u git -H git checkout 8-0-stable-ee ...@@ -63,39 +63,44 @@ sudo -u git -H git checkout 8-0-stable-ee
```bash ```bash
cd /home/git/gitlab-shell cd /home/git/gitlab-shell
sudo -u git -H git fetch sudo -u git -H git fetch
sudo -u git -H git checkout v2.6.4 sudo -u git -H git checkout v2.6.5
``` ```
### 5. Install gitlab-git-http-server ### 5. Install gitlab-git-http-server
First we download Go 1.5 and install it into /usr/local/go. First we download Go 1.5 and install it into `/usr/local/go`:
curl -O --progress https://storage.googleapis.com/golang/go1.5.linux-amd64.tar.gz ```bash
echo '5817fa4b2252afdb02e11e8b9dc1d9173ef3bd5a go1.5.linux-amd64.tar.gz' | shasum -c - && \ curl -O --progress https://storage.googleapis.com/golang/go1.5.linux-amd64.tar.gz
echo '5817fa4b2252afdb02e11e8b9dc1d9173ef3bd5a go1.5.linux-amd64.tar.gz' | shasum -c - && \
sudo tar -C /usr/local -xzf go1.5.linux-amd64.tar.gz sudo tar -C /usr/local -xzf go1.5.linux-amd64.tar.gz
sudo ln -sf /usr/local/go/bin/{go,godoc,gofmt} /usr/local/bin/ sudo ln -sf /usr/local/go/bin/{go,godoc,gofmt} /usr/local/bin/
rm go1.5.linux-amd64.tar.gz rm go1.5.linux-amd64.tar.gz
```
Now we download gitlab-git-http-server and install it in /home/git/gitlab-git-http-server. Now we download `gitlab-git-http-server` and install it in `/home/git/gitlab-git-http-server`:
cd /home/git ```bash
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-git-http-server.git cd /home/git
cd gitlab-git-http-server sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-git-http-server.git
sudo -u git -H make cd gitlab-git-http-server
sudo -u git -H make
```
If you put your Git repositories in a directory different from /home/git/repositories, you need to tell gitlab-git-http-server about it via /etc/gitlab/default. If your Git repositories are in a directory other than `/home/git/repositories`,
See lib/support/init.d/gitlab.default.example for the options. you need to tell `gitlab-git-http-server` about it via `/etc/gitlab/default`.
See `lib/support/init.d/gitlab.default.example` for the options.
### 6. Install libs, migrations, etc. ### 6. Install libs, migrations, etc.
```bash ```bash
cd /home/git/gitlab cd /home/git/gitlab
# MySQL installations (note: the line below states '--without ... postgres') # MySQL installations (note: the line below states '--without postgres')
sudo -u git -H bundle install --without development test postgres --deployment sudo -u git -H bundle install --without postgres development test --deployment
# PostgreSQL installations (note: the line below states '--without ... mysql') # PostgreSQL installations (note: the line below states '--without mysql')
sudo -u git -H bundle install --without development test mysql --deployment sudo -u git -H bundle install --without mysql development test --deployment
# Run database migrations # Run database migrations
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
...@@ -111,20 +116,27 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab ...@@ -111,20 +116,27 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
#### New configuration options for `gitlab.yml` #### New configuration options for `gitlab.yml`
There are new configuration options available for [`gitlab.yml`](config/gitlab.yml.example). View them with the command below and apply them to your current `gitlab.yml`. There are new configuration options available for [`gitlab.yml`](config/gitlab.yml.example). View them with the command below and apply them manually to your current `gitlab.yml`:
``` ```sh
git diff origin/7-14-stable:config/gitlab.yml.example origin/8-0-stable:config/gitlab.yml.example git diff origin/7-14-stable:config/gitlab.yml.example origin/8-0-stable:config/gitlab.yml.example
`````` ```
#### New NGINX configuration #### New Nginx configuration
Because of the new gitlab-git-http-server you need to update your NGINX configuration. Because of the new `gitlab-git-http-server` you need to update your Nginx
If you skip this step 'git clone' and 'git push' over HTTP(S) will stop working. configuration. If you skip this step 'git clone' and 'git push' over HTTP(S)
will stop working.
``` View changes between the previous recommended Nginx configuration and the
# Remove '-ssl' twice in the diff command below if you use HTTP instead of HTTPS current one:
```sh
# For HTTPS configurations
git diff origin/7-14-stable:lib/support/nginx/gitlab-ssl origin/8-0-stable:lib/support/nginx/gitlab-ssl git diff origin/7-14-stable:lib/support/nginx/gitlab-ssl origin/8-0-stable:lib/support/nginx/gitlab-ssl
# For HTTP configurations
git diff origin/7-14-stable:lib/support/nginx/gitlab origin/8-0-stable:lib/support/nginx/gitlab
``` ```
### 8. Start application ### 8. Start application
...@@ -138,7 +150,7 @@ Check if GitLab and its environment are configured correctly: ...@@ -138,7 +150,7 @@ Check if GitLab and its environment are configured correctly:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
To make sure you didn't miss anything run a more thorough check with: To make sure you didn't miss anything run a more thorough check:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
...@@ -147,13 +159,15 @@ If all items are green, then congratulations, the upgrade is complete! ...@@ -147,13 +159,15 @@ If all items are green, then congratulations, the upgrade is complete!
## Things went south? Revert to previous version (7.14) ## Things went south? Revert to previous version (7.14)
### 1. Revert the code to the previous version ### 1. Revert the code to the previous version
Follow the [upgrade guide from 7.13 to 7.14](7.13-to-7.14.md), except for the database migration Follow the [upgrade guide from 7.13 to 7.14](7.13-to-7.14.md), except for the database migration
(The backup is already migrated to the previous version) (The backup is already migrated to the previous version)
### 2. Restore from the backup: ### 2. Restore from the backup
```bash ```bash
cd /home/git/gitlab cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
``` ```
If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above.
If you have more than one backup `*.tar` file(s) please add `BACKUP=timestamp_of_backup` to the command above.
# Universal update guide for patch versions # Universal update guide for patch versions
*Make sure you view this [upgrade guide](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/patch_versions.md) from the `master` branch for the most up to date instructions.* *Make sure you view this [upgrade guide](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/patch_versions.md) from the `master` branch for the most up to date instructions.*
For example from 6.2.0 to 6.2.1, also see the [semantic versioning specification](http://semver.org/). For example from 7.14.0 to 7.14.3, also see the [semantic versioning specification](http://semver.org/).
### 0. Backup ### 0. Backup
...@@ -23,17 +23,16 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ...@@ -23,17 +23,16 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
cd /home/git/gitlab cd /home/git/gitlab
sudo -u git -H git fetch --all sudo -u git -H git fetch --all
sudo -u git -H git checkout -- Gemfile.lock db/schema.rb sudo -u git -H git checkout -- Gemfile.lock db/schema.rb
sudo -u git -H git checkout LATEST_TAG LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
sudo -u git -H git checkout $LATEST_TAG -b $LATEST_TAG
``` ```
Replace LATEST_TAG with the latest GitLab tag you want to upgrade to, for example `v6.6.3`.
### 3. Update gitlab-shell to the corresponding version ### 3. Update gitlab-shell to the corresponding version
```bash ```bash
cd /home/git/gitlab-shell cd /home/git/gitlab-shell
sudo -u git -H git fetch sudo -u git -H git fetch
sudo -u git -H git checkout v`cat /home/git/gitlab/GITLAB_SHELL_VERSION` sudo -u git -H git checkout v`cat /home/git/gitlab/GITLAB_SHELL_VERSION` -b v`cat /home/git/gitlab/GITLAB_SHELL_VERSION`
``` ```
### 4. Install libs, migrations, etc. ### 4. Install libs, migrations, etc.
......
...@@ -3,20 +3,6 @@ Feature: Explore Groups ...@@ -3,20 +3,6 @@ Feature: Explore Groups
Background: Background:
Given group "TestGroup" has private project "Enterprise" Given group "TestGroup" has private project "Enterprise"
Scenario: I should not see group with private projects as visitor
When I visit group "TestGroup" page
Then I should be redirected to sign in page
Scenario: I should not see group with private projects group as user
When I sign in as a user
And I visit group "TestGroup" page
Then page status code should be 404
Scenario: I should not see group with private and internal projects as visitor
Given group "TestGroup" has internal project "Internal"
When I visit group "TestGroup" page
Then I should be redirected to sign in page
Scenario: I should see group with private and internal projects as user Scenario: I should see group with private and internal projects as user
Given group "TestGroup" has internal project "Internal" Given group "TestGroup" has internal project "Internal"
When I sign in as a user When I sign in as a user
......
...@@ -159,3 +159,14 @@ Feature: Groups ...@@ -159,3 +159,14 @@ Feature: Groups
When I visit group "Owned" projects page When I visit group "Owned" projects page
Then I should see group "Owned" projects list Then I should see group "Owned" projects list
And I should see "archived" label And I should see "archived" label
# Public group
@javascript
Scenario: Signed out user should see group
Given "Mary Jane" is owner of group "Owned"
And I am a signed out user
And Group "Owned" has a public project "Public-project"
When I visit group "Owned" page
Then I should see group "Owned"
Then I should see project "Public-project"
...@@ -34,6 +34,29 @@ Feature: Project Source Browse Files ...@@ -34,6 +34,29 @@ Feature: Project Source Browse Files
Then I am redirected to the new file Then I am redirected to the new file
And I should see its new content And I should see its new content
@javascript
Scenario: I can upload file and commit
Given I click on "new file" link in repo
Then I can see new file page
And I can see "upload existing one"
And I click on "upload existing one"
And I upload a new text file
And I fill the upload file commit message
And I click on "Upload file"
Then I can see the new text file
And I can see the new commit message
@javascript
Scenario: I can replace file and commit
Given I click on ".gitignore" file in repo
And I see the ".gitignore"
And I click on "Replace"
And I replace it with a text file
And I fill the replace file commit message
And I click on "Replace file"
Then I can see the new text file
And I can see the replacement commit message
@javascript @javascript
Scenario: I can create and commit file and specify new branch Scenario: I can create and commit file and specify new branch
Given I click on "new file" link in repo Given I click on "new file" link in repo
......
...@@ -6,7 +6,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -6,7 +6,7 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
include Select2Helper include Select2Helper
step 'I should see back to dashboard button' do step 'I should see back to dashboard button' do
expect(page).to have_content 'Back to Dashboard' expect(page).to have_content 'Back to dashboard'
end end
step 'gitlab user "Mike"' do step 'gitlab user "Mike"' do
...@@ -17,6 +17,26 @@ class Spinach::Features::Groups < Spinach::FeatureSteps ...@@ -17,6 +17,26 @@ class Spinach::Features::Groups < Spinach::FeatureSteps
find(:css, 'button.btn-new').click find(:css, 'button.btn-new').click
end end
step 'I should see group "Owned"' do
expect(page).to have_content '@owned'
end
step 'I am a signed out user' do
logout
end
step 'Group "Owned" has a public project "Public-project"' do
group = Group.find_by(name: "Owned")
@project = create :empty_project, :public,
group: group,
name: "Public-project"
end
step 'I should see project "Public-project"' do
expect(page).to have_content 'Public-project'
end
step 'I select "Mike" as "Reporter"' do step 'I select "Mike" as "Reporter"' do
user = User.find_by(name: "Mike") user = User.find_by(name: "Mike")
......
...@@ -63,7 +63,7 @@ class Spinach::Features::Invites < Spinach::FeatureSteps ...@@ -63,7 +63,7 @@ class Spinach::Features::Invites < Spinach::FeatureSteps
end end
step 'I should be redirected to the dashboard' do step 'I should be redirected to the dashboard' do
expect(current_path).to eq(dashboard_path) expect(current_path).to eq(dashboard_projects_path)
end end
step 'I should see a notice telling me I have declined' do step 'I should see a notice telling me I have declined' do
......
...@@ -15,7 +15,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps ...@@ -15,7 +15,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps
end end
step 'I should see the forked project page' do step 'I should see the forked project page' do
expect(page).to have_content "Project was successfully forked." expect(page).to have_content "Forked from"
end end
step 'I already have a project named "Shop" in my namespace' do step 'I already have a project named "Shop" in my namespace' do
......
...@@ -124,10 +124,10 @@ class Spinach::Features::Project < Spinach::FeatureSteps ...@@ -124,10 +124,10 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end end
step 'I should see back to dashboard button' do step 'I should see back to dashboard button' do
expect(page).to have_content 'Back to Dashboard' expect(page).to have_content 'Back to dashboard'
end end
step 'I should see back to group button' do step 'I should see back to group button' do
expect(page).to have_content 'Back to Group' expect(page).to have_content 'Back to group'
end end
end end
# coding: utf-8
class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
include SharedAuthentication include SharedAuthentication
include SharedProject include SharedProject
...@@ -78,7 +79,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps ...@@ -78,7 +79,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end end
step 'I fill the commit message' do step 'I fill the commit message' do
fill_in :commit_message, with: 'Not yet a commit message.' fill_in :commit_message, with: 'Not yet a commit message.', visible: true
end end
step 'I click link "Diff"' do step 'I click link "Diff"' do
...@@ -97,6 +98,14 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps ...@@ -97,6 +98,14 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
click_button 'Remove file' click_button 'Remove file'
end end
step 'I click on "Replace"' do
click_button "Replace"
end
step 'I click on "Replace file"' do
click_button 'Replace file'
end
step 'I see diff' do step 'I see diff' do
expect(page).to have_css '.line_holder.new' expect(page).to have_css '.line_holder.new'
end end
...@@ -106,10 +115,55 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps ...@@ -106,10 +115,55 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
end end
step 'I can see new file page' do step 'I can see new file page' do
expect(page).to have_content "New file" expect(page).to have_content "new file"
expect(page).to have_content "Commit message" expect(page).to have_content "Commit message"
end end
step 'I can see "upload existing one"' do
expect(page).to have_content "upload existing one"
end
step 'I click on "upload existing one"' do
click_link 'upload existing one'
end
step 'I click on "Upload file"' do
click_button 'Upload file'
end
step 'I can see the new commit message' do
expect(page).to have_content "New upload commit message"
end
step 'I upload a new text file' do
drop_in_dropzone test_text_file
end
step 'I fill the upload file commit message' do
page.within('#modal-upload-blob') do
fill_in :commit_message, with: 'New upload commit message'
end
end
step 'I replace it with a text file' do
drop_in_dropzone test_text_file
end
step 'I fill the replace file commit message' do
page.within('#modal-replace-blob') do
fill_in :commit_message, with: 'Replacement file commit message'
end
end
step 'I can see the replacement commit message' do
expect(page).to have_content "Replacement file commit message"
end
step 'I can see the new text file' do
expect(page).to have_content "Lorem ipsum dolor sit amet"
expect(page).to have_content "Sed ut perspiciatis unde omnis"
end
step 'I click on files directory' do step 'I click on files directory' do
click_link 'files' click_link 'files'
end end
...@@ -232,4 +286,29 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps ...@@ -232,4 +286,29 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
def new_file_name def new_file_name
'not_a_file.md' 'not_a_file.md'
end end
def drop_in_dropzone(file_path)
# Generate a fake input selector
page.execute_script <<-JS
var fakeFileInput = window.$('<input/>').attr(
{id: 'fakeFileInput', type: 'file'}
).appendTo('body');
JS
# Attach the file to the fake input selector with Capybara
attach_file("fakeFileInput", file_path)
# Add the file to a fileList array and trigger the fake drop event
page.execute_script <<-JS
var fileList = [$('#fakeFileInput')[0].files[0]];
var e = jQuery.Event('drop', { dataTransfer : { files : fileList } });
$('.dropzone')[0].dropzone.listeners[0].events.drop(e);
JS
end
def test_text_file
File.join(Rails.root, 'spec', 'fixtures', 'doc_sample.txt')
end
def test_image_file
File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
end
end end
...@@ -68,7 +68,7 @@ module SharedPaths ...@@ -68,7 +68,7 @@ module SharedPaths
# ---------------------------------------- # ----------------------------------------
step 'I visit dashboard page' do step 'I visit dashboard page' do
visit dashboard_path visit dashboard_projects_path
end end
step 'I visit dashboard activity page' do step 'I visit dashboard activity page' do
...@@ -460,7 +460,7 @@ module SharedPaths ...@@ -460,7 +460,7 @@ module SharedPaths
end end
step 'I visit snippets page' do step 'I visit snippets page' do
visit snippets_path visit explore_snippets_path
end end
step 'I visit new snippet page' do step 'I visit new snippet page' do
......
...@@ -4,7 +4,7 @@ class Spinach::Features::SnippetsUser < Spinach::FeatureSteps ...@@ -4,7 +4,7 @@ class Spinach::Features::SnippetsUser < Spinach::FeatureSteps
include SharedSnippet include SharedSnippet
step 'I visit my snippets page' do step 'I visit my snippets page' do
visit user_snippets_path(current_user) visit dashboard_snippets_path
end end
step 'I should see "Personal snippet one" in snippets' do step 'I should see "Personal snippet one" in snippets' do
......
...@@ -46,13 +46,11 @@ describe NamespacesController do ...@@ -46,13 +46,11 @@ describe NamespacesController do
context "when the project doesn't have public projects" do context "when the project doesn't have public projects" do
context "when not signed in" do context "when not signed in" do
it "redirects to the sign in page" do it "does not redirect to the sign in page" do
get :show, id: group.path get :show, id: group.path
expect(response).not_to redirect_to(new_user_session_path)
expect(response).to redirect_to(new_user_session_path)
end end
end end
context "when signed in" do context "when signed in" do
before do before do
sign_in(user) sign_in(user)
...@@ -86,10 +84,10 @@ describe NamespacesController do ...@@ -86,10 +84,10 @@ describe NamespacesController do
end end
context "when the user doesn't have access to the project" do context "when the user doesn't have access to the project" do
it "responds with status 404" do it "redirects to the group's page" do
get :show, id: group.path get :show, id: group.path
expect(response.status).to eq(404) expect(response).to redirect_to(group_path(group))
end end
end end
end end
......
require 'spec_helper' require 'spec_helper'
describe RootController do describe RootController do
describe 'GET show' do describe 'GET index' do
context 'with a user' do context 'with a user' do
let(:user) { create(:user) } let(:user) { create(:user) }
...@@ -16,15 +16,15 @@ describe RootController do ...@@ -16,15 +16,15 @@ describe RootController do
end end
it 'redirects to their specified dashboard' do it 'redirects to their specified dashboard' do
get :show get :index
expect(response).to redirect_to starred_dashboard_projects_path expect(response).to redirect_to starred_dashboard_projects_path
end end
end end
context 'who uses the default dashboard setting' do context 'who uses the default dashboard setting' do
it 'renders the default dashboard' do it 'renders the default dashboard' do
get :show get :index
expect(response).to render_template 'dashboard/show' expect(response).to render_template 'dashboard/projects/index'
end end
end end
end end
......
...@@ -156,14 +156,6 @@ describe UploadsController do ...@@ -156,14 +156,6 @@ describe UploadsController do
end end
context "when the project doesn't have public projects" do context "when the project doesn't have public projects" do
context "when not signed in" do
it "redirects to the sign in page" do
get :show, model: "group", mounted_as: "avatar", id: group.id, filename: "image.png"
expect(response).to redirect_to(new_user_session_path)
end
end
context "when signed in" do context "when signed in" do
before do before do
sign_in(user) sign_in(user)
......
...@@ -6,7 +6,7 @@ describe "Dashboard Feed", feature: true do ...@@ -6,7 +6,7 @@ describe "Dashboard Feed", feature: true do
context "projects atom feed via private token" do context "projects atom feed via private token" do
it "should render projects atom feed" do it "should render projects atom feed" do
visit dashboard_path(:atom, private_token: user.private_token) visit dashboard_projects_path(:atom, private_token: user.private_token)
expect(body).to have_selector('feed title') expect(body).to have_selector('feed title')
end end
end end
...@@ -20,7 +20,7 @@ describe "Dashboard Feed", feature: true do ...@@ -20,7 +20,7 @@ describe "Dashboard Feed", feature: true do
project.team << [user, :master] project.team << [user, :master]
issue_event(issue, user) issue_event(issue, user)
note_event(note, user) note_event(note, user)
visit dashboard_path(:atom, private_token: user.private_token) visit dashboard_projects_path(:atom, private_token: user.private_token)
end end
it "should have issue opened event" do it "should have issue opened event" do
......
...@@ -70,7 +70,7 @@ describe 'Profile > Preferences', feature: true do ...@@ -70,7 +70,7 @@ describe 'Profile > Preferences', feature: true do
expect(page.current_path).to eq starred_dashboard_projects_path expect(page.current_path).to eq starred_dashboard_projects_path
click_link 'Your Projects' click_link 'Your Projects'
expect(page.current_path).to eq dashboard_path expect(page.current_path).to eq dashboard_projects_path
end end
end end
......
...@@ -4,7 +4,7 @@ describe "Dashboard access", feature: true do ...@@ -4,7 +4,7 @@ describe "Dashboard access", feature: true do
include AccessMatchers include AccessMatchers
describe "GET /dashboard" do describe "GET /dashboard" do
subject { dashboard_path } subject { dashboard_projects_path }
it { is_expected.to be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { is_expected.to be_allowed_for :user } it { is_expected.to be_allowed_for :user }
...@@ -40,7 +40,7 @@ describe "Dashboard access", feature: true do ...@@ -40,7 +40,7 @@ describe "Dashboard access", feature: true do
it { is_expected.to be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { is_expected.to be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { is_expected.to be_denied_for :visitor } it { is_expected.to be_allowed_for :visitor }
end end
describe "GET /projects/new" do describe "GET /projects/new" do
......
...@@ -68,7 +68,7 @@ describe 'Group access', feature: true do ...@@ -68,7 +68,7 @@ describe 'Group access', feature: true do
it { is_expected.to be_allowed_for group_member(:guest) } it { is_expected.to be_allowed_for group_member(:guest) }
it { is_expected.to be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { is_expected.to be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { is_expected.to be_denied_for :visitor } it { is_expected.to be_allowed_for :visitor }
end end
context 'with no projects' do context 'with no projects' do
...@@ -77,8 +77,8 @@ describe 'Group access', feature: true do ...@@ -77,8 +77,8 @@ describe 'Group access', feature: true do
it { is_expected.to be_allowed_for group_member(:reporter) } it { is_expected.to be_allowed_for group_member(:reporter) }
it { is_expected.to be_allowed_for group_member(:guest) } it { is_expected.to be_allowed_for group_member(:guest) }
it { is_expected.to be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { is_expected.to be_denied_for :user } it { is_expected.to be_allowed_for :user }
it { is_expected.to be_denied_for :visitor } it { is_expected.to be_allowed_for :visitor }
end end
end end
......
...@@ -206,7 +206,7 @@ end ...@@ -206,7 +206,7 @@ end
# dashboard_merge_requests GET /dashboard/merge_requests(.:format) dashboard#merge_requests # dashboard_merge_requests GET /dashboard/merge_requests(.:format) dashboard#merge_requests
describe DashboardController, "routing" do describe DashboardController, "routing" do
it "to #index" do it "to #index" do
expect(get("/dashboard")).to route_to('dashboard#show') expect(get("/dashboard")).to route_to('dashboard/projects#index')
end end
it "to #issues" do it "to #issues" do
...@@ -220,8 +220,8 @@ end ...@@ -220,8 +220,8 @@ end
# root / root#show # root / root#show
describe RootController, 'routing' do describe RootController, 'routing' do
it 'to #show' do it 'to #index' do
expect(get('/')).to route_to('root#show') expect(get('/')).to route_to('root#index')
end end
end end
......
...@@ -96,6 +96,17 @@ describe Projects::CreateService do ...@@ -96,6 +96,17 @@ describe Projects::CreateService do
expect(project.saved?).to be(true) expect(project.saved?).to be(true)
end end
end end
context 'repository creation' do
it 'should synchronously create the repository' do
expect_any_instance_of(Project).to receive(:create_repository)
project = create_project(@user, @opts)
expect(project).to be_valid
expect(project.owner).to eq(@user)
expect(project.namespace).to eq(@user.namespace)
end
end
end end
def create_project(user, opts) def create_project(user, opts)
......
...@@ -28,8 +28,7 @@ describe Projects::ForkService do ...@@ -28,8 +28,7 @@ describe Projects::ForkService do
context 'fork project failure' do context 'fork project failure' do
it "fails due to transaction failure" do it "fails due to transaction failure" do
@to_project = fork_project(@from_project, @to_user, false) @to_project = fork_project(@from_project, @to_user, false)
expect(@to_project.errors).not_to be_empty expect(@to_project.import_failed?)
expect(@to_project.errors[:base]).to include("Failed to fork repository via gitlab-shell")
end end
end end
...@@ -100,7 +99,7 @@ describe Projects::ForkService do ...@@ -100,7 +99,7 @@ describe Projects::ForkService do
end end
def fork_project(from_project, user, fork_success = true, params = {}) def fork_project(from_project, user, fork_success = true, params = {})
allow_any_instance_of(Gitlab::Shell).to receive(:fork_repository).and_return(fork_success) allow(RepositoryForkWorker).to receive(:perform_async).and_return(fork_success)
Projects::ForkService.new(from_project, user, params).execute Projects::ForkService.new(from_project, user, params).execute
end end
end end
require 'spec_helper'
describe RepositoryForkWorker do
let(:project) { create(:project) }
let(:fork_project) { create(:project, forked_from_project: project) }
subject { RepositoryForkWorker.new }
describe "#perform" do
it "creates a new repository from a fork" do
expect_any_instance_of(Gitlab::Shell).to receive(:fork_repository).with(
project.path_with_namespace,
fork_project.namespace.path).
and_return(true)
expect(ProjectCacheWorker).to receive(:perform_async)
subject.perform(project.id,
project.path_with_namespace,
fork_project.namespace.path)
end
it "handles bad fork" do
expect_any_instance_of(Gitlab::Shell).to receive(:fork_repository).and_return(false)
subject.perform(project.id,
project.path_with_namespace,
fork_project.namespace.path)
end
end
end
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