diff options
61 files changed, 332 insertions, 210 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1322843b592..e6aa5559d99 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -139,6 +139,13 @@ stages: <<: *only-master-and-ee-or-mysql <<: *except-docs +.only-canonical-masters: &only-canonical-masters + only: + - master@gitlab-org/gitlab-ce + - master@gitlab-org/gitlab-ee + - master@gitlab/gitlabhq + - master@gitlab/gitlab-ee + # Trigger a package build on omnibus-gitlab repository build-package: @@ -168,17 +175,13 @@ knapsack: update-knapsack: <<: *knapsack-state <<: *dedicated-runner + <<: *only-canonical-masters stage: post-test script: - scripts/merge-reports ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/rspec_pg_node_*.json - scripts/merge-reports ${KNAPSACK_SPINACH_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/spinach_pg_node_*.json - '[[ -z ${KNAPSACK_S3_BUCKET} ]] || scripts/sync-reports put $KNAPSACK_S3_BUCKET $KNAPSACK_RSPEC_SUITE_REPORT_PATH $KNAPSACK_SPINACH_SUITE_REPORT_PATH' - rm -f knapsack/${CI_PROJECT_NAME}/*_node_*.json - only: - - master@gitlab-org/gitlab-ce - - master@gitlab-org/gitlab-ee - - master@gitlab/gitlabhq - - master@gitlab/gitlab-ee setup-test-env: <<: *use-pg @@ -197,76 +200,75 @@ setup-test-env: - public/assets - tmp/tests -rspec pg 0 20: *rspec-knapsack-pg -rspec pg 1 20: *rspec-knapsack-pg -rspec pg 2 20: *rspec-knapsack-pg -rspec pg 3 20: *rspec-knapsack-pg -rspec pg 4 20: *rspec-knapsack-pg -rspec pg 5 20: *rspec-knapsack-pg -rspec pg 6 20: *rspec-knapsack-pg -rspec pg 7 20: *rspec-knapsack-pg -rspec pg 8 20: *rspec-knapsack-pg -rspec pg 9 20: *rspec-knapsack-pg -rspec pg 10 20: *rspec-knapsack-pg -rspec pg 11 20: *rspec-knapsack-pg -rspec pg 12 20: *rspec-knapsack-pg -rspec pg 13 20: *rspec-knapsack-pg -rspec pg 14 20: *rspec-knapsack-pg -rspec pg 15 20: *rspec-knapsack-pg -rspec pg 16 20: *rspec-knapsack-pg -rspec pg 17 20: *rspec-knapsack-pg -rspec pg 18 20: *rspec-knapsack-pg -rspec pg 19 20: *rspec-knapsack-pg - -rspec mysql 0 20: *rspec-knapsack-mysql -rspec mysql 1 20: *rspec-knapsack-mysql -rspec mysql 2 20: *rspec-knapsack-mysql -rspec mysql 3 20: *rspec-knapsack-mysql -rspec mysql 4 20: *rspec-knapsack-mysql -rspec mysql 5 20: *rspec-knapsack-mysql -rspec mysql 6 20: *rspec-knapsack-mysql -rspec mysql 7 20: *rspec-knapsack-mysql -rspec mysql 8 20: *rspec-knapsack-mysql -rspec mysql 9 20: *rspec-knapsack-mysql -rspec mysql 10 20: *rspec-knapsack-mysql -rspec mysql 11 20: *rspec-knapsack-mysql -rspec mysql 12 20: *rspec-knapsack-mysql -rspec mysql 13 20: *rspec-knapsack-mysql -rspec mysql 14 20: *rspec-knapsack-mysql -rspec mysql 15 20: *rspec-knapsack-mysql -rspec mysql 16 20: *rspec-knapsack-mysql -rspec mysql 17 20: *rspec-knapsack-mysql -rspec mysql 18 20: *rspec-knapsack-mysql -rspec mysql 19 20: *rspec-knapsack-mysql - -spinach pg 0 10: *spinach-knapsack-pg -spinach pg 1 10: *spinach-knapsack-pg -spinach pg 2 10: *spinach-knapsack-pg -spinach pg 3 10: *spinach-knapsack-pg -spinach pg 4 10: *spinach-knapsack-pg -spinach pg 5 10: *spinach-knapsack-pg -spinach pg 6 10: *spinach-knapsack-pg -spinach pg 7 10: *spinach-knapsack-pg -spinach pg 8 10: *spinach-knapsack-pg -spinach pg 9 10: *spinach-knapsack-pg - -spinach mysql 0 10: *spinach-knapsack-mysql -spinach mysql 1 10: *spinach-knapsack-mysql -spinach mysql 2 10: *spinach-knapsack-mysql -spinach mysql 3 10: *spinach-knapsack-mysql -spinach mysql 4 10: *spinach-knapsack-mysql -spinach mysql 5 10: *spinach-knapsack-mysql -spinach mysql 6 10: *spinach-knapsack-mysql -spinach mysql 7 10: *spinach-knapsack-mysql -spinach mysql 8 10: *spinach-knapsack-mysql -spinach mysql 9 10: *spinach-knapsack-mysql - -# Other generic tests +rspec-pg 0 20: *rspec-knapsack-pg +rspec-pg 1 20: *rspec-knapsack-pg +rspec-pg 2 20: *rspec-knapsack-pg +rspec-pg 3 20: *rspec-knapsack-pg +rspec-pg 4 20: *rspec-knapsack-pg +rspec-pg 5 20: *rspec-knapsack-pg +rspec-pg 6 20: *rspec-knapsack-pg +rspec-pg 7 20: *rspec-knapsack-pg +rspec-pg 8 20: *rspec-knapsack-pg +rspec-pg 9 20: *rspec-knapsack-pg +rspec-pg 10 20: *rspec-knapsack-pg +rspec-pg 11 20: *rspec-knapsack-pg +rspec-pg 12 20: *rspec-knapsack-pg +rspec-pg 13 20: *rspec-knapsack-pg +rspec-pg 14 20: *rspec-knapsack-pg +rspec-pg 15 20: *rspec-knapsack-pg +rspec-pg 16 20: *rspec-knapsack-pg +rspec-pg 17 20: *rspec-knapsack-pg +rspec-pg 18 20: *rspec-knapsack-pg +rspec-pg 19 20: *rspec-knapsack-pg + +rspec-mysql 0 20: *rspec-knapsack-mysql +rspec-mysql 1 20: *rspec-knapsack-mysql +rspec-mysql 2 20: *rspec-knapsack-mysql +rspec-mysql 3 20: *rspec-knapsack-mysql +rspec-mysql 4 20: *rspec-knapsack-mysql +rspec-mysql 5 20: *rspec-knapsack-mysql +rspec-mysql 6 20: *rspec-knapsack-mysql +rspec-mysql 7 20: *rspec-knapsack-mysql +rspec-mysql 8 20: *rspec-knapsack-mysql +rspec-mysql 9 20: *rspec-knapsack-mysql +rspec-mysql 10 20: *rspec-knapsack-mysql +rspec-mysql 11 20: *rspec-knapsack-mysql +rspec-mysql 12 20: *rspec-knapsack-mysql +rspec-mysql 13 20: *rspec-knapsack-mysql +rspec-mysql 14 20: *rspec-knapsack-mysql +rspec-mysql 15 20: *rspec-knapsack-mysql +rspec-mysql 16 20: *rspec-knapsack-mysql +rspec-mysql 17 20: *rspec-knapsack-mysql +rspec-mysql 18 20: *rspec-knapsack-mysql +rspec-mysql 19 20: *rspec-knapsack-mysql + +spinach-pg 0 10: *spinach-knapsack-pg +spinach-pg 1 10: *spinach-knapsack-pg +spinach-pg 2 10: *spinach-knapsack-pg +spinach-pg 3 10: *spinach-knapsack-pg +spinach-pg 4 10: *spinach-knapsack-pg +spinach-pg 5 10: *spinach-knapsack-pg +spinach-pg 6 10: *spinach-knapsack-pg +spinach-pg 7 10: *spinach-knapsack-pg +spinach-pg 8 10: *spinach-knapsack-pg +spinach-pg 9 10: *spinach-knapsack-pg + +spinach-mysql 0 10: *spinach-knapsack-mysql +spinach-mysql 1 10: *spinach-knapsack-mysql +spinach-mysql 2 10: *spinach-knapsack-mysql +spinach-mysql 3 10: *spinach-knapsack-mysql +spinach-mysql 4 10: *spinach-knapsack-mysql +spinach-mysql 5 10: *spinach-knapsack-mysql +spinach-mysql 6 10: *spinach-knapsack-mysql +spinach-mysql 7 10: *spinach-knapsack-mysql +spinach-mysql 8 10: *spinach-knapsack-mysql +spinach-mysql 9 10: *spinach-knapsack-mysql + +# Static analysis jobs .ruby-static-analysis: &ruby-static-analysis variables: SIMPLECOV: "false" SETUP_DB: "false" - USE_BUNDLE_INSTALL: "true" .rake-exec: &rake-exec <<: *ruby-static-analysis @@ -331,6 +333,7 @@ ee_compat_check: paths: - ee_compat_check/patches/*.patch +# DB migration, rollback, and seed jobs .db-migrate-reset: &db-migrate-reset stage: test <<: *dedicated-runner @@ -338,14 +341,38 @@ ee_compat_check: script: - bundle exec rake db:migrate:reset -rake pg db:migrate:reset: +db:migrate:reset-pg: <<: *db-migrate-reset <<: *use-pg -rake mysql db:migrate:reset: +db:migrate:reset-mysql: <<: *db-migrate-reset <<: *use-mysql +.migration-paths: &migration-paths + stage: test + <<: *dedicated-runner + variables: + SETUP_DB: "false" + <<: *only-canonical-masters + script: + - git fetch origin v8.14.10 + - git checkout -f FETCH_HEAD + - bundle install $BUNDLE_INSTALL_FLAGS + - bundle exec rake db:drop db:create db:schema:load db:seed_fu + - git checkout $CI_COMMIT_SHA + - bundle install $BUNDLE_INSTALL_FLAGS + - . scripts/prepare_build.sh + - bundle exec rake db:migrate + +migration:path-pg: + <<: *migration-paths + <<: *use-pg + +migration:path-mysql: + <<: *migration-paths + <<: *use-mysql + .db-rollback: &db-rollback stage: test <<: *dedicated-runner @@ -354,11 +381,11 @@ rake mysql db:migrate:reset: - bundle exec rake db:rollback STEP=120 - bundle exec rake db:migrate -rake pg db:rollback: +db:rollback-pg: <<: *db-rollback <<: *use-pg -rake mysql db:rollback: +db:rollback-mysql: <<: *db-rollback <<: *use-mysql @@ -380,15 +407,16 @@ rake mysql db:rollback: paths: - log/development.log -rake pg db:seed_fu: +db:seed_fu-pg: <<: *db-seed_fu <<: *use-pg -rake mysql db:seed_fu: +db:seed_fu-mysql: <<: *db-seed_fu <<: *use-mysql -rake gitlab:assets:compile: +# Frontend-related jobs +gitlab:assets:compile: stage: test <<: *dedicated-runner <<: *except-docs @@ -409,7 +437,7 @@ rake gitlab:assets:compile: paths: - webpack-report/ -rake karma: +karma: stage: test <<: *use-pg <<: *dedicated-runner @@ -425,34 +453,6 @@ rake karma: paths: - coverage-javascript/ -.migration-paths: &migration-paths - stage: test - <<: *dedicated-runner - variables: - SETUP_DB: "false" - only: - - master@gitlab-org/gitlab-ce - - master@gitlab-org/gitlab-ee - - master@gitlab/gitlabhq - - master@gitlab/gitlab-ee - script: - - git fetch origin v8.14.10 - - git checkout -f FETCH_HEAD - - bundle install $BUNDLE_INSTALL_FLAGS - - bundle exec rake db:drop db:create db:schema:load db:seed_fu - - git checkout $CI_COMMIT_SHA - - bundle install $BUNDLE_INSTALL_FLAGS - - . scripts/prepare_build.sh - - bundle exec rake db:migrate - -migration pg paths: - <<: *migration-paths - <<: *use-pg - -migration mysql paths: - <<: *migration-paths - <<: *use-mysql - coverage: stage: post-test services: [] @@ -510,8 +510,8 @@ pages: <<: *dedicated-runner dependencies: - coverage - - rake karma - - rake gitlab:assets:compile + - karma + - gitlab:assets:compile - lint:javascript:report script: - mv public/ .public/ diff --git a/CHANGELOG.md b/CHANGELOG.md index a78234aded0..2843e3a3955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,6 @@ entry. ## 9.1.4 (2017-05-12) -- No changes. -- No changes. -- No changes. - Fix error on CI/CD Settings page related to invalid pipeline trigger. !10948 (dosuken123) - Sort the network graph both by commit date and topographically. !11057 - Fix cross referencing for private and internal projects. !11243 diff --git a/app/assets/javascripts/gl_form.js b/app/assets/javascripts/gl_form.js index 51822f21e66..dc9f114af99 100644 --- a/app/assets/javascripts/gl_form.js +++ b/app/assets/javascripts/gl_form.js @@ -7,9 +7,10 @@ import GfmAutoComplete from './gfm_auto_complete'; window.gl = window.gl || {}; -function GLForm(form) { +function GLForm(form, enableGFM = false) { this.form = form; this.textarea = this.form.find('textarea.js-gfm-input'); + this.enableGFM = enableGFM; // Before we start, we should clean up any previous data for this form this.destroy(); // Setup the form @@ -32,8 +33,14 @@ GLForm.prototype.setupForm = function() { this.form.addClass('gfm-form'); // remove notify commit author checkbox for non-commit notes gl.utils.disableButtonIfEmptyField(this.form.find('.js-note-text'), this.form.find('.js-comment-button, .js-note-new-discussion')); - - new GfmAutoComplete(gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources).setup(this.form.find('.js-gfm-input')); + new GfmAutoComplete(gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources).setup(this.form.find('.js-gfm-input'), { + emojis: true, + members: this.enableGFM, + issues: this.enableGFM, + milestones: this.enableGFM, + mergeRequests: this.enableGFM, + labels: this.enableGFM, + }); new DropzoneInput(this.form); autosize(this.textarea); } diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 8122e88a15a..e960f1e8018 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -27,7 +27,7 @@ const normalizeNewlines = function(str) { Notes.interval = null; - function Notes(notes_url, note_ids, last_fetched_at, view) { + function Notes(notes_url, note_ids, last_fetched_at, view, enableGFM = true) { this.updateTargetButtons = this.updateTargetButtons.bind(this); this.updateComment = this.updateComment.bind(this); this.visibilityChange = this.visibilityChange.bind(this); @@ -50,6 +50,7 @@ const normalizeNewlines = function(str) { this.notes_url = notes_url; this.note_ids = note_ids; + this.enableGFM = enableGFM; // Used to keep track of updated notes while people are editing things this.updatedNotesTrackingMap = {}; this.last_fetched_at = last_fetched_at; @@ -506,7 +507,7 @@ const normalizeNewlines = function(str) { Notes.prototype.setupNoteForm = function(form) { var textarea, key; - new gl.GLForm(form); + new gl.GLForm(form, this.enableGFM); textarea = form.find(".js-note-text"); key = [ "Note", diff --git a/app/assets/javascripts/users_select.js b/app/assets/javascripts/users_select.js index 1724ca86b61..aea3592c6ba 100644 --- a/app/assets/javascripts/users_select.js +++ b/app/assets/javascripts/users_select.js @@ -421,6 +421,15 @@ function UsersSelect(currentUser, els) { selected = $dropdown.closest('.selectbox').find("input[name='" + ($dropdown.data('field-name')) + "']").val(); return assignTo(selected); } + + // Automatically close dropdown after assignee is selected + // since CE has no multiple assignees + // EE does not have a max-select + if ($dropdown.data('max-select') && + getSelected().length === $dropdown.data('max-select')) { + // Close the dropdown + $dropdown.dropdown('toggle'); + } }, id: function (user) { return user.id; diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 9489bbddfc4..87721fbe2f5 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -42,6 +42,8 @@ class Projects::BlobController < Projects::ApplicationController environment_params = @repository.branch_exists?(@ref) ? { ref: @ref } : { commit: @commit } @environment = EnvironmentsFinder.new(@project, current_user, environment_params).execute.last + @last_commit = @repository.last_commit_for_path(@commit.id, @blob.path) + render 'show' end diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb index 3ce65b29b3c..f8eb8e00a5d 100644 --- a/app/controllers/projects/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -24,6 +24,8 @@ class Projects::TreeController < Projects::ApplicationController end end + @last_commit = @repository.last_commit_for_path(@commit.id, @tree.path) || @commit + respond_to do |format| format.html # Disable cache so browser history works diff --git a/app/models/blob.rb b/app/models/blob.rb index 5ae35d3ab08..8e25ba590c7 100644 --- a/app/models/blob.rb +++ b/app/models/blob.rb @@ -40,6 +40,7 @@ class Blob < SimpleDelegator BlobViewer::GitlabCiYml, BlobViewer::RouteMap, + BlobViewer::Readme, BlobViewer::License, BlobViewer::Contributing, BlobViewer::Changelog diff --git a/app/models/blob_viewer/auxiliary.rb b/app/models/blob_viewer/auxiliary.rb index cd6e596ed60..07a207730cf 100644 --- a/app/models/blob_viewer/auxiliary.rb +++ b/app/models/blob_viewer/auxiliary.rb @@ -2,11 +2,17 @@ module BlobViewer module Auxiliary extend ActiveSupport::Concern + include Gitlab::Allowable + included do self.loading_partial_name = 'loading_auxiliary' self.type = :auxiliary self.overridable_max_size = 100.kilobytes self.max_size = 100.kilobytes end + + def visible_to?(current_user) + true + end end end diff --git a/app/models/blob_viewer/readme.rb b/app/models/blob_viewer/readme.rb new file mode 100644 index 00000000000..75c373a03bb --- /dev/null +++ b/app/models/blob_viewer/readme.rb @@ -0,0 +1,14 @@ +module BlobViewer + class Readme < Base + include Auxiliary + include Static + + self.partial_name = 'readme' + self.file_types = %i(readme) + self.binary = false + + def visible_to?(current_user) + can?(current_user, :read_wiki, project) + end + end +end diff --git a/app/views/projects/blob/_auxiliary_viewer.html.haml b/app/views/projects/blob/_auxiliary_viewer.html.haml new file mode 100644 index 00000000000..9749afdc580 --- /dev/null +++ b/app/views/projects/blob/_auxiliary_viewer.html.haml @@ -0,0 +1,5 @@ +- blob = local_assigns.fetch(:blob) +- auxiliary_viewer = blob.auxiliary_viewer +- if auxiliary_viewer && auxiliary_viewer.render_error.nil? && auxiliary_viewer.visible_to?(current_user) + .well-segment.blob-auxiliary-viewer + = render 'projects/blob/viewer', viewer: auxiliary_viewer diff --git a/app/views/projects/blob/_blob.html.haml b/app/views/projects/blob/_blob.html.haml index 8af945ddb2c..8bd336269ff 100644 --- a/app/views/projects/blob/_blob.html.haml +++ b/app/views/projects/blob/_blob.html.haml @@ -3,13 +3,9 @@ .info-well.hidden-xs .well-segment %ul.blob-commit-info - - blob_commit = @repository.last_commit_for_path(@commit.id, blob.path) - = render blob_commit, project: @project, ref: @ref + = render 'projects/commits/commit', commit: @last_commit, project: @project, ref: @ref - - auxiliary_viewer = blob.auxiliary_viewer - - if auxiliary_viewer && !auxiliary_viewer.render_error - .well-segment.blob-auxiliary-viewer - = render 'projects/blob/viewer', viewer: auxiliary_viewer + = render "projects/blob/auxiliary_viewer", blob: blob #blob-content-holder.blob-content-holder %article.file-holder diff --git a/app/views/projects/blob/viewers/_readme.html.haml b/app/views/projects/blob/viewers/_readme.html.haml new file mode 100644 index 00000000000..334b33faf48 --- /dev/null +++ b/app/views/projects/blob/viewers/_readme.html.haml @@ -0,0 +1,4 @@ += icon('info-circle fw') += succeed '.' do + To learn more about this project, read + = link_to "the wiki", namespace_project_wikis_path(viewer.project.namespace, viewer.project) diff --git a/app/views/projects/merge_requests/show/_how_to_merge.html.haml b/app/views/projects/merge_requests/show/_how_to_merge.html.haml index f3372c7657f..766cb272bec 100644 --- a/app/views/projects/merge_requests/show/_how_to_merge.html.haml +++ b/app/views/projects/merge_requests/show/_how_to_merge.html.haml @@ -49,7 +49,7 @@ %strong Tip: = succeed '.' do You can also checkout merge requests locally by - = link_to 'following these guidelines', help_page_path('user/project/merge_requests.md', anchor: "checkout-merge-requests-locally"), target: '_blank', rel: 'noopener noreferrer' + = link_to 'following these guidelines', help_page_path('user/project/merge_requests/index.md', anchor: "checkout-merge-requests-locally"), target: '_blank', rel: 'noopener noreferrer' :javascript $(function(){ diff --git a/app/views/projects/tree/show.html.haml b/app/views/projects/tree/show.html.haml index b45a270db4e..b51955010ce 100644 --- a/app/views/projects/tree/show.html.haml +++ b/app/views/projects/tree/show.html.haml @@ -7,4 +7,4 @@ = render 'projects/last_push' %div{ class: container_class } - = render 'projects/files', commit: @commit, project: @project, ref: @ref + = render 'projects/files', commit: @last_commit, project: @project, ref: @ref diff --git a/app/views/shared/notes/_notes_with_form.html.haml b/app/views/shared/notes/_notes_with_form.html.haml index 9930cbd96d7..05bb1970e21 100644 --- a/app/views/shared/notes/_notes_with_form.html.haml +++ b/app/views/shared/notes/_notes_with_form.html.haml @@ -23,4 +23,4 @@ to post a comment :javascript - var notes = new Notes("#{notes_url}", #{@notes.map(&:id).to_json}, #{Time.now.to_i}, "#{diff_view}") + var notes = new Notes("#{notes_url}", #{@notes.map(&:id).to_json}, #{Time.now.to_i}, "#{diff_view}", false) diff --git a/changelogs/unreleased/32086-atwho-is-still-enabled-for-personal-snippet-comments-form.yml b/changelogs/unreleased/32086-atwho-is-still-enabled-for-personal-snippet-comments-form.yml new file mode 100644 index 00000000000..0fd248e0400 --- /dev/null +++ b/changelogs/unreleased/32086-atwho-is-still-enabled-for-personal-snippet-comments-form.yml @@ -0,0 +1,4 @@ +--- +title: Disable reference prefixes in notes for Snippets +merge_request: 11278 +author: diff --git a/changelogs/unreleased/dm-tree-last-commit.yml b/changelogs/unreleased/dm-tree-last-commit.yml new file mode 100644 index 00000000000..50619fd6ef2 --- /dev/null +++ b/changelogs/unreleased/dm-tree-last-commit.yml @@ -0,0 +1,4 @@ +--- +title: Show last commit for current tree on tree page +merge_request: +author: diff --git a/db/migrate/20170516153305_migrate_assignee_to_separate_table.rb b/db/migrate/20170516153305_migrate_assignee_to_separate_table.rb index f269ca7fc34..eed9f00d8b2 100644 --- a/db/migrate/20170516153305_migrate_assignee_to_separate_table.rb +++ b/db/migrate/20170516153305_migrate_assignee_to_separate_table.rb @@ -47,7 +47,7 @@ class MigrateAssigneeToSeparateTable < ActiveRecord::Migration RETURNS trigger AS $BODY$ BEGIN - if OLD.assignee_id IS NOT NULL THEN + if OLD IS NOT NULL AND OLD.assignee_id IS NOT NULL THEN DELETE FROM issue_assignees WHERE issue_id = OLD.id; END IF; diff --git a/db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb b/db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb index a44b399c4de..dae9750558f 100644 --- a/db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb +++ b/db/post_migrate/20170425121605_migrate_trigger_schedules_to_pipeline_schedules.rb @@ -4,6 +4,13 @@ class MigrateTriggerSchedulesToPipelineSchedules < ActiveRecord::Migration DOWNTIME = false def up + connection.execute <<~SQL + DELETE FROM ci_trigger_schedules WHERE NOT EXISTS + (SELECT true FROM projects + WHERE ci_trigger_schedules.project_id = projects.id + ) + SQL + connection.execute <<-SQL INSERT INTO ci_pipeline_schedules ( project_id, diff --git a/doc/administration/high_availability/README.md b/doc/administration/high_availability/README.md index d5a5aef7ec0..4d3be0ab8f6 100644 --- a/doc/administration/high_availability/README.md +++ b/doc/administration/high_availability/README.md @@ -5,6 +5,20 @@ The solution you choose will be based on the level of scalability and availability you require. The easiest solutions are scalable, but not necessarily highly available. +GitLab provides a service that is usually essential to most organizations: it +enables people to collaborate on code in a timely fashion. Any downtime should +therefore be short and planned. Luckily, GitLab provides a solid setup even on +a single server without special measures. Due to the distributed nature +of Git, developers can still commit code locally even when GitLab is not +available. However, some GitLab features such as the issue tracker and +Continuous Integration are not available when GitLab is down. + +**Keep in mind that all Highly Available solutions come with a trade-off between +cost/complexity and uptime**. The more uptime you want, the more complex the +solution. And the more complex the solution, the more work is involved in +setting up and maintaining it. High availability is not free and every HA +solution should balance the costs against the benefits. + ## Architecture There are two kinds of setups: @@ -37,6 +51,10 @@ Block Device) to keep all data in sync. DRBD requires a low latency link to remain in sync. It is not advisable to attempt to run DRBD between data centers or in different cloud availability zones. +> **Note:** GitLab recommends against choosing this HA method because of the + complexity of managing DRBD and crafting automatic failover. This is + *compatible* with GitLab, but not officially *supported*. + Components/Servers Required: 2 servers/virtual machines (one active/one passive) ![Active/Passive HA Diagram](../img/high_availability/active-passive-diagram.png) diff --git a/doc/administration/high_availability/nfs.md b/doc/administration/high_availability/nfs.md index c5125dc6d5a..d8e76d6ab94 100644 --- a/doc/administration/high_availability/nfs.md +++ b/doc/administration/high_availability/nfs.md @@ -7,6 +7,25 @@ supported natively in NFS version 4. NFSv3 also supports locking as long as Linux Kernel 2.6.5+ is used. We recommend using version 4 and do not specifically test NFSv3. +## AWS Elastic File System + +GitLab does not recommend using AWS Elastic File System (EFS). + +Customers and users have reported that AWS EFS does not perform well for GitLab's +use-case. There are several issues that can cause problems. For these reasons +GitLab does not recommend using EFS with GitLab. + +- EFS bases allowed IOPS on volume size. The larger the volume, the more IOPS + are allocated. For smaller volumes, users may experience decent performance + for a period of time due to 'Burst Credits'. Over a period of weeks to months + credits may run out and performance will bottom out. +- For larger volumes, allocated IOPS may not be the problem. Workloads where + many small files are written in a serialized manner are not well-suited for EFS. + EBS with an NFS server on top will perform much better. + +For more details on another person's experience with EFS, see +[Amazon's Elastic File System: Burst Credits](https://www.rawkode.io/2017/04/amazons-elastic-file-system-burst-credits/) + ### Recommended options When you define your NFS exports, we recommend you also add the following diff --git a/doc/api/award_emoji.md b/doc/api/award_emoji.md index 5f3adcc397a..d6924741ee4 100644 --- a/doc/api/award_emoji.md +++ b/doc/api/award_emoji.md @@ -1,4 +1,4 @@ -# Award Emoji +# Award Emoji API > [Introduced][ce-4575] in GitLab 8.9, Snippet support in 8.12 diff --git a/doc/api/boards.md b/doc/api/boards.md index 17d2be0ee16..69c47abc806 100644 --- a/doc/api/boards.md +++ b/doc/api/boards.md @@ -1,4 +1,4 @@ -# Boards +# Issue Boards API Every API call to boards must be authenticated. diff --git a/doc/api/branches.md b/doc/api/branches.md index 5717215deb6..325d0ea4ce3 100644 --- a/doc/api/branches.md +++ b/doc/api/branches.md @@ -1,4 +1,4 @@ -# Branches +# Branches API ## List repository branches diff --git a/doc/api/broadcast_messages.md b/doc/api/broadcast_messages.md index ad254e3515e..a8a248a17f4 100644 --- a/doc/api/broadcast_messages.md +++ b/doc/api/broadcast_messages.md @@ -1,4 +1,4 @@ -# Broadcast Messages +# Broadcast Messages API > **Note:** This feature was introduced in GitLab 8.12. diff --git a/doc/api/build_variables.md b/doc/api/build_variables.md index 9218902e84a..2aaf1c93705 100644 --- a/doc/api/build_variables.md +++ b/doc/api/build_variables.md @@ -1,4 +1,4 @@ -# Build Variables +# Build Variables API ## List project variables diff --git a/doc/api/ci/lint.md b/doc/api/ci/lint.md index 74def207816..6a4dca92cfe 100644 --- a/doc/api/ci/lint.md +++ b/doc/api/ci/lint.md @@ -1,4 +1,4 @@ -# Validate the .gitlab-ci.yml +# Validate the .gitlab-ci.yml (API) > [Introduced][ce-5953] in GitLab 8.12. diff --git a/doc/api/ci/runners.md b/doc/api/ci/runners.md index 16028d1f124..342c039dad8 100644 --- a/doc/api/ci/runners.md +++ b/doc/api/ci/runners.md @@ -1,4 +1,4 @@ -# Runners API +# Register and Delete Runners API API used by Runners to register and delete themselves. diff --git a/doc/api/deploy_key_multiple_projects.md b/doc/api/deploy_key_multiple_projects.md index f94dbfa4059..127f9a196de 100644 --- a/doc/api/deploy_key_multiple_projects.md +++ b/doc/api/deploy_key_multiple_projects.md @@ -1,4 +1,4 @@ -# Adding deploy keys to multiple projects +# Adding deploy keys to multiple projects via API If you want to easily add the same deploy key to multiple projects in the same group, this can be achieved quite easily with the API. diff --git a/doc/api/deploy_keys.md b/doc/api/deploy_keys.md index c3fe7f84ef2..4fa800ecb9c 100644 --- a/doc/api/deploy_keys.md +++ b/doc/api/deploy_keys.md @@ -1,4 +1,4 @@ -# Deploy Keys +# Deploy Keys API ## List all deploy keys diff --git a/doc/api/milestones.md b/doc/api/milestones.md index 7640eeb8d00..a082d548499 100644 --- a/doc/api/milestones.md +++ b/doc/api/milestones.md @@ -1,4 +1,4 @@ -# Milestones +# Milestones API ## List project milestones diff --git a/doc/api/namespaces.md b/doc/api/namespaces.md index eef06d5f324..4ad6071a0ed 100644 --- a/doc/api/namespaces.md +++ b/doc/api/namespaces.md @@ -1,4 +1,4 @@ -# Namespaces +# Namespaces API Usernames and groupnames fall under a special category called namespaces. diff --git a/doc/api/notes.md b/doc/api/notes.md index b71fea5fc9f..388e6989df2 100644 --- a/doc/api/notes.md +++ b/doc/api/notes.md @@ -1,4 +1,4 @@ -# Notes +# Notes API Notes are comments on snippets, issues or merge requests. diff --git a/doc/api/pipeline_triggers.md b/doc/api/pipeline_triggers.md index d639e8a0991..9030ae32d17 100644 --- a/doc/api/pipeline_triggers.md +++ b/doc/api/pipeline_triggers.md @@ -1,4 +1,4 @@ -# Pipeline triggers +# Pipeline triggers API You can read more about [triggering pipelines through the API](../ci/triggers/README.md). diff --git a/doc/api/projects.md b/doc/api/projects.md index 673cf02705d..6b919f71792 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -1,6 +1,5 @@ # Projects API - ### Project visibility level Project in GitLab has be either private, internal or public. @@ -17,8 +16,6 @@ Constants for project visibility levels are next: * `public`: The project can be cloned without any authentication. - - ## List projects Get a list of visible projects for authenticated user. When being accessed without authentication, all public projects are returned. diff --git a/doc/api/repositories.md b/doc/api/repositories.md index 859cbd63831..bccef924375 100644 --- a/doc/api/repositories.md +++ b/doc/api/repositories.md @@ -1,4 +1,4 @@ -# Repositories +# Repositories API ## List repository tree diff --git a/doc/api/repository_files.md b/doc/api/repository_files.md index aec91abd390..0b5782a8cc4 100644 --- a/doc/api/repository_files.md +++ b/doc/api/repository_files.md @@ -1,4 +1,4 @@ -# Repository files +# Repository files API **CRUD for repository files** diff --git a/doc/api/services.md b/doc/api/services.md index f77d15c2ea1..49b87a4228c 100644 --- a/doc/api/services.md +++ b/doc/api/services.md @@ -1,4 +1,4 @@ -# Services +# Services API ## Asana diff --git a/doc/api/session.md b/doc/api/session.md index 056cc32597c..7dd504b67c5 100644 --- a/doc/api/session.md +++ b/doc/api/session.md @@ -1,4 +1,4 @@ -# Session +# Session API ## Deprecation Notice diff --git a/doc/api/sidekiq_metrics.md b/doc/api/sidekiq_metrics.md index ea10a26bcd0..b9500916cf2 100644 --- a/doc/api/sidekiq_metrics.md +++ b/doc/api/sidekiq_metrics.md @@ -1,4 +1,4 @@ -# Sidekiq Metrics +# Sidekiq Metrics API >**Note:** This endpoint is only available on GitLab 8.9 and above. diff --git a/doc/api/system_hooks.md b/doc/api/system_hooks.md index bad380794c1..9750475f0a6 100644 --- a/doc/api/system_hooks.md +++ b/doc/api/system_hooks.md @@ -1,4 +1,4 @@ -# System hooks +# System hooks API All methods require administrator authorization. diff --git a/doc/api/tags.md b/doc/api/tags.md index 0f6c4e6794e..54f092d1d30 100644 --- a/doc/api/tags.md +++ b/doc/api/tags.md @@ -1,4 +1,4 @@ -# Tags +# Tags API ## List project repository tags diff --git a/doc/api/templates/gitignores.md b/doc/api/templates/gitignores.md index 3f2f4ed54e0..d3f5c88ca90 100644 --- a/doc/api/templates/gitignores.md +++ b/doc/api/templates/gitignores.md @@ -1,4 +1,4 @@ -# Gitignores +# Gitignores API ## List gitignore templates diff --git a/doc/api/templates/gitlab_ci_ymls.md b/doc/api/templates/gitlab_ci_ymls.md index 27e8973da58..bdb128fc336 100644 --- a/doc/api/templates/gitlab_ci_ymls.md +++ b/doc/api/templates/gitlab_ci_ymls.md @@ -1,4 +1,4 @@ -# GitLab CI YMLs +# GitLab CI YMLs API ## List GitLab CI YML templates diff --git a/doc/api/templates/licenses.md b/doc/api/templates/licenses.md index 33018f0c53f..8d1006e08c5 100644 --- a/doc/api/templates/licenses.md +++ b/doc/api/templates/licenses.md @@ -1,4 +1,4 @@ -# Licenses +# Licenses API ## List license templates diff --git a/doc/api/v3_to_v4.md b/doc/api/v3_to_v4.md index 8e002fe0022..15a5b7a5290 100644 --- a/doc/api/v3_to_v4.md +++ b/doc/api/v3_to_v4.md @@ -1,4 +1,4 @@ -# V3 to V4 version +# API V3 to API V4 Since GitLab 9.0, API V4 is the preferred version to be used. diff --git a/doc/ci/README.md b/doc/ci/README.md index c4f9a3cb573..86de0ee9043 100644 --- a/doc/ci/README.md +++ b/doc/ci/README.md @@ -108,6 +108,7 @@ Here is an collection of tutorials and guides on setting up your CI pipeline. - [Scala](examples/test-scala-application.md) - [Phoenix](examples/test-phoenix-application.md) - [Run PHP Composer & NPM scripts then deploy them to a staging server](examples/deployment/composer-npm-deploy.md) + - [Analyze code quality with the Code Climate CLI](examples/code_climate.md) - **Blog posts** - [Automated Debian packaging](https://about.gitlab.com/2016/10/12/automated-debian-package-build-with-gitlab-ci/) - [Spring boot application with GitLab CI and Kubernetes](https://about.gitlab.com/2016/12/14/continuous-delivery-of-a-spring-boot-application-with-gitlab-ci-and-kubernetes/) diff --git a/doc/ci/api/README.md b/doc/ci/api/README.md index 4ca8d92d7cc..98f37935427 100644 --- a/doc/ci/api/README.md +++ b/doc/ci/api/README.md @@ -1,3 +1 @@ -# GitLab CI API - This document was moved to a [new location](../../api/ci/README.md). diff --git a/doc/ci/api/builds.md b/doc/ci/api/builds.md index f5bd3181c02..0563a367609 100644 --- a/doc/ci/api/builds.md +++ b/doc/ci/api/builds.md @@ -1,3 +1 @@ -# Builds API - This document was moved to a [new location](../../api/ci/builds.md). diff --git a/doc/ci/api/runners.md b/doc/ci/api/runners.md index b14ea99db76..1027363851c 100644 --- a/doc/ci/api/runners.md +++ b/doc/ci/api/runners.md @@ -1,3 +1 @@ -# Runners API - This document was moved to a [new location](../../api/ci/runners.md). diff --git a/doc/ci/examples/README.md b/doc/ci/examples/README.md index 33c27b39a8a..2458cb959ab 100644 --- a/doc/ci/examples/README.md +++ b/doc/ci/examples/README.md @@ -55,6 +55,7 @@ Apart from those, here is an collection of tutorials and guides on setting up yo - [Using `dpl` as deployment tool](deployment/README.md) - [Repositories with examples for various languages](https://gitlab.com/groups/gitlab-examples) - [The .gitlab-ci.yml file for GitLab itself](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/.gitlab-ci.yml) +- [Analyze code quality with the Code Climate CLI](code_climate.md) - **Articles:** - [Continuous Deployment with GitLab: how to build and deploy a Debian Package with GitLab CI](https://about.gitlab.com/2016/10/12/automated-debian-package-build-with-gitlab-ci/) diff --git a/doc/ci/examples/code_climate.md b/doc/ci/examples/code_climate.md new file mode 100644 index 00000000000..bd53f80ce14 --- /dev/null +++ b/doc/ci/examples/code_climate.md @@ -0,0 +1,28 @@ +# Analyze project code quality with Code Climate CLI + +This example shows how to run [Code Climate CLI][cli] on your code by using\ +GitLab CI and Docker. + +First, you need GitLab Runner with [docker-in-docker executor](../docker/using_docker_build.md#use-docker-in-docker-executor). + +Once you setup the Runner add new job to `.gitlab-ci.yml`: + +```yaml +codeclimate: + image: docker:latest + variables: + DOCKER_DRIVER: overlay + services: + - docker:dind + script: + - docker pull codeclimate/codeclimate + - docker run --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate init + - docker run --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate analyze -f json > codeclimate.json + artifacts: + paths: [codeclimate.json] +``` + +This will create a `codeclimate` job in your CI pipeline and will allow you to +download and analyze the report artifact in JSON format. + +[cli]: https://github.com/codeclimate/codeclimate diff --git a/doc/university/high-availability/aws/README.md b/doc/university/high-availability/aws/README.md index 088f1cd7290..6b8f3cd3d1d 100644 --- a/doc/university/high-availability/aws/README.md +++ b/doc/university/high-availability/aws/README.md @@ -159,19 +159,21 @@ subnet and security group and *** -## Elastic File System +## Network File System -This new AWS offering allows us to create a file system accessible by
-EC2 instances within a VPC. Choose our VPC and the subnets will be -
automatically configured assuming we don't need to set explicit IPs. -The
next section allows us to add tags and choose between General -Purpose or
Max I/O which is a good option when being accessed by a -large number of
EC2 instances. +GitLab requires a shared filesystem such as NFS. The file share(s) will be +mounted on all application servers. There are a variety of ways to build an +NFS server on AWS. -
![Elastic File System](img/elastic-file-system.png) +One option is to use a third-party AMI that offers NFS as a service. A [search +for 'NFS' in the AWS Marketplace](https://aws.amazon.com/marketplace/search/results?x=0&y=0&searchTerms=NFS&page=1&ref_=nav_search_box) +shows options such as NetApp, SoftNAS and others. -To actually mount and install the NFS client we'll use the User Data -section when adding our Launch Configuration. +Another option is to build a simple NFS server using a vanilla Linux server backed +by AWS Elastic Block Storage (EBS). + +> **Note:** GitLab does not recommend using AWS Elastic File System (EFS). See + details in [High Availability NFS documentation](../../../administration/high_availability/nfs.md#aws-elastic-file-system) *** diff --git a/lib/gitlab/ee_compat_check.rb b/lib/gitlab/ee_compat_check.rb index 198896220ac..38e27513281 100644 --- a/lib/gitlab/ee_compat_check.rb +++ b/lib/gitlab/ee_compat_check.rb @@ -131,7 +131,7 @@ module Gitlab def check_patch(patch_path) step("Checking out master", %w[git checkout master]) step("Resetting to latest master", %w[git reset --hard origin/master]) - step("Fetching CE/#{branch}", %W[git fetch #{CE_REPO} #{branch}]) + step("Fetching CE/#{ce_branch}", %W[git fetch #{CE_REPO} #{ce_branch}]) step( "Checking if #{patch_path} applies cleanly to EE/master", %W[git apply --check --3way #{patch_path}] diff --git a/scripts/prepare_build.sh b/scripts/prepare_build.sh index c727a0e2d88..03de59f27ad 100644 --- a/scripts/prepare_build.sh +++ b/scripts/prepare_build.sh @@ -4,9 +4,22 @@ export SETUP_DB=${SETUP_DB:-true} export USE_BUNDLE_INSTALL=${USE_BUNDLE_INSTALL:-true} export BUNDLE_INSTALL_FLAGS="--without production --jobs $(nproc) --path vendor --retry 3 --quiet" +if [ "$USE_BUNDLE_INSTALL" != "false" ]; then + bundle install --clean $BUNDLE_INSTALL_FLAGS && bundle check +fi + +# Only install knapsack after bundle install! Otherwise oddly some native +# gems could not be found under some circumstance. No idea why, hours wasted. +retry gem install knapsack fog-aws mime-types + +cp config/resque.yml.example config/resque.yml +sed -i 's/localhost/redis/g' config/resque.yml + +cp config/gitlab.yml.example config/gitlab.yml + # Determine the database by looking at the job name. -# For example, we'll get pg if the job is `rspec pg 19 20` -export GITLAB_DATABASE=$(echo $CI_JOB_NAME | cut -f2 -d' ') +# For example, we'll get pg if the job is `rspec-pg 19 20` +export GITLAB_DATABASE=$(echo $CI_JOB_NAME | cut -f1 -d' ' | cut -f2 -d-) # This would make the default database postgresql, and we could also use # pg to mean postgresql. @@ -24,19 +37,6 @@ else # Assume it's mysql sed -i 's/# host:.*/host: mysql/g' config/database.yml fi -cp config/resque.yml.example config/resque.yml -sed -i 's/localhost/redis/g' config/resque.yml - -cp config/gitlab.yml.example config/gitlab.yml - -if [ "$USE_BUNDLE_INSTALL" != "false" ]; then - bundle install --clean $BUNDLE_INSTALL_FLAGS && bundle check -fi - -# Only install knapsack after bundle install! Otherwise oddly some native -# gems could not be found under some circumstance. No idea why, hours wasted. -retry gem install knapsack fog-aws mime-types - if [ "$SETUP_DB" != "false" ]; then bundle exec rake db:drop db:create db:schema:load db:migrate diff --git a/spec/features/boards/sidebar_spec.rb b/spec/features/boards/sidebar_spec.rb index 1238647d3f3..4667be49fe6 100644 --- a/spec/features/boards/sidebar_spec.rb +++ b/spec/features/boards/sidebar_spec.rb @@ -115,7 +115,6 @@ describe 'Issue Boards', feature: true, js: true do click_link 'Unassigned' end - find('.dropdown-menu-toggle').click wait_for_vue_resource expect(page).to have_content('No assignee') diff --git a/spec/features/issues/form_spec.rb b/spec/features/issues/form_spec.rb index 095cbb65c16..5c0907e26df 100644 --- a/spec/features/issues/form_spec.rb +++ b/spec/features/issues/form_spec.rb @@ -24,10 +24,10 @@ describe 'New/edit issue', :feature, :js do visit new_namespace_project_issue_path(project.namespace, project) end - describe 'multiple assignees' do + describe 'single assignee' do before do click_button 'Unassigned' - + wait_for_ajax end @@ -36,14 +36,12 @@ describe 'New/edit issue', :feature, :js do click_link user2.name end + click_button user2.name + page.within '.dropdown-menu-user' do click_link 'Unassigned' end - page.within '.js-assignee-search' do - expect(page).to have_content 'Unassigned' - end - expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match('0') end @@ -54,11 +52,13 @@ describe 'New/edit issue', :feature, :js do expect(find('a', text: 'Assign to me', visible: false)).not_to be_visible - page.within '.dropdown-menu-user' do + click_button user.name + + page.within('.dropdown-menu-user') do click_link user.name end - expect(find('a', text: 'Assign to me')).to be_visible + expect(page.find('.dropdown-menu-user', visible: false)).not_to be_visible end end @@ -154,25 +154,21 @@ describe 'New/edit issue', :feature, :js do it 'correctly updates the selected user when changing assignee' do click_button 'Unassigned' - + wait_for_ajax page.within '.dropdown-menu-user' do click_link user.name end - expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match(user.id.to_s) - expect(find('.dropdown-menu-user a.is-active').first(:xpath, '..')['data-user-id']).to eq(user.id.to_s) - # check the ::before pseudo element to ensure checkmark icon is present - expect(before_for_selector('.dropdown-menu-selectable a.is-active')).not_to eq('') - expect(before_for_selector('.dropdown-menu-selectable a:not(.is-active)')).to eq('') + expect(find('.js-assignee-search')).to have_content(user.name) + click_button user.name page.within '.dropdown-menu-user' do click_link user2.name end - expect(find('input[name="issue[assignee_ids][]"]', visible: false).value).to match(user2.id.to_s) - expect(find('.dropdown-menu-user a.is-active').first(:xpath, '..')['data-user-id']).to eq(user2.id.to_s) + expect(find('.js-assignee-search')).to have_content(user2.name) end end diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index fdd78600a1d..da369a6f111 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -465,8 +465,6 @@ describe 'Issues', feature: true do click_link 'Edit' click_link @user.name - find('.dropdown-menu-toggle').click - page.within '.value .author' do expect(page).to have_content @user.name end @@ -474,8 +472,6 @@ describe 'Issues', feature: true do click_link 'Edit' click_link @user.name - find('.dropdown-menu-toggle').click - page.within '.value .assign-yourself' do expect(page).to have_content "No assignee" end diff --git a/spec/features/projects/files/browse_files_spec.rb b/spec/features/projects/files/browse_files_spec.rb index 70e96efd557..4166aec1956 100644 --- a/spec/features/projects/files/browse_files_spec.rb +++ b/spec/features/projects/files/browse_files_spec.rb @@ -31,4 +31,16 @@ feature 'user browses project', feature: true, js: true do expect(page).to have_content 'oid sha256:91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897' expect(page).to have_content 'size 1575078' end + + scenario 'can see last commit for current directory' do + last_commit = project.repository.last_commit_for_path(project.default_branch, 'files') + + click_link 'files' + wait_for_ajax + + page.within('.blob-commit-info') do + expect(page).to have_content last_commit.short_id + expect(page).to have_content last_commit.author_name + end + end end diff --git a/spec/views/projects/tree/show.html.haml_spec.rb b/spec/views/projects/tree/show.html.haml_spec.rb index 835a93e620e..33eba3e6d3d 100644 --- a/spec/views/projects/tree/show.html.haml_spec.rb +++ b/spec/views/projects/tree/show.html.haml_spec.rb @@ -21,11 +21,11 @@ describe 'projects/tree/show' do let(:tree) { repository.tree(commit.id, path) } before do + assign(:id, File.join(ref, path)) assign(:ref, ref) - assign(:commit, commit) - assign(:id, commit.id) - assign(:tree, tree) assign(:path, path) + assign(:last_commit, commit) + assign(:tree, tree) end it 'displays correctly' do |