summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG15
-rw-r--r--Gemfile4
-rw-r--r--Gemfile.lock10
-rw-r--r--app/assets/images/gitorious-logo-black.pngbin0 -> 809 bytes
-rw-r--r--app/assets/images/gitorious-logo-blue.pngbin0 -> 495 bytes
-rw-r--r--app/assets/images/logo-black.pngbin2608 -> 0 bytes
-rw-r--r--app/assets/images/logo-white.pngbin7331 -> 7699 bytes
-rw-r--r--app/assets/stylesheets/generic/mobile.scss1
-rw-r--r--app/assets/stylesheets/sections/header.scss97
-rw-r--r--app/assets/stylesheets/sections/import.scss18
-rw-r--r--app/assets/stylesheets/sections/nav_sidebar.scss18
-rw-r--r--app/assets/stylesheets/themes/dark-theme.scss63
-rw-r--r--app/assets/stylesheets/themes/ui_basic.scss11
-rw-r--r--app/assets/stylesheets/themes/ui_color.scss40
-rw-r--r--app/assets/stylesheets/themes/ui_gray.scss30
-rw-r--r--app/assets/stylesheets/themes/ui_mars.scss36
-rw-r--r--app/assets/stylesheets/themes/ui_modern.scss40
-rw-r--r--app/controllers/projects/blob_controller.rb26
-rw-r--r--app/controllers/projects_controller.rb2
-rw-r--r--app/controllers/users_controller.rb4
-rw-r--r--app/helpers/appearances_helper.rb4
-rw-r--r--app/models/project.rb6
-rw-r--r--app/models/user.rb7
-rw-r--r--app/services/files/create_service.rb3
-rw-r--r--app/services/files/update_service.rb3
-rw-r--r--app/views/admin/projects/index.html.haml6
-rw-r--r--app/views/admin/users/index.html.haml6
-rw-r--r--app/views/import/gitorious/status.html.haml2
-rw-r--r--app/views/layouts/_collapse_button.html.haml4
-rw-r--r--app/views/layouts/_head_panel.html.haml2
-rw-r--r--app/views/layouts/_public_head_panel.html.haml4
-rw-r--r--app/views/layouts/admin.html.haml2
-rw-r--r--app/views/layouts/application.html.haml2
-rw-r--r--app/views/layouts/errors.html.haml2
-rw-r--r--app/views/layouts/explore.html.haml2
-rw-r--r--app/views/layouts/group.html.haml2
-rw-r--r--app/views/layouts/nav/_project.html.haml2
-rw-r--r--app/views/layouts/navless.html.haml2
-rw-r--r--app/views/layouts/profile.html.haml2
-rw-r--r--app/views/layouts/project_settings.html.haml2
-rw-r--r--app/views/layouts/projects.html.haml2
-rw-r--r--app/views/layouts/public_group.html.haml2
-rw-r--r--app/views/layouts/public_projects.html.haml2
-rw-r--r--app/views/layouts/public_users.html.haml2
-rw-r--r--app/views/layouts/search.html.haml2
-rw-r--r--app/views/projects/blob/edit.html.haml7
-rw-r--r--app/views/projects/blob/new.html.haml7
-rw-r--r--app/views/projects/new.html.haml2
-rw-r--r--db/migrate/20150223022001_set_missing_last_activity_at.rb9
-rw-r--r--db/schema.rb4
-rw-r--r--doc/update/6.x-or-7.x-to-7.8.md2
-rw-r--r--doc/workflow/web_editor.md4
-rw-r--r--doc/workflow/web_editor/edit_file.pngbin99624 -> 89039 bytes
-rw-r--r--doc/workflow/web_editor/new_file.pngbin100516 -> 85526 bytes
-rw-r--r--features/project/source/browse_files.feature22
-rw-r--r--features/steps/project/source/browse_files.rb15
-rw-r--r--lib/gitlab/satellite/files/edit_file_action.rb6
-rw-r--r--lib/gitlab/satellite/files/new_file_action.rb10
58 files changed, 296 insertions, 282 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 5c93903e98f..dce52b7c700 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,17 @@ v 7.9.0 (unreleased)
- Improve error messages for file edit failures
- Improve UI for commits, issues and merge request lists
- Fix commit comments on first line of diff not rendering in Merge Request Discussion view.
+ - Improve trigger merge request hook when source project branch has been updated (Kirill Zaitsev)
+ - Save web edit in new branch
+ - Fix ordering of imported but unchanged projects (Marco Wessel)
+ - Mobile UI improvements: make aside content expandable
+
+v 7.8.1
+ - Fix run of custom post receive hooks
+ - Fix migration that caused issues when upgrading to version 7.8 from versions prior to 7.3
+ - Fix the warning for LDAP users about need to set password
+ - Fix avatars which were not shown for non logged in users
+ - Fix urls for the issues when relative url was enabled
v 7.8.0
- Fix access control and protection against XSS for note attachments and other uploads.
@@ -39,7 +50,7 @@ v 7.8.0
- Allow configuring protection of the default branch upon first push (Marco Wessel)
- Add gitlab.com importer
- Add an ability to login with gitlab.com
- - Add a commit calendar to the user profile (Hannes Rosenögger)
+ - Add a commit calendar to the user profile (Hannes Rosenögger)
- Submit comment on command-enter
- Notify all members of a group when that group is mentioned in a comment, for example: `@gitlab-org` or `@sales`.
- Extend issue clossing pattern to include "Resolve", "Resolves", "Resolved", "Resolving" and "Close"
@@ -54,7 +65,7 @@ v 7.8.0
- API: Access groups with their path (Julien Bianchi)
- Added link to milestone and keeping resource context on smaller viewports for issues and merge requests (Jason Blanchard)
- Allow notification email to be set separately from primary email.
- - API: Add support for editing an existing project (Mika Mäenpää and Hannes Rosenögger)
+ - API: Add support for editing an existing project (Mika Mäenpää and Hannes Rosenögger)
- Don't have Markdown preview fail for long comments/wiki pages.
- When test web hook - show error message instead of 500 error page if connection to hook url was reset
- Added support for firing system hooks on group create/destroy and adding/removing users to group (Boyan Tabakov)
diff --git a/Gemfile b/Gemfile
index 1c387db3925..8e8452ee35a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -41,7 +41,7 @@ gem "browser"
gem "gitlab_git", '7.0.0.rc14'
# Ruby/Rack Git Smart-HTTP Server Handler
-gem 'gitlab-grack', '~> 2.0.0.pre', require: 'grack'
+gem 'gitlab-grack', '~> 2.0.0.rc2', require: 'grack'
# LDAP Auth
gem 'gitlab_omniauth-ldap', '1.2.0', require: "omniauth-ldap"
@@ -50,7 +50,7 @@ gem 'gitlab_omniauth-ldap', '1.2.0', require: "omniauth-ldap"
gem 'gollum-lib', '~> 4.0.0'
# Language detection
-gem "gitlab-linguist", "~> 3.0.0", require: "linguist"
+gem "gitlab-linguist", "~> 3.0.1", require: "linguist"
# API
gem "grape", "~> 0.6.1"
diff --git a/Gemfile.lock b/Gemfile.lock
index df92499941a..cda85b9bf6b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -81,7 +81,7 @@ GEM
json (>= 1.7)
celluloid (0.16.0)
timers (~> 4.0.0)
- charlock_holmes (0.7.3)
+ charlock_holmes (0.6.9.4)
cliver (0.3.2)
coderay (1.1.0)
coercible (1.0.0)
@@ -188,14 +188,14 @@ GEM
gitlab-flowdock-git-hook (0.4.2.2)
gitlab-grit (>= 2.4.1)
multi_json
- gitlab-grack (2.0.0.pre)
+ gitlab-grack (2.0.0.rc2)
rack (~> 1.5.1)
gitlab-grit (2.7.2)
charlock_holmes (~> 0.6)
diff-lcs (~> 1.1)
mime-types (~> 1.15)
posix-spawn (~> 0.3)
- gitlab-linguist (3.0.0)
+ gitlab-linguist (3.0.1)
charlock_holmes (~> 0.6.6)
escape_utils (~> 0.2.4)
mime-types (~> 1.19)
@@ -674,8 +674,8 @@ DEPENDENCIES
gemnasium-gitlab-service (~> 0.2)
github-markup
gitlab-flowdock-git-hook (~> 0.4.2)
- gitlab-grack (~> 2.0.0.pre)
- gitlab-linguist (~> 3.0.0)
+ gitlab-grack (~> 2.0.0.rc2)
+ gitlab-linguist (~> 3.0.1)
gitlab_emoji (~> 0.0.1.1)
gitlab_git (= 7.0.0.rc14)
gitlab_meta (= 7.0)
diff --git a/app/assets/images/gitorious-logo-black.png b/app/assets/images/gitorious-logo-black.png
new file mode 100644
index 00000000000..78f17a9af79
--- /dev/null
+++ b/app/assets/images/gitorious-logo-black.png
Binary files differ
diff --git a/app/assets/images/gitorious-logo-blue.png b/app/assets/images/gitorious-logo-blue.png
new file mode 100644
index 00000000000..4962cffba31
--- /dev/null
+++ b/app/assets/images/gitorious-logo-blue.png
Binary files differ
diff --git a/app/assets/images/logo-black.png b/app/assets/images/logo-black.png
deleted file mode 100644
index 49cdc16cacd..00000000000
--- a/app/assets/images/logo-black.png
+++ /dev/null
Binary files differ
diff --git a/app/assets/images/logo-white.png b/app/assets/images/logo-white.png
index 2299153caba..917bcfcb7e7 100644
--- a/app/assets/images/logo-white.png
+++ b/app/assets/images/logo-white.png
Binary files differ
diff --git a/app/assets/stylesheets/generic/mobile.scss b/app/assets/stylesheets/generic/mobile.scss
index 2bb69f4aa7e..b3727c33672 100644
--- a/app/assets/stylesheets/generic/mobile.scss
+++ b/app/assets/stylesheets/generic/mobile.scss
@@ -69,5 +69,6 @@
background: #EEE;
font-size: 20px;
color: #777;
+ z-index: 100;
@include box-shadow(0 1px 2px #DDD);
}
diff --git a/app/assets/stylesheets/sections/header.scss b/app/assets/stylesheets/sections/header.scss
index e255cbcada8..26b4d04106e 100644
--- a/app/assets/stylesheets/sections/header.scss
+++ b/app/assets/stylesheets/sections/header.scss
@@ -86,7 +86,7 @@ header {
.container {
width: 100% !important;
- padding-left: 0px;
+ padding: 0px;
}
/**
@@ -100,18 +100,14 @@ header {
a {
float: left;
- padding: 0px;
- margin: 0 6px;
-
- h1 {
- margin: 0;
- background: image-url('logo-black.png') no-repeat center center;
- background-size: 32px;
- float: left;
- height: 46px;
- width: 40px;
- @include header-font;
- text-indent: -9999px;
+ padding: 5px 0;
+ height: 46px;
+ width: 52px;
+ text-align: center;
+
+ img {
+ width: 36px;
+ height: 36px;
}
}
&:hover {
@@ -134,14 +130,13 @@ header {
}
.profile-pic {
- position: relative;
- top: -1px;
- padding-right: 0px !important;
+ padding: 0px !important;
+ width: 46px;
+ height: 46px;
+ margin-left: 5px;
img {
- width: 50px;
- height: 50px;
- margin: -15px;
- margin-left: 5px;
+ width: 46px;
+ height: 46px;
}
}
@@ -174,68 +169,6 @@ header {
@include transition(all 0.15s ease-in 0s);
}
}
-
-
- /*
- * Dark header
- *
- */
- &.header-dark {
- &.navbar-gitlab {
- .navbar-inner {
- background: #708090;
- border-bottom: 1px solid #AAA;
-
- .navbar-toggle { color: #fff; }
-
- .nav > li > a {
- color: #AAA;
-
- &:hover, &:focus, &:active {
- background: none;
- color: #FFF;
- }
- }
- }
- }
-
- .turbolink-spinner {
- color: #FFF;
- }
-
- .search {
- .search-input {
- background-color: #D2D5DA;
- background-color: rgba(255, 255, 255, 0.5);
- border: 1px solid #AAA;
-
- &:focus {
- background-color: white;
- }
- }
- }
- .search-input::-webkit-input-placeholder {
- color: #666;
- }
- .app_logo {
- a {
- h1 {
- background: image-url('logo-white.png') no-repeat center center;
- background-size: 32px;
- color: #fff;
- }
- }
- }
- .title {
- a {
- color: #FFF;
- &:hover {
- text-decoration: underline;
- }
- }
- color: #fff;
- }
- }
}
.search .search-input {
diff --git a/app/assets/stylesheets/sections/import.scss b/app/assets/stylesheets/sections/import.scss
new file mode 100644
index 00000000000..3df4bb84bd2
--- /dev/null
+++ b/app/assets/stylesheets/sections/import.scss
@@ -0,0 +1,18 @@
+i.icon-gitorious {
+ display: inline-block;
+ background-position: 0px 0px;
+ background-size: contain;
+ background-repeat: no-repeat;
+}
+
+i.icon-gitorious-small {
+ background-image: image-url('gitorious-logo-blue.png');
+ width: 13px;
+ height: 13px;
+}
+
+i.icon-gitorious-big {
+ background-image: image-url('gitorious-logo-black.png');
+ width: 18px;
+ height: 18px;
+}
diff --git a/app/assets/stylesheets/sections/nav_sidebar.scss b/app/assets/stylesheets/sections/nav_sidebar.scss
index 8e02b375074..335f1379662 100644
--- a/app/assets/stylesheets/sections/nav_sidebar.scss
+++ b/app/assets/stylesheets/sections/nav_sidebar.scss
@@ -108,7 +108,7 @@
width: $sidebar_width;
.nav-sidebar {
- margin-top: 20px;
+ margin-top: 29px;
position: fixed;
top: 45px;
width: $sidebar_width;
@@ -127,7 +127,7 @@
width: 52px;
.nav-sidebar {
- margin-top: 20px;
+ margin-top: 29px;
position: fixed;
top: 45px;
width: 52px;
@@ -144,14 +144,22 @@
}
}
}
+
+ .collapse-nav a {
+ left: 0px;
+ padding: 5px 23px 3px 22px;
+ }
}
}
.collapse-nav a {
position: fixed;
- bottom: 15px;
- padding: 10px;
- background: #DDD;
+ top: 47px;
+ padding: 5px 13px 3px 13px;
+ left: 197px;
+ background: #EEE;
+ color: black;
+ border: 1px solid rgba(0,0,0,0.035);
}
@media (max-width: $screen-md-max) {
diff --git a/app/assets/stylesheets/themes/dark-theme.scss b/app/assets/stylesheets/themes/dark-theme.scss
new file mode 100644
index 00000000000..b7b22a8724e
--- /dev/null
+++ b/app/assets/stylesheets/themes/dark-theme.scss
@@ -0,0 +1,63 @@
+@mixin dark-theme($color-light, $color, $color-darker, $color-dark) {
+ header {
+ &.navbar-gitlab {
+ .navbar-inner {
+ background: $color;
+
+ .navbar-toggle {
+ color: #FFF;
+ }
+
+ .app_logo, .navbar-toggle {
+ &:hover {
+ background-color: $color-darker;
+ }
+ }
+
+ .app_logo {
+ background-color: $color-dark;
+ }
+
+ .title {
+ color: #FFF;
+
+ a {
+ color: #FFF;
+ &:hover {
+ text-decoration: underline;
+ }
+ }
+ }
+
+ .search {
+ .search-input {
+ background-color: $color-light;
+ background-color: rgba(255, 255, 255, 0.5);
+ border: 1px solid $color-light;
+
+ &:focus {
+ background-color: white;
+ }
+ }
+ }
+
+ .search-input::-webkit-input-placeholder {
+ color: #666;
+ }
+
+ .nav > li > a {
+ color: $color-light;
+
+ &:hover, &:focus, &:active {
+ background: none;
+ color: #FFF;
+ }
+ }
+
+ .search-input {
+ border-color: $color-light;
+ }
+ }
+ }
+ }
+}
diff --git a/app/assets/stylesheets/themes/ui_basic.scss b/app/assets/stylesheets/themes/ui_basic.scss
index 0dad9917b55..097d5c5b73c 100644
--- a/app/assets/stylesheets/themes/ui_basic.scss
+++ b/app/assets/stylesheets/themes/ui_basic.scss
@@ -10,8 +10,15 @@
background: #F1F1F1;
border-bottom: 1px solid #DDD;
- .app_logo {
- background-color: #DDD;
+ .title {
+ color: #555;
+
+ a {
+ color: #555;
+ &:hover {
+ text-decoration: underline;
+ }
+ }
}
.nav > li > a {
diff --git a/app/assets/stylesheets/themes/ui_color.scss b/app/assets/stylesheets/themes/ui_color.scss
index 3c441a8e098..7ac6903b2e4 100644
--- a/app/assets/stylesheets/themes/ui_color.scss
+++ b/app/assets/stylesheets/themes/ui_color.scss
@@ -1,42 +1,6 @@
/**
- * This file represent some UI that can be changed
- * during web app restyle or theme select.
- *
- * Next items should be placed there
- * - link colors
- * - header restyles
- *
+ * Violet GitLab UI theme
*/
.ui_color {
- /*
- * Application Header
- *
- */
- header {
- @extend .header-dark;
- &.navbar-gitlab {
- .navbar-inner {
- background: #548;
- border-bottom: 1px solid #436;
- .app_logo, .navbar-toggle {
- &:hover {
- background-color: #436;
- }
- }
- .app_logo {
- background-color: #325;
- }
- .nav > li > a {
- color: #98C;
- }
- .search-input {
- border-color: #98C;
- }
- }
- }
- }
-
- .nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus {
- background: #659;
- }
+ @include dark-theme(#98C, #548, #436, #325);
}
diff --git a/app/assets/stylesheets/themes/ui_gray.scss b/app/assets/stylesheets/themes/ui_gray.scss
index 8df08ccaeec..9257e5f4d40 100644
--- a/app/assets/stylesheets/themes/ui_gray.scss
+++ b/app/assets/stylesheets/themes/ui_gray.scss
@@ -1,32 +1,6 @@
/**
- * This file represent some UI that can be changed
- * during web app restyle or theme select.
- *
- * Next items should be placed there
- * - link colors
- * - header restyles
- *
+ * Gray GitLab UI theme
*/
.ui_gray {
- /*
- * Application Header
- *
- */
- header {
- @extend .header-dark;
- &.navbar-gitlab {
- .navbar-inner {
- background: #373737;
- border-bottom: 1px solid #272727;
- .app_logo, .navbar-toggle {
- &:hover {
- background-color: #272727;
- }
- }
- .app_logo {
- background-color: #222;
- }
- }
- }
- }
+ @include dark-theme(#979797, #373737, #272727, #222222);
}
diff --git a/app/assets/stylesheets/themes/ui_mars.scss b/app/assets/stylesheets/themes/ui_mars.scss
index b08cbda6c4f..4caf5843d9b 100644
--- a/app/assets/stylesheets/themes/ui_mars.scss
+++ b/app/assets/stylesheets/themes/ui_mars.scss
@@ -1,38 +1,6 @@
/**
- * This file represent some UI that can be changed
- * during web app restyle or theme select.
- *
- * Next items should be placed there
- * - link colors
- * - header restyles
- *
+ * Classic GitLab UI theme
*/
.ui_mars {
- /*
- * Application Header
- *
- */
- header {
- @extend .header-dark;
- &.navbar-gitlab {
- .navbar-inner {
- background: #474D57;
- border-bottom: 1px solid #373D47;
- .app_logo, .navbar-toggle {
- &:hover {
- background-color: #373D47;
- }
- }
- .app_logo {
- background-color: #24272D;
- }
- .nav > li > a {
- color: #979DA7;
- }
- .search-input {
- border-color: #979DA7;
- }
- }
- }
- }
+ @include dark-theme(#979DA7, #474D57, #373D47, #24272D);
}
diff --git a/app/assets/stylesheets/themes/ui_modern.scss b/app/assets/stylesheets/themes/ui_modern.scss
index 34f39614ca4..70449882317 100644
--- a/app/assets/stylesheets/themes/ui_modern.scss
+++ b/app/assets/stylesheets/themes/ui_modern.scss
@@ -1,42 +1,6 @@
/**
- * This file represent some UI that can be changed
- * during web app restyle or theme select.
- *
- * Next items should be placed there
- * - link colors
- * - header restyles
- *
+ * Modern GitLab UI theme
*/
.ui_modern {
- /*
- * Application Header
- *
- */
- header {
- @extend .header-dark;
- &.navbar-gitlab {
- .navbar-inner {
- background: #019875;
- border-bottom: 1px solid #019875;
- .app_logo, .navbar-toggle {
- &:hover {
- background-color: #018865;
- }
- }
- .app_logo {
- background-color: #017855;
- }
- .nav > li > a {
- color: #ADC;
- }
- .search-input {
- border-color: #8ba;
- }
- }
- }
- }
-
- .nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus {
- background: #019875;
- }
+ @include dark-theme(#ADC, #019875, #018865, #017855);
}
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index 1207548eae0..4b7eb4df298 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -1,6 +1,7 @@
# Controller for viewing a file's blame
class Projects::BlobController < Projects::ApplicationController
include ExtractsPath
+ include ActionView::Helpers::SanitizeHelper
# Raised when given an invalid file path
class InvalidPathError < StandardError; end
@@ -21,11 +22,18 @@ class Projects::BlobController < Projects::ApplicationController
def create
file_path = File.join(@path, File.basename(params[:file_name]))
- result = Files::CreateService.new(@project, current_user, params, @ref, file_path).execute
+ result = Files::CreateService.new(
+ @project,
+ current_user,
+ params.merge(new_branch: sanitized_new_branch_name),
+ @ref,
+ file_path
+ ).execute
if result[:status] == :success
flash[:notice] = "Your changes have been successfully committed"
- redirect_to namespace_project_blob_path(@project.namespace, @project, File.join(@ref, file_path))
+ ref = sanitized_new_branch_name.presence || @ref
+ redirect_to namespace_project_blob_path(@project.namespace, @project, File.join(ref, file_path))
else
flash[:alert] = result[:message]
render :new
@@ -41,7 +49,13 @@ class Projects::BlobController < Projects::ApplicationController
def update
result = Files::UpdateService.
- new(@project, current_user, params, @ref, @path).execute
+ new(
+ @project,
+ current_user,
+ params.merge(new_branch: sanitized_new_branch_name),
+ @ref,
+ @path
+ ).execute
if result[:status] == :success
flash[:notice] = "Your changes have been successfully committed"
@@ -131,6 +145,8 @@ class Projects::BlobController < Projects::ApplicationController
if from_merge_request
diffs_namespace_project_merge_request_path(from_merge_request.target_project.namespace, from_merge_request.target_project, from_merge_request) +
"#file-path-#{hexdigest(@path)}"
+ elsif sanitized_new_branch_name.present?
+ namespace_project_blob_path(@project.namespace, @project, File.join(sanitized_new_branch_name, @path))
else
namespace_project_blob_path(@project.namespace, @project, @id)
end
@@ -140,4 +156,8 @@ class Projects::BlobController < Projects::ApplicationController
# If blob edit was initiated from merge request page
@from_merge_request ||= MergeRequest.find_by(id: params[:from_merge_request_id])
end
+
+ def sanitized_new_branch_name
+ @new_branch ||= sanitize(strip_tags(params[:new_branch]))
+ end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 3063f00adeb..8a055cc2a36 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -102,7 +102,7 @@ class ProjectsController < ApplicationController
flash[:alert] = 'Project deleted.'
if request.referer.include?('/admin')
- redirect_to admin_namespace_projects_path
+ redirect_to admin_namespaces_projects_path
else
redirect_to projects_dashboard_path
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 4c2fe4c3c8d..8a13394dbac 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -6,7 +6,9 @@ class UsersController < ApplicationController
def show
@contributed_projects = Project.
where(id: authorized_projects_ids & @user.contributed_projects_ids).
- in_group_namespace.includes(:namespace)
+ in_group_namespace.
+ includes(:namespace).
+ reject(&:forked?)
@projects = @user.personal_projects.
where(id: authorized_projects_ids).includes(:namespace)
diff --git a/app/helpers/appearances_helper.rb b/app/helpers/appearances_helper.rb
index 96e5d43a369..bb8d5683807 100644
--- a/app/helpers/appearances_helper.rb
+++ b/app/helpers/appearances_helper.rb
@@ -14,4 +14,8 @@ module AppearancesHelper
def brand_text
nil
end
+
+ def brand_header_logo
+ image_tag 'logo-white.png'
+ end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 932cfc980a2..2d46b7d7a95 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -48,6 +48,12 @@ class Project < ActiveRecord::Base
default_value_for :wall_enabled, false
default_value_for :snippets_enabled, gitlab_config_features.snippets
+ # set last_activity_at to the same as created_at
+ after_create :set_last_activity_at
+ def set_last_activity_at
+ update_column(:last_activity_at, self.created_at)
+ end
+
ActsAsTaggableOn.strict_case_match = true
acts_as_taggable_on :tags
diff --git a/app/models/user.rb b/app/models/user.rb
index 80bdd47ea0c..73a75df9d11 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -623,9 +623,10 @@ class User < ActiveRecord::Base
def contributed_projects_ids
Event.where(author_id: self).
where("created_at > ?", Time.now - 1.year).
- code_push.
+ where("action = :pushed OR (target_type = 'MergeRequest' AND action = :created)",
+ pushed: Event::PUSHED, created: Event::CREATED).
reorder(project_id: :desc).
- select('DISTINCT(project_id)').
- map(&:project_id)
+ select(:project_id).
+ uniq
end
end
diff --git a/app/services/files/create_service.rb b/app/services/files/create_service.rb
index 2c457ef2cef..de5322e990a 100644
--- a/app/services/files/create_service.rb
+++ b/app/services/files/create_service.rb
@@ -38,7 +38,8 @@ module Files
created_successfully = new_file_action.commit!(
params[:content],
params[:commit_message],
- params[:encoding]
+ params[:encoding],
+ params[:new_branch]
)
if created_successfully
diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb
index bcf0e7f3cee..328cf3a4b06 100644
--- a/app/services/files/update_service.rb
+++ b/app/services/files/update_service.rb
@@ -23,7 +23,8 @@ module Files
edit_file_action.commit!(
params[:content],
params[:commit_message],
- params[:encoding]
+ params[:encoding],
+ params[:new_branch]
)
success
diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml
index 0f9cdfc9e8e..3780500a447 100644
--- a/app/views/admin/projects/index.html.haml
+++ b/app/views/admin/projects/index.html.haml
@@ -1,5 +1,7 @@
.row
- .col-md-3
+ = link_to '#aside', class: 'show-aside' do
+ %i.fa.fa-angle-left
+ %aside.col-md-3
.admin-filter
= form_tag admin_namespaces_projects_path, method: :get, class: '' do
.form-group
@@ -36,7 +38,7 @@
= button_tag "Search", class: "btn submit btn-primary"
= link_to "Reset", admin_namespaces_projects_path, class: "btn btn-cancel"
- .col-md-9
+ %section.col-md-9
.panel.panel-default
.panel-heading
Projects (#{@projects.total_count})
diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml
index 6e15cec467b..4a4f0549ada 100644
--- a/app/views/admin/users/index.html.haml
+++ b/app/views/admin/users/index.html.haml
@@ -1,5 +1,7 @@
.row
- .col-md-3
+ = link_to '#aside', class: 'show-aside' do
+ %i.fa.fa-angle-left
+ %aside.col-md-3
.admin-filter
%ul.nav.nav-pills.nav-stacked
%li{class: "#{'active' unless params[:filter]}"}
@@ -27,7 +29,7 @@
%hr
= link_to 'Reset', admin_users_path, class: "btn btn-cancel"
- .col-md-9
+ %section.col-md-9
.panel.panel-default
.panel-heading
Users (#{@users.total_count})
diff --git a/app/views/import/gitorious/status.html.haml b/app/views/import/gitorious/status.html.haml
index 35ed0a717de..8ede5c3e840 100644
--- a/app/views/import/gitorious/status.html.haml
+++ b/app/views/import/gitorious/status.html.haml
@@ -1,5 +1,5 @@
%h3.page-title
- %i.fa.fa-gitorious
+ %i.icon-gitorious.icon-gitorious-big
Import repositories from Gitorious.org
%p.light
diff --git a/app/views/layouts/_collapse_button.html.haml b/app/views/layouts/_collapse_button.html.haml
index b3b338b55bb..2ed51d87ca1 100644
--- a/app/views/layouts/_collapse_button.html.haml
+++ b/app/views/layouts/_collapse_button.html.haml
@@ -1,4 +1,4 @@
- if nav_menu_collapsed?
- = link_to icon('angle-right'), '#', class: 'toggle-nav-collapse'
+ = link_to icon('angle-right'), '#', class: 'toggle-nav-collapse', title: "Open/Close"
- else
- = link_to icon('angle-left'), '#', class: 'toggle-nav-collapse'
+ = link_to icon('angle-left'), '#', class: 'toggle-nav-collapse', title: "Open/Close"
diff --git a/app/views/layouts/_head_panel.html.haml b/app/views/layouts/_head_panel.html.haml
index d5928d2ed25..fc8a487ece7 100644
--- a/app/views/layouts/_head_panel.html.haml
+++ b/app/views/layouts/_head_panel.html.haml
@@ -3,7 +3,7 @@
.container
%div.app_logo
= link_to root_path, class: "home has_bottom_tooltip", title: "Dashboard" do
- %h1 GITLAB
+ = brand_header_logo
%h1.title= title
%button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", type: "button"}
diff --git a/app/views/layouts/_public_head_panel.html.haml b/app/views/layouts/_public_head_panel.html.haml
index e912fea2aee..bd6bb3c720d 100644
--- a/app/views/layouts/_public_head_panel.html.haml
+++ b/app/views/layouts/_public_head_panel.html.haml
@@ -2,10 +2,8 @@
.navbar-inner
.container
%div.app_logo
- %span.separator
= link_to explore_root_path, class: "home" do
- %h1 GITLAB
- %span.separator
+ = brand_header_logo
%h1.title= title
%button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", type: "button"}
diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml
index e8751a6987e..ab84e87c300 100644
--- a/app/views/layouts/admin.html.haml
+++ b/app/views/layouts/admin.html.haml
@@ -1,6 +1,6 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Admin area"
- %body{class: "#{app_theme} #{theme_type} admin", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} admin", :'data-page' => body_data_page}
= render "layouts/head_panel", title: link_to("Admin area", admin_root_path)
= render 'layouts/page', sidebar: 'layouts/nav/admin'
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 49123744ffa..6bd8ac4adb8 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -1,6 +1,6 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Dashboard"
- %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page }
+ %body{class: "#{app_theme} application", :'data-page' => body_data_page }
= render "layouts/head_panel", title: link_to("Dashboard", root_path)
= render 'layouts/page', sidebar: 'layouts/nav/dashboard'
diff --git a/app/views/layouts/errors.html.haml b/app/views/layouts/errors.html.haml
index e7d875173e6..e51fd4cb820 100644
--- a/app/views/layouts/errors.html.haml
+++ b/app/views/layouts/errors.html.haml
@@ -1,7 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Error"
- %body{class: "#{app_theme} #{theme_type} application"}
+ %body{class: "#{app_theme} application"}
= render "layouts/head_panel", title: "" if current_user
.container.navless-container
= render "layouts/flash"
diff --git a/app/views/layouts/explore.html.haml b/app/views/layouts/explore.html.haml
index 09855b222dc..2bd0b8d85c9 100644
--- a/app/views/layouts/explore.html.haml
+++ b/app/views/layouts/explore.html.haml
@@ -2,7 +2,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: page_title
- %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} application", :'data-page' => body_data_page}
= render "layouts/broadcast"
- if current_user
= render "layouts/head_panel", title: link_to(page_title, explore_root_path)
diff --git a/app/views/layouts/group.html.haml b/app/views/layouts/group.html.haml
index fa0ed317ce1..f4a6bee15f6 100644
--- a/app/views/layouts/group.html.haml
+++ b/app/views/layouts/group.html.haml
@@ -1,6 +1,6 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: group_head_title
- %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} application", :'data-page' => body_data_page}
= render "layouts/head_panel", title: link_to(@group.name, group_path(@group))
= render 'layouts/page', sidebar: 'layouts/nav/group'
diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml
index 15b489c7d99..ef31537b84e 100644
--- a/app/views/layouts/nav/_project.html.haml
+++ b/app/views/layouts/nav/_project.html.haml
@@ -2,7 +2,7 @@
- if @project_settings_nav
= nav_link do
= link_to namespace_project_path(@project.namespace, @project), title: 'Back to project', class: "" do
- %i.fa.fa-angle-left
+ %i.fa.fa-caret-square-o-left
%span
Back to project
diff --git a/app/views/layouts/navless.html.haml b/app/views/layouts/navless.html.haml
index a3b55542bf7..4d0278251a6 100644
--- a/app/views/layouts/navless.html.haml
+++ b/app/views/layouts/navless.html.haml
@@ -1,7 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: @title
- %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} application", :'data-page' => body_data_page}
= render "layouts/broadcast"
= render "layouts/head_panel", title: defined?(@title_url) ? link_to(@title, @title_url) : @title
.container.navless-container
diff --git a/app/views/layouts/profile.html.haml b/app/views/layouts/profile.html.haml
index 19d6efed78e..2b5be7fc372 100644
--- a/app/views/layouts/profile.html.haml
+++ b/app/views/layouts/profile.html.haml
@@ -1,6 +1,6 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Profile"
- %body{class: "#{app_theme} #{theme_type} profile", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} profile", :'data-page' => body_data_page}
= render "layouts/head_panel", title: link_to("Profile", profile_path)
= render 'layouts/page', sidebar: 'layouts/nav/profile'
diff --git a/app/views/layouts/project_settings.html.haml b/app/views/layouts/project_settings.html.haml
index d2c9c2a991c..0a0039dec16 100644
--- a/app/views/layouts/project_settings.html.haml
+++ b/app/views/layouts/project_settings.html.haml
@@ -1,7 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: @project.name_with_namespace
- %body{class: "#{app_theme} #{theme_type} project", :'data-page' => body_data_page, :'data-project-id' => @project.id }
+ %body{class: "#{app_theme} project", :'data-page' => body_data_page, :'data-project-id' => @project.id }
= render "layouts/head_panel", title: project_title(@project)
= render "layouts/init_auto_complete"
- @project_settings_nav = true
diff --git a/app/views/layouts/projects.html.haml b/app/views/layouts/projects.html.haml
index c44a40c9c12..dde0964f47f 100644
--- a/app/views/layouts/projects.html.haml
+++ b/app/views/layouts/projects.html.haml
@@ -1,7 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: project_head_title
- %body{class: "#{app_theme} #{theme_type} project", :'data-page' => body_data_page, :'data-project-id' => @project.id }
+ %body{class: "#{app_theme} project", :'data-page' => body_data_page, :'data-project-id' => @project.id }
= render "layouts/head_panel", title: project_title(@project)
= render "layouts/init_auto_complete"
= render 'layouts/page', sidebar: 'layouts/nav/project'
diff --git a/app/views/layouts/public_group.html.haml b/app/views/layouts/public_group.html.haml
index 4b69329b8fe..b9b1d03e08e 100644
--- a/app/views/layouts/public_group.html.haml
+++ b/app/views/layouts/public_group.html.haml
@@ -1,6 +1,6 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: group_head_title
- %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} application", :'data-page' => body_data_page}
= render "layouts/public_head_panel", title: link_to(@group.name, group_path(@group))
= render 'layouts/page', sidebar: 'layouts/nav/group'
diff --git a/app/views/layouts/public_projects.html.haml b/app/views/layouts/public_projects.html.haml
index 027e9a53139..04fa7c84e73 100644
--- a/app/views/layouts/public_projects.html.haml
+++ b/app/views/layouts/public_projects.html.haml
@@ -1,6 +1,6 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: @project.name_with_namespace
- %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} application", :'data-page' => body_data_page}
= render "layouts/public_head_panel", title: project_title(@project)
= render 'layouts/page', sidebar: 'layouts/nav/project'
diff --git a/app/views/layouts/public_users.html.haml b/app/views/layouts/public_users.html.haml
index 3538a8b1699..71c16bd1684 100644
--- a/app/views/layouts/public_users.html.haml
+++ b/app/views/layouts/public_users.html.haml
@@ -1,6 +1,6 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: @title
- %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} application", :'data-page' => body_data_page}
= render "layouts/public_head_panel", title: defined?(@title_url) ? link_to(@title, @title_url) : @title
= render 'layouts/page'
diff --git a/app/views/layouts/search.html.haml b/app/views/layouts/search.html.haml
index 177e2073a0d..f9d8db06e10 100644
--- a/app/views/layouts/search.html.haml
+++ b/app/views/layouts/search.html.haml
@@ -1,7 +1,7 @@
!!! 5
%html{ lang: "en"}
= render "layouts/head", title: "Search"
- %body{class: "#{app_theme} #{theme_type} application", :'data-page' => body_data_page}
+ %body{class: "#{app_theme} application", :'data-page' => body_data_page}
= render "layouts/broadcast"
= render "layouts/head_panel", title: link_to("Search", search_path)
.container.navless-container
diff --git a/app/views/projects/blob/edit.html.haml b/app/views/projects/blob/edit.html.haml
index 6884ad1f2f3..1f61a0b940c 100644
--- a/app/views/projects/blob/edit.html.haml
+++ b/app/views/projects/blob/edit.html.haml
@@ -14,6 +14,13 @@
= render 'projects/blob/editor', ref: @ref, path: @path, blob_data: @blob.data
= render 'shared/commit_message_container', params: params,
placeholder: "Update #{@blob.name}"
+
+ .form-group.branch
+ = label_tag 'branch', class: 'control-label' do
+ Branch
+ .col-sm-10
+ = text_field_tag 'new_branch', @ref, class: "form-control"
+
= hidden_field_tag 'last_commit', @last_commit
= hidden_field_tag 'content', '', id: "file-content"
= hidden_field_tag 'from_merge_request_id', params[:from_merge_request_id]
diff --git a/app/views/projects/blob/new.html.haml b/app/views/projects/blob/new.html.haml
index 45865d552ae..d78a01f6422 100644
--- a/app/views/projects/blob/new.html.haml
+++ b/app/views/projects/blob/new.html.haml
@@ -4,6 +4,13 @@
= render 'projects/blob/editor', ref: @ref
= render 'shared/commit_message_container', params: params,
placeholder: 'Add new file'
+
+ .form-group.branch
+ = label_tag 'branch', class: 'control-label' do
+ Branch
+ .col-sm-10
+ = text_field_tag 'new_branch', @ref, class: "form-control"
+
= hidden_field_tag 'content', '', id: 'file-content'
= render 'projects/commit_button', ref: @ref,
cancel_path: namespace_project_tree_path(@project.namespace, @project, @id)
diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml
index 5216f308110..b41d5f52d12 100644
--- a/app/views/projects/new.html.haml
+++ b/app/views/projects/new.html.haml
@@ -71,7 +71,7 @@
.col-sm-2
.col-sm-10
= link_to new_import_gitorious_path do
- %i.fa.fa-heart
+ %i.icon-gitorious.icon-gitorious-small
Import projects from Gitorious.org
%hr.prepend-botton-10
diff --git a/db/migrate/20150223022001_set_missing_last_activity_at.rb b/db/migrate/20150223022001_set_missing_last_activity_at.rb
new file mode 100644
index 00000000000..3a3adf18872
--- /dev/null
+++ b/db/migrate/20150223022001_set_missing_last_activity_at.rb
@@ -0,0 +1,9 @@
+class SetMissingLastActivityAt < ActiveRecord::Migration
+ def up
+ execute "UPDATE projects SET last_activity_at = updated_at WHERE last_activity_at IS NULL"
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e11a068c9c5..d34eab75085 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20150213121042) do
+ActiveRecord::Schema.define(version: 20150223022001) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -334,12 +334,12 @@ ActiveRecord::Schema.define(version: 20150213121042) do
t.string "import_url"
t.integer "visibility_level", default: 0, null: false
t.boolean "archived", default: false, null: false
- t.string "avatar"
t.string "import_status"
t.float "repository_size", default: 0.0
t.integer "star_count", default: 0, null: false
t.string "import_type"
t.string "import_source"
+ t.string "avatar"
end
add_index "projects", ["created_at", "id"], name: "index_projects_on_created_at_and_id", using: :btree
diff --git a/doc/update/6.x-or-7.x-to-7.8.md b/doc/update/6.x-or-7.x-to-7.8.md
index 5884312c47f..673d9253d62 100644
--- a/doc/update/6.x-or-7.x-to-7.8.md
+++ b/doc/update/6.x-or-7.x-to-7.8.md
@@ -179,7 +179,7 @@ sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
### Change Nginx settings
* HTTP setups: Make `/etc/nginx/sites-available/gitlab` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-8-stable/lib/support/nginx/gitlab but with your settings.
-* HTTPS setups: Make `/etc/nginx/sites-available/gitlab-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-8-stablef/lib/support/nginx/gitlab-ssl but with your settings.
+* HTTPS setups: Make `/etc/nginx/sites-available/gitlab-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-8-stable/lib/support/nginx/gitlab-ssl but with your settings.
* A new `location /uploads/` section has been added that needs to have the same content as the existing `location @gitlab` section.
## 9. Start application
diff --git a/doc/workflow/web_editor.md b/doc/workflow/web_editor.md
index bcadf5e8c0d..7fc8f96b9ec 100644
--- a/doc/workflow/web_editor.md
+++ b/doc/workflow/web_editor.md
@@ -10,7 +10,7 @@ to create the first file and open it in the web editor.
![web editor 1](web_editor/empty_project.png)
-Fill in a file name, some content, a commit message and press the commit button.
+Fill in a file name, some content, a commit message, branch name and press the commit button.
The file will be saved to the repository.
![web editor 2](web_editor/new_file.png)
@@ -21,6 +21,6 @@ viewing the file.
![web editor 3](web_editor/show_file.png)
Editing a file is almost the same as creating a new file,
-with as addition the ability to preview your changes in a separate tab.
+with as addition the ability to preview your changes in a separate tab. Also you can save your change to another branch by filling out field `branch`
![web editor 3](web_editor/edit_file.png)
diff --git a/doc/workflow/web_editor/edit_file.png b/doc/workflow/web_editor/edit_file.png
index 1522c50b62f..f480c69ac3e 100644
--- a/doc/workflow/web_editor/edit_file.png
+++ b/doc/workflow/web_editor/edit_file.png
Binary files differ
diff --git a/doc/workflow/web_editor/new_file.png b/doc/workflow/web_editor/new_file.png
index 80941f37cea..55ebd9e0257 100644
--- a/doc/workflow/web_editor/new_file.png
+++ b/doc/workflow/web_editor/new_file.png
Binary files differ
diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature
index ee8d0bffa9b..90b966dd645 100644
--- a/features/project/source/browse_files.feature
+++ b/features/project/source/browse_files.feature
@@ -34,6 +34,17 @@ Feature: Project Source Browse Files
Then I am redirected to the new file
And I should see its new content
+ @javascript
+ Scenario: I can create and commit file and specify new branch
+ Given I click on "new file" link in repo
+ And I edit code
+ And I fill the new file name
+ And I fill the commit message
+ And I fill the new branch name
+ And I click on "Commit Changes"
+ Then I am redirected to the new file on new branch
+ And I should see its new content
+
@javascript @tricky
Scenario: I can create file in empty repo
Given I own an empty project
@@ -83,6 +94,17 @@ Feature: Project Source Browse Files
Then I am redirected to the ".gitignore"
And I should see its new content
+ @javascript
+ Scenario: I can edit and commit file to new branch
+ Given I click on ".gitignore" file in repo
+ And I click button "Edit"
+ And I edit code
+ And I fill the commit message
+ And I fill the new branch name
+ And I click on "Commit Changes"
+ Then I am redirected to the ".gitignore" on new branch
+ And I should see its new content
+
@javascript @wip
Scenario: If I don't change the content of the file I see an error message
Given I click on ".gitignore" file in repo
diff --git a/features/steps/project/source/browse_files.rb b/features/steps/project/source/browse_files.rb
index 98d8a60e1a5..557555aee58 100644
--- a/features/steps/project/source/browse_files.rb
+++ b/features/steps/project/source/browse_files.rb
@@ -69,6 +69,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
fill_in :file_name, with: new_file_name
end
+ step 'I fill the new branch name' do
+ fill_in :new_branch, with: 'new_branch_name'
+ end
+
step 'I fill the new file name with an illegal name' do
fill_in :file_name, with: '.git'
end
@@ -148,6 +152,10 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
expect(current_path).to eq(namespace_project_blob_path(@project.namespace, @project, 'master/.gitignore'))
end
+ step 'I am redirected to the ".gitignore" on new branch' do
+ expect(current_path).to eq(namespace_project_blob_path(@project.namespace, @project, 'new_branch_name/.gitignore'))
+ end
+
step 'I am redirected to the permalink URL' do
expect(current_path).to(
eq(namespace_project_blob_path(@project.namespace, @project,
@@ -161,6 +169,11 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
@project.namespace, @project, 'master/' + new_file_name))
end
+ step 'I am redirected to the new file on new branch' do
+ expect(current_path).to eq(namespace_project_blob_path(
+ @project.namespace, @project, 'new_branch_name/' + new_file_name))
+ end
+
step "I don't see the permalink link" do
expect(page).not_to have_link('permalink')
end
@@ -177,7 +190,7 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
click_link 'add a file'
# Remove pre-receive hook so we can push without auth
- FileUtils.rm(File.join(@project.repository.path, 'hooks', 'pre-receive'))
+ FileUtils.rm_f(File.join(@project.repository.path, 'hooks', 'pre-receive'))
end
private
diff --git a/lib/gitlab/satellite/files/edit_file_action.rb b/lib/gitlab/satellite/files/edit_file_action.rb
index 82d71ab9906..3cb9c0b5ecb 100644
--- a/lib/gitlab/satellite/files/edit_file_action.rb
+++ b/lib/gitlab/satellite/files/edit_file_action.rb
@@ -10,7 +10,7 @@ module Gitlab
# Returns false if committing the change fails
# Returns false if pushing from the satellite to bare repo failed or was rejected
# Returns true otherwise
- def commit!(content, commit_message, encoding)
+ def commit!(content, commit_message, encoding, new_branch = nil)
in_locked_and_timed_satellite do |repo|
prepare_satellite!(repo)
@@ -42,10 +42,12 @@ module Gitlab
end
+ target_branch = new_branch.present? ? "#{ref}:#{new_branch}" : ref
+
# push commit back to bare repo
# will raise CommandFailed when push fails
begin
- repo.git.push({ raise: true, timeout: true }, :origin, ref)
+ repo.git.push({ raise: true, timeout: true }, :origin, target_branch)
rescue Grit::Git::CommandFailed => ex
log_and_raise(PushFailed, ex.message)
end
diff --git a/lib/gitlab/satellite/files/new_file_action.rb b/lib/gitlab/satellite/files/new_file_action.rb
index 69f7ffa94e4..724dfa0d042 100644
--- a/lib/gitlab/satellite/files/new_file_action.rb
+++ b/lib/gitlab/satellite/files/new_file_action.rb
@@ -9,7 +9,7 @@ module Gitlab
# Returns false if committing the change fails
# Returns false if pushing from the satellite to bare repo failed or was rejected
# Returns true otherwise
- def commit!(content, commit_message, encoding)
+ def commit!(content, commit_message, encoding, new_branch = nil)
in_locked_and_timed_satellite do |repo|
prepare_satellite!(repo)
@@ -45,9 +45,15 @@ module Gitlab
# will raise CommandFailed when commit fails
repo.git.commit(raise: true, timeout: true, a: true, m: commit_message)
+ target_branch = if new_branch.present? && !@project.empty_repo?
+ "#{ref}:#{new_branch}"
+ else
+ "#{current_ref}:#{ref}"
+ end
+
# push commit back to bare repo
# will raise CommandFailed when push fails
- repo.git.push({ raise: true, timeout: true }, :origin, "#{current_ref}:#{ref}")
+ repo.git.push({ raise: true, timeout: true }, :origin, target_branch)
# everything worked
true