summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.pkgr.yml6
-rw-r--r--.travis.yml36
-rw-r--r--CHANGELOG48
-rw-r--r--CONTRIBUTING.md1
-rw-r--r--GITLAB_SHELL_VERSION2
-rw-r--r--Gemfile12
-rw-r--r--Gemfile.lock45
-rw-r--r--Guardfile4
-rw-r--r--PROCESS.md2
-rw-r--r--README.md33
-rw-r--r--VERSION2
-rw-r--r--app/assets/javascripts/application.js.coffee30
-rw-r--r--app/assets/javascripts/behaviors/toggle_diff_line_wrap_behavior.coffee14
-rw-r--r--app/assets/javascripts/branch-graph.js.coffee37
-rw-r--r--app/assets/javascripts/diff.js.coffee3
-rw-r--r--app/assets/javascripts/dispatcher.js.coffee48
-rw-r--r--app/assets/javascripts/issues.js.coffee40
-rw-r--r--app/assets/javascripts/labels.js.coffee2
-rw-r--r--app/assets/javascripts/markdown_area.js.coffee2
-rw-r--r--app/assets/javascripts/network.js.coffee6
-rw-r--r--app/assets/javascripts/notes.js.coffee65
-rw-r--r--app/assets/javascripts/project.js.coffee2
-rw-r--r--app/assets/javascripts/shortcuts.js.coffee25
-rw-r--r--app/assets/javascripts/shortcuts_dashboard_navigation.js.coffee14
-rw-r--r--app/assets/javascripts/shortcuts_issueable.coffee19
-rw-r--r--app/assets/javascripts/shortcuts_navigation.coffee20
-rw-r--r--app/assets/javascripts/shortcuts_network.js.coffee12
-rw-r--r--app/assets/javascripts/zen_mode.js.coffee51
-rw-r--r--app/assets/stylesheets/generic/common.scss2
-rw-r--r--app/assets/stylesheets/generic/forms.scss137
-rw-r--r--app/assets/stylesheets/generic/issue_box.scss4
-rw-r--r--app/assets/stylesheets/generic/lists.scss2
-rw-r--r--app/assets/stylesheets/generic/timeline.scss77
-rw-r--r--app/assets/stylesheets/generic/typography.scss4
-rw-r--r--app/assets/stylesheets/main/layout.scss1
-rw-r--r--app/assets/stylesheets/main/variables.scss4
-rw-r--r--app/assets/stylesheets/sections/dashboard.scss14
-rw-r--r--app/assets/stylesheets/sections/diff.scss11
-rw-r--r--app/assets/stylesheets/sections/help.scss53
-rw-r--r--app/assets/stylesheets/sections/login.scss21
-rw-r--r--app/assets/stylesheets/sections/nav.scss25
-rw-r--r--app/assets/stylesheets/sections/notes.scss27
-rw-r--r--app/assets/stylesheets/sections/projects.scss70
-rw-r--r--app/assets/stylesheets/sections/search.scss7
-rw-r--r--app/controllers/projects/branches_controller.rb14
-rw-r--r--app/controllers/projects/edit_tree_controller.rb2
-rw-r--r--app/controllers/projects/issues_controller.rb2
-rw-r--r--app/controllers/projects/labels_controller.rb2
-rw-r--r--app/controllers/projects/notes_controller.rb12
-rw-r--r--app/controllers/projects/raw_controller.rb6
-rw-r--r--app/controllers/projects/snippets_controller.rb2
-rw-r--r--app/controllers/projects/tags_controller.rb16
-rw-r--r--app/controllers/projects_controller.rb10
-rw-r--r--app/controllers/search_controller.rb31
-rw-r--r--app/controllers/snippets_controller.rb2
-rw-r--r--app/finders/issuable_finder.rb (renamed from app/finders/base_finder.rb)6
-rw-r--r--app/finders/issues_finder.rb2
-rw-r--r--app/finders/merge_requests_finder.rb2
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/helpers/commits_helper.rb124
-rw-r--r--app/helpers/diff_helper.rb88
-rw-r--r--app/helpers/events_helper.rb6
-rw-r--r--app/helpers/labels_helper.rb14
-rw-r--r--app/helpers/projects_helper.rb10
-rw-r--r--app/helpers/search_helper.rb17
-rw-r--r--app/models/concerns/issuable.rb8
-rw-r--r--app/models/issue.rb1
-rw-r--r--app/models/key.rb10
-rw-r--r--app/models/label.rb18
-rw-r--r--app/models/label_link.rb12
-rw-r--r--app/models/merge_request.rb1
-rw-r--r--app/models/merge_request_diff.rb2
-rw-r--r--app/models/network/graph.rb6
-rw-r--r--app/models/note.rb78
-rw-r--r--app/models/project.rb32
-rw-r--r--app/models/project_services/assembla_service.rb8
-rw-r--r--app/models/project_services/campfire_service.rb8
-rw-r--r--app/models/project_services/ci_service.rb14
-rw-r--r--app/models/project_services/emails_on_push_service.rb8
-rw-r--r--app/models/project_services/flowdock_service.rb8
-rw-r--r--app/models/project_services/gemnasium_service.rb8
-rw-r--r--app/models/project_services/gitlab_ci_service.rb8
-rw-r--r--app/models/project_services/hipchat_service.rb8
-rw-r--r--app/models/project_services/pivotaltracker_service.rb8
-rw-r--r--app/models/project_services/slack_service.rb8
-rw-r--r--app/models/project_wiki.rb5
-rw-r--r--app/models/repository.rb4
-rw-r--r--app/models/service.rb32
-rw-r--r--app/models/snippet.rb14
-rw-r--r--app/models/user.rb4
-rw-r--r--app/models/users_star_project.rb10
-rw-r--r--app/models/web_hook.rb2
-rw-r--r--app/services/compare_service.rb4
-rw-r--r--app/services/create_branch_service.rb27
-rw-r--r--app/services/create_tag_service.rb35
-rw-r--r--app/services/delete_branch_service.rb11
-rw-r--r--app/services/projects/fork_service.rb7
-rw-r--r--app/services/search/global_service.rb20
-rw-r--r--app/services/search/project_service.rb36
-rw-r--r--app/services/search/snippet_service.rb14
-rw-r--r--app/services/system_hooks_service.rb10
-rw-r--r--app/views/admin/dashboard/index.html.haml2
-rw-r--r--app/views/admin/users/show.html.haml8
-rw-r--r--app/views/dashboard/_groups.html.haml7
-rw-r--r--app/views/dashboard/_projects.html.haml7
-rwxr-xr-xapp/views/devise/confirmations/new.html.haml10
-rw-r--r--app/views/devise/passwords/edit.html.haml10
-rwxr-xr-xapp/views/devise/passwords/new.html.haml10
-rw-r--r--app/views/devise/registrations/new.html.haml10
-rw-r--r--app/views/devise/sessions/_new_base.html.haml6
-rw-r--r--app/views/devise/sessions/_oauth_providers.html.haml3
-rw-r--r--app/views/devise/sessions/new.html.haml10
-rw-r--r--app/views/events/_event_issue.atom.haml4
-rw-r--r--app/views/events/_event_merge_request.atom.haml2
-rw-r--r--app/views/events/_event_note.atom.haml4
-rw-r--r--app/views/explore/projects/_project.html.haml28
-rw-r--r--app/views/help/_shortcuts.html.haml229
-rw-r--r--app/views/help/index.html.haml4
-rw-r--r--app/views/layouts/_search.html.haml9
-rw-r--r--app/views/layouts/devise.html.haml2
-rw-r--r--app/views/layouts/nav/_dashboard.html.haml8
-rw-r--r--app/views/layouts/nav/_project.html.haml23
-rw-r--r--app/views/notify/_reassigned_issuable_email.html.haml10
-rw-r--r--app/views/notify/_reassigned_issuable_email.text.erb6
-rw-r--r--app/views/notify/project_was_moved_email.html.haml2
-rw-r--r--app/views/notify/reassigned_issue_email.html.haml12
-rw-r--r--app/views/notify/reassigned_issue_email.text.erb6
-rw-r--r--app/views/notify/reassigned_merge_request_email.html.haml8
-rw-r--r--app/views/notify/reassigned_merge_request_email.text.erb8
-rw-r--r--app/views/projects/_home_panel.html.haml76
-rw-r--r--app/views/projects/_issuable_form.html.haml43
-rw-r--r--app/views/projects/blame/show.html.haml11
-rw-r--r--app/views/projects/blob/_actions.html.haml3
-rw-r--r--app/views/projects/blob/_remove.html.haml5
-rw-r--r--app/views/projects/blob/diff.html.haml4
-rw-r--r--app/views/projects/branches/_branch.html.haml2
-rw-r--r--app/views/projects/branches/destroy.js.haml4
-rw-r--r--app/views/projects/branches/new.html.haml8
-rw-r--r--app/views/projects/commit/show.html.haml2
-rw-r--r--app/views/projects/commits/_diff_file.html.haml44
-rw-r--r--app/views/projects/commits/_diffs.html.haml23
-rw-r--r--app/views/projects/commits/_head.html.haml2
-rw-r--r--app/views/projects/commits/_parallel_view.html.haml38
-rw-r--r--app/views/projects/compare/show.html.haml2
-rw-r--r--app/views/projects/diffs/_diffs.html.haml27
-rw-r--r--app/views/projects/diffs/_file.html.haml48
-rw-r--r--app/views/projects/diffs/_image.html.haml (renamed from app/views/projects/commits/_image.html.haml)1
-rw-r--r--app/views/projects/diffs/_match_line.html.haml (renamed from app/views/projects/commits/diffs/_match_line.html.haml)0
-rw-r--r--app/views/projects/diffs/_match_line_parallel.html.haml4
-rw-r--r--app/views/projects/diffs/_parallel_view.html.haml27
-rw-r--r--app/views/projects/diffs/_stats.html.haml (renamed from app/views/projects/commits/_diff_stats.html.haml)2
-rw-r--r--app/views/projects/diffs/_text_file.html.haml (renamed from app/views/projects/commits/_text_file.html.haml)25
-rw-r--r--app/views/projects/diffs/_warning.html.haml (renamed from app/views/projects/commits/_diff_warning.html.haml)2
-rw-r--r--app/views/projects/edit.html.haml2
-rw-r--r--app/views/projects/edit_tree/_diff.html.haml13
-rw-r--r--app/views/projects/edit_tree/preview.html.haml15
-rw-r--r--app/views/projects/edit_tree/show.html.haml1
-rw-r--r--app/views/projects/empty.html.haml2
-rw-r--r--app/views/projects/import.html.haml4
-rw-r--r--app/views/projects/issues/_form.html.haml32
-rw-r--r--app/views/projects/issues/_head.html.haml2
-rw-r--r--app/views/projects/issues/_issue.html.haml5
-rw-r--r--app/views/projects/issues/_issue_context.html.haml4
-rw-r--r--app/views/projects/issues/show.html.haml7
-rw-r--r--app/views/projects/labels/destroy.js.haml2
-rw-r--r--app/views/projects/labels/index.html.haml16
-rw-r--r--app/views/projects/merge_requests/_form.html.haml32
-rw-r--r--app/views/projects/merge_requests/_merge_request.html.haml5
-rw-r--r--app/views/projects/merge_requests/_new_submit.html.haml11
-rw-r--r--app/views/projects/merge_requests/_show.html.haml4
-rw-r--r--app/views/projects/merge_requests/show/_commits.html.haml2
-rw-r--r--app/views/projects/merge_requests/show/_context.html.haml4
-rw-r--r--app/views/projects/merge_requests/show/_diffs.html.haml2
-rw-r--r--app/views/projects/merge_requests/show/_participants.html.haml3
-rw-r--r--app/views/projects/milestones/show.html.haml2
-rw-r--r--app/views/projects/network/show.html.haml9
-rw-r--r--app/views/projects/new.html.haml4
-rw-r--r--app/views/projects/new_tree/show.html.haml8
-rw-r--r--app/views/projects/notes/_diff_note_link.html.haml10
-rw-r--r--app/views/projects/notes/_diff_notes_with_reply.html.haml2
-rw-r--r--app/views/projects/notes/_discussion.html.haml19
-rw-r--r--app/views/projects/notes/_form.html.haml7
-rw-r--r--app/views/projects/notes/_note.html.haml117
-rw-r--r--app/views/projects/notes/_notes_with_form.html.haml2
-rw-r--r--app/views/projects/notes/discussions/_active.html.haml1
-rw-r--r--app/views/projects/notes/discussions/_commit.html.haml1
-rw-r--r--app/views/projects/notes/discussions/_diff.html.haml13
-rw-r--r--app/views/projects/notes/discussions/_outdated.html.haml1
-rw-r--r--app/views/projects/show.html.haml37
-rw-r--r--app/views/projects/tags/destroy.js.haml3
-rw-r--r--app/views/projects/tags/index.html.haml25
-rw-r--r--app/views/projects/tags/new.html.haml13
-rw-r--r--app/views/projects/team_members/_form.html.haml2
-rw-r--r--app/views/projects/team_members/import.html.haml2
-rw-r--r--app/views/search/_filter.html.haml10
-rw-r--r--app/views/search/_global_filter.html.haml16
-rw-r--r--app/views/search/_global_results.html.haml5
-rw-r--r--app/views/search/_project_filter.html.haml31
-rw-r--r--app/views/search/_project_results.html.haml24
-rw-r--r--app/views/search/_results.html.haml33
-rw-r--r--app/views/search/_snippet_filter.html.haml13
-rw-r--r--app/views/search/results/_issue.html.haml21
-rw-r--r--app/views/search/results/_merge_request.html.haml30
-rw-r--r--app/views/search/results/_note.html.haml35
-rw-r--r--app/views/search/results/_project.html.haml9
-rw-r--r--app/views/search/results/_snippet_blob.html.haml65
-rw-r--r--app/views/search/results/_snippet_title.html.haml23
-rw-r--r--app/views/search/results/_wiki_blob.html.haml9
-rw-r--r--app/views/search/show.html.haml8
-rw-r--r--app/views/shared/_clone_panel.html.haml5
-rw-r--r--app/views/shared/_file_hljs.html.haml2
-rw-r--r--app/views/shared/_promo.html.haml1
-rw-r--r--app/workers/post_receive.rb27
-rwxr-xr-xbin/background_jobs18
-rwxr-xr-xbin/web12
-rw-r--r--config/application.rb19
-rw-r--r--config/environments/production.rb10
-rw-r--r--config/gitlab.yml.example24
-rw-r--r--config/initializers/1_settings.rb1
-rw-r--r--config/initializers/rack_attack.rb.example12
-rw-r--r--config/initializers/session_store.rb3
-rw-r--r--config/unicorn.rb.example7
-rw-r--r--db/fixtures/development/04_project.rb8
-rw-r--r--db/fixtures/development/05_users.rb16
-rw-r--r--db/fixtures/production/001_admin.rb12
-rw-r--r--db/migrate/20140729152420_migrate_taggable_labels.rb12
-rw-r--r--db/migrate/20140903115954_migrate_to_new_shell.rb10
-rw-r--r--db/migrate/20140907220153_serialize_service_properties.rb36
-rw-r--r--db/schema.rb13
-rw-r--r--doc/api/branches.md5
-rw-r--r--doc/api/issues.md17
-rw-r--r--doc/api/labels.md11
-rw-r--r--doc/api/projects.md1
-rw-r--r--doc/api/repositories.md4
-rw-r--r--doc/install/database_mysql.md16
-rw-r--r--doc/install/installation.md147
-rw-r--r--doc/install/requirements.md20
-rw-r--r--doc/install/structure.md4
-rw-r--r--doc/integration/google.md14
-rw-r--r--doc/integration/omniauth.md46
-rw-r--r--doc/integration/shibboleth.md78
-rw-r--r--doc/raketasks/maintenance.md6
-rw-r--r--doc/raketasks/web_hooks.md12
-rw-r--r--doc/release/monthly.md44
-rw-r--r--doc/system_hooks/system_hooks.md26
-rw-r--r--doc/update/4.2-to-5.0.md45
-rw-r--r--doc/update/5.1-to-5.2.md2
-rw-r--r--doc/update/5.1-to-5.4.md2
-rw-r--r--doc/update/5.1-to-6.0.md101
-rw-r--r--doc/update/5.2-to-5.3.md2
-rw-r--r--doc/update/5.3-to-5.4.md2
-rw-r--r--doc/update/6.0-to-6.1.md3
-rw-r--r--doc/update/6.0-to-7.2.md (renamed from doc/update/6.0-to-7.1.md)96
-rw-r--r--doc/update/6.1-to-6.2.md3
-rw-r--r--doc/update/6.2-to-6.3.md3
-rw-r--r--doc/update/6.3-to-6.4.md2
-rw-r--r--doc/update/6.4-to-6.5.md2
-rw-r--r--doc/update/6.5-to-6.6.md2
-rw-r--r--doc/update/6.6-to-6.7.md2
-rw-r--r--doc/update/6.7-to-6.8.md3
-rw-r--r--doc/update/6.8-to-6.9.md2
-rw-r--r--doc/update/6.9-to-7.0.md6
-rw-r--r--doc/update/7.0-to-7.1.md3
-rw-r--r--doc/update/7.1-to-7.2.md136
-rw-r--r--doc/update/7.2-to-7.3.md10
-rw-r--r--doc/update/mysql_to_postgresql.md8
-rw-r--r--doc/update/upgrader.md2
-rw-r--r--doc/web_hooks/web_hooks.md4
-rw-r--r--doc/workflow/README.md1
-rw-r--r--doc/workflow/labels.md16
-rw-r--r--doc/workflow/labels/label1.pngbin0 -> 5846 bytes
-rw-r--r--doc/workflow/labels/label2.pngbin0 -> 16931 bytes
-rw-r--r--doc/workflow/labels/label3.pngbin0 -> 19360 bytes
-rw-r--r--features/dashboard/search.feature10
-rw-r--r--features/dashboard/shortcuts.feature21
-rw-r--r--features/project/commits/branches.feature26
-rw-r--r--features/project/commits/tags.feature30
-rw-r--r--features/project/issues/issues.feature37
-rw-r--r--features/project/issues/labels.feature10
-rw-r--r--features/project/shortcuts.feature52
-rw-r--r--features/project/source/browse_files.feature12
-rw-r--r--features/search.feature46
-rw-r--r--features/snippet_search.feature20
-rw-r--r--features/steps/dashboard/active_tab.rb14
-rw-r--r--features/steps/dashboard/search.rb19
-rw-r--r--features/steps/dashboard/shortcuts.rb6
-rw-r--r--features/steps/explore/projects.rb4
-rw-r--r--features/steps/group/group.rb4
-rw-r--r--features/steps/project/active_tab.rb39
-rw-r--r--features/steps/project/browse_branches.rb43
-rw-r--r--features/steps/project/browse_files.rb13
-rw-r--r--features/steps/project/browse_tags.rb74
-rw-r--r--features/steps/project/issues.rb77
-rw-r--r--features/steps/project/labels.rb34
-rw-r--r--features/steps/project/project_shortcuts.rb36
-rw-r--r--features/steps/project/redirects.rb6
-rw-r--r--features/steps/project/search_code.rb3
-rw-r--r--features/steps/search.rb73
-rw-r--r--features/steps/shared/active_tab.rb20
-rw-r--r--features/steps/shared/paths.rb6
-rw-r--r--features/steps/shared/project_tab.rb46
-rw-r--r--features/steps/shared/search.rb11
-rw-r--r--features/steps/shared/shortcuts.rb18
-rw-r--r--features/steps/shared/snippet.rb23
-rw-r--r--features/steps/snippet_search.rb56
-rw-r--r--lib/api/branches.rb16
-rw-r--r--lib/api/helpers.rb8
-rw-r--r--lib/api/internal.rb9
-rw-r--r--lib/api/issues.rb61
-rw-r--r--lib/api/labels.rb4
-rw-r--r--lib/api/merge_requests.rb11
-rw-r--r--lib/api/repositories.rb17
-rw-r--r--lib/backup/repository.rb2
-rw-r--r--lib/gitlab/backend/shell.rb9
-rw-r--r--lib/gitlab/blacklist.rb27
-rw-r--r--lib/gitlab/diff/file.rb49
-rw-r--r--lib/gitlab/diff/line.rb12
-rw-r--r--lib/gitlab/diff/line_code.rb9
-rw-r--r--lib/gitlab/diff/parser.rb81
-rw-r--r--lib/gitlab/diff_parser.rb83
-rw-r--r--lib/gitlab/git_access.rb39
-rw-r--r--lib/gitlab/git_ref_validator.rb11
-rw-r--r--lib/gitlab/ldap/access.rb2
-rw-r--r--lib/gitlab/ldap/adapter.rb3
-rw-r--r--lib/gitlab/ldap/person.rb2
-rw-r--r--lib/gitlab/ldap/user.rb91
-rw-r--r--lib/gitlab/markdown.rb16
-rw-r--r--lib/gitlab/oauth/auth_hash.rb54
-rw-r--r--lib/gitlab/oauth/user.rb134
-rw-r--r--lib/gitlab/project_search_results.rb73
-rw-r--r--lib/gitlab/satellite/satellite.rb1
-rw-r--r--lib/gitlab/search_results.rb69
-rw-r--r--lib/gitlab/snippet_search_results.rb131
-rw-r--r--lib/gitlab/upgrader.rb2
-rw-r--r--lib/gitlab/visibility_level.rb16
-rw-r--r--lib/support/nginx/gitlab96
-rw-r--r--lib/support/nginx/gitlab-ssl57
-rw-r--r--lib/tasks/gitlab/check.rake12
-rw-r--r--lib/tasks/gitlab/shell.rake2
-rw-r--r--lib/tasks/gitlab/sidekiq.rake47
-rw-r--r--spec/factories.rb1
-rw-r--r--spec/factories/label_links.rb12
-rw-r--r--spec/factories/labels.rb12
-rw-r--r--spec/factories/merge_requests.rb22
-rw-r--r--spec/factories/notes.rb19
-rw-r--r--spec/factories/projects.rb28
-rw-r--r--spec/helpers/diff_helper_spec.rb98
-rw-r--r--spec/lib/auth_spec.rb28
-rw-r--r--spec/lib/git_ref_validator_spec.rb20
-rw-r--r--spec/lib/gitlab/auth_spec.rb47
-rw-r--r--spec/lib/gitlab/diff/file_spec.rb21
-rw-r--r--spec/lib/gitlab/diff/parser_spec.rb93
-rw-r--r--spec/lib/gitlab/ldap/access_spec.rb (renamed from spec/lib/gitlab/ldap/ldap_access_spec.rb)8
-rw-r--r--spec/lib/gitlab/ldap/adapter_spec.rb (renamed from spec/lib/gitlab/ldap/ldap_adapter_spec.rb)0
-rw-r--r--spec/lib/gitlab/ldap/ldap_user_auth_spec.rb58
-rw-r--r--spec/lib/gitlab/ldap/user_spec.rb54
-rw-r--r--spec/lib/gitlab/oauth/user_spec.rb83
-rw-r--r--spec/lib/oauth_spec.rb45
-rw-r--r--spec/models/assembla_service_spec.rb7
-rw-r--r--spec/models/flowdock_service_spec.rb7
-rw-r--r--spec/models/gemnasium_service_spec.rb7
-rw-r--r--spec/models/gitlab_ci_service_spec.rb7
-rw-r--r--spec/models/label_link_spec.rb12
-rw-r--r--spec/models/label_spec.rb35
-rw-r--r--spec/models/merge_request_spec.rb1
-rw-r--r--spec/models/project_spec.rb2
-rw-r--r--spec/models/service_spec.rb7
-rw-r--r--spec/models/slack_service_spec.rb7
-rw-r--r--spec/requests/api/branches_spec.rb45
-rw-r--r--spec/requests/api/internal_spec.rb9
-rw-r--r--spec/requests/api/issues_spec.rb147
-rw-r--r--spec/requests/api/labels_spec.rb32
-rw-r--r--spec/requests/api/merge_requests_spec.rb13
-rw-r--r--spec/requests/api/projects_spec.rb2
-rw-r--r--spec/requests/api/repositories_spec.rb63
-rw-r--r--spec/services/projects/fork_service_spec.rb (renamed from spec/services/fork_service_spec.rb)23
-rw-r--r--spec/services/projects/update_service_spec.rb2
-rw-r--r--spec/services/search_service_spec.rb8
-rw-r--r--spec/services/system_hooks_service_spec.rb5
-rw-r--r--spec/workers/post_receive_spec.rb11
-rwxr-xr-xvendor/assets/javascripts/jquery.sticky.js170
381 files changed, 5865 insertions, 2236 deletions
diff --git a/.pkgr.yml b/.pkgr.yml
index 97d78b6ef69..cf96e7916d8 100644
--- a/.pkgr.yml
+++ b/.pkgr.yml
@@ -5,6 +5,8 @@ targets:
debian-7: &wheezy
build_dependencies:
- libicu-dev
+ - cmake
+ - pkg-config
dependencies:
- libicu48
- libpcre3
@@ -13,6 +15,8 @@ targets:
ubuntu-14.04:
build_dependencies:
- libicu-dev
+ - cmake
+ - pkg-config
dependencies:
- libicu52
- libpcre3
@@ -20,6 +24,8 @@ targets:
centos-6:
build_dependencies:
- libicu-devel
+ - cmake
+ - pkgconfig
dependencies:
- libicu
- pcre
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 9b7b2cb3c09..00000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-language: ruby
-env:
- global:
- - TRAVIS=true
- matrix:
- - TASK=spinach_project DB=mysql
- - TASK=spinach_other DB=mysql
- - TASK=spec:api DB=mysql
- - TASK=spec:feature DB=mysql
- - TASK=spec:other DB=mysql
- - TASK=jasmine:ci DB=mysql
- - TASK=spinach_project DB=postgresql
- - TASK=spinach_other DB=postgresql
- - TASK=spec:api DB=postgresql
- - TASK=spec:feature DB=postgresql
- - TASK=spec:other DB=postgresql
- - TASK=jasmine:ci DB=postgresql
-before_install:
- - sudo apt-get install libicu-dev -y
-install:
- - "travis_retry bundle install --deployment --without production --retry 5"
-branches:
- only:
- - 'master'
-rvm:
- - 2.0.0
-services:
- - redis-server
-before_script:
- - "cp config/database.yml.$DB config/database.yml"
- - "cp config/gitlab.yml.example config/gitlab.yml"
- - "bundle exec rake db:setup"
- - "bundle exec rake db:seed_fu"
-script: "bundle exec rake $TASK --trace"
-notifications:
- email: false
diff --git a/CHANGELOG b/CHANGELOG
index c19826bc5c1..5ac2aee2d4d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,17 +1,53 @@
+v 7.3.0
+ - Always set the 'origin' remote in satellite actions
+ - Write authorized_keys in tmp/ during tests
+ - Expire Rack sessions after 1 week
+ - Cleaner signin/signup pages
+ - Improved comments UI
+ - Better search with filtering, pagination etc
+ - Added a checkbox to toggle line wrapping in diff (Yuriy Glukhov)
+ - Prevent project stars duplication when fork project
+ - Use the default Unicorn socket backlog value of 1024
+ - Support Unix domain sockets for Redis
+ - Store session Redis keys in 'session:gitlab:' namespace
+ - Deprecate LDAP account takeover based on partial LDAP email / GitLab username match
+ - Use /bin/sh instead of Bash in bin/web, bin/background_jobs (Pavel Novitskiy)
+ - Keyboard shortcuts for productivity (Robert Schilling)
+ - API: filter issues by state (Julien Bianchi)
+ - API: filter issues by labels (Julien Bianchi)
+ - Add system hook for ssh key changes
+ - Add blob permalink link (Ciro Santilli)
+ - Create annotated tags through UI and API (Sean Edge)
+ - Snippets search (Charles Bushong)
+ - Comment new push to existing MR
+ - Add 'ci' to the blacklist of forbidden names
+ - Improve text filtering on issues page
+ - Comment & Close button
+ - Process git push --all much faster
+ - Don't allow edit of system notes
+ - Project wiki search (Ralf Seidler)
+ - Enabled Shibboleth authentication support (Matus Banas)
+ - Zen mode (fullscreen) for issues/MR/notes (Robert Schilling)
+ - Add ability to configure webhook timeout via gitlab.yml (Wes Gurney)
+
+v 7.2.1
+ - Delete orphaned labels during label migration (James Brooks)
+ - Security: prevent XSS with stricter MIME types for raw repo files
+
v 7.2.0
- Explore page
- Add project stars (Ciro Santilli)
- Log Sidekiq arguments
- - Fix cpu usage issue in Firefox
- Better labels: colors, ability to rename and remove
- Improve the way merge request collects diffs
- - Improve compare page for large diffs
+ - Improve compare page for large diffs
- Expose the full commit message via API
- Fix 500 error on repository rename
- Fix bug when MR download patch return invalid diff
- Test gitlab-shell integration
- Repository import timeout increased from 2 to 4 minutes allowing larger repos to be imported
- API for labels (Robert Schilling)
+ - API: ability to set an import url when creating project for specific user
v 7.1.1
- Fix cpu usage issue in Firefox
@@ -73,7 +109,7 @@ v 7.0.0
- Show notice if your profile is public
- UI improvements for mobile devices
- Improve diff rendering performance
- - Drag-n-drop for issues and merge requests between states at milestone page
+ - Drag-n-drop for issues and merge requests between states at milestone page
- Fix '0 commits' message for huge repositories on project home page
- Prevent 500 error page when visit commit page from large repo
- Add notice about huge push over http to unicorn config
@@ -83,7 +119,7 @@ v 7.0.0
- Be more selective when killing stray Sidekiqs
- Check LDAP user filter during sign-in
- Remove wall feature (no data loss - you can take it from database)
- - Dont expose user emails via API unless you are admin
+ - Dont expose user emails via API unless you are admin
- Detect issues closed by Merge Request description
- Better email subject lines from email on push service (Alex Elman)
- Enable identicon for gravatar be default
@@ -158,7 +194,7 @@ v 6.7.0
- Blob and tree gfm links to anchors work
- Piwik Integration (Sebastian Winkler)
- Show contribution guide link for new issue form (Jeroen van Baarsen)
- - Fix CI status for merge requests from fork
+ - Fix CI status for merge requests from fork
- Added option to remove issue assignee on project issue page and issue edit page (Jason Blanchard)
- New page load indicator that includes a spinner that scrolls with the page
- Converted all the help sections into markdown
@@ -349,7 +385,7 @@ v 6.2.0
- Store the sessions in Redis instead of the cookie store
- Fixed relative links in markdown
- User must confirm their email if signup enabled
- - User must confirm changed email
+ - User must confirm changed email
v 6.1.0
- Project specific IDs for issues, mr, milestones
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f02ba2216d2..845be6e482b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -62,6 +62,7 @@ If you can, please submit a merge request with the fix or improvements including
1. Create a feature branch
1. Write [tests](README.md#run-the-tests) and code
1. Add your changes to the [CHANGELOG](CHANGELOG)
+1. If you are changing the README, some documentation or other things which have no effect on the tests, add `[ci skip]` somewhere in the commit message
1. If you have multiple commits please combine them into one commit by [squashing them](http://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
1. Push the commit to your fork
1. Submit a merge request (MR) to the master branch
diff --git a/GITLAB_SHELL_VERSION b/GITLAB_SHELL_VERSION
index 7bc1c40470f..227cea21564 100644
--- a/GITLAB_SHELL_VERSION
+++ b/GITLAB_SHELL_VERSION
@@ -1 +1 @@
-1.9.6
+2.0.0
diff --git a/Gemfile b/Gemfile
index d7aa463d830..d67ecd72ccf 100644
--- a/Gemfile
+++ b/Gemfile
@@ -27,6 +27,7 @@ gem 'omniauth', "~> 1.1.3"
gem 'omniauth-google-oauth2'
gem 'omniauth-twitter'
gem 'omniauth-github'
+gem 'omniauth-shibboleth'
# Extracting information from a git repository
# Provide access to Gitlab::Git library
@@ -36,7 +37,7 @@ gem "gitlab_git", '~> 6.0'
gem 'gitlab-grack', '~> 2.0.0.pre', require: 'grack'
# LDAP Auth
-gem 'gitlab_omniauth-ldap', '1.0.4', require: "omniauth-ldap"
+gem 'gitlab_omniauth-ldap', '1.1.0', require: "omniauth-ldap"
# Git Wiki
gem 'gollum-lib', '~> 3.0.0'
@@ -82,10 +83,10 @@ gem "seed-fu"
gem "github-markup"
# Required markup gems by github-markdown
-gem 'redcarpet', '~> 2.2.2'
+gem 'redcarpet', '~> 3.1.2'
gem 'RedCloth'
gem 'rdoc', '~>3.6'
-gem 'org-ruby', '= 0.9.1'
+gem 'org-ruby'
gem 'creole', '~>0.3.6'
gem 'wikicloth', '=0.8.1'
gem 'asciidoctor', '= 0.1.4'
@@ -156,6 +157,9 @@ gem "rack-attack"
# Ace editor
gem 'ace-rails-ap'
+# Keyboard shortcuts
+gem 'mousetrap-rails'
+
# Semantic UI Sass for Sidebar
gem 'semantic-ui-sass', '~> 0.16.1.0'
@@ -231,7 +235,7 @@ group :development, :test do
gem 'jasmine', '2.0.2'
- gem "spring", '1.1.1'
+ gem "spring", '1.1.3'
gem "spring-commands-rspec", '1.0.1'
gem "spring-commands-spinach", '1.0.0'
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 500e80ce4ee..e6d948e9a07 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -129,7 +129,7 @@ GEM
factory_girl_rails (4.3.0)
factory_girl (~> 4.3.0)
railties (>= 3.0.0)
- faraday (0.8.8)
+ faraday (0.8.9)
multipart-post (~> 1.2.0)
faraday_middleware (0.9.0)
faraday (>= 0.7.4, < 0.9)
@@ -158,7 +158,7 @@ GEM
dotenv (>= 0.7)
thor (>= 0.13.6)
formatador (0.2.4)
- gemnasium-gitlab-service (0.2.1)
+ gemnasium-gitlab-service (0.2.2)
rugged (~> 0.19)
gherkin-ruby (0.3.1)
racc
@@ -168,7 +168,7 @@ GEM
multi_json
gitlab-grack (2.0.0.pre)
rack (~> 1.5.1)
- gitlab-grit (2.6.10)
+ gitlab-grit (2.6.11)
charlock_holmes (~> 0.6)
diff-lcs (~> 1.1)
mime-types (~> 1.15)
@@ -186,8 +186,8 @@ GEM
gitlab-linguist (~> 3.0)
rugged (~> 0.21.0)
gitlab_meta (7.0)
- gitlab_omniauth-ldap (1.0.4)
- net-ldap (~> 0.3.1)
+ gitlab_omniauth-ldap (1.1.0)
+ net-ldap (~> 0.7.0)
omniauth (~> 1.0)
pyu-ruby-sasl (~> 0.0.3.1)
rubyntlm (~> 0.1.1)
@@ -234,7 +234,7 @@ GEM
activesupport (>= 4.0.1)
haml (>= 3.1, < 5.0)
railties (>= 4.0.1)
- hashie (2.0.5)
+ hashie (2.1.2)
hike (1.2.3)
hipchat (0.14.0)
httparty
@@ -243,7 +243,7 @@ GEM
httparty (0.13.0)
json (~> 1.8)
multi_xml (>= 0.5.2)
- httpauth (0.2.0)
+ httpauth (0.2.1)
i18n (0.6.11)
ice_nine (0.10.0)
jasmine (2.0.2)
@@ -264,7 +264,7 @@ GEM
jquery-ui-rails (4.2.1)
railties (>= 3.2.16)
json (1.8.1)
- jwt (0.1.8)
+ jwt (0.1.13)
multi_json (>= 1.5)
kaminari (0.15.1)
actionpack (>= 3.0.0)
@@ -287,11 +287,12 @@ GEM
mime-types (1.25.1)
mini_portile (0.6.0)
minitest (5.3.5)
+ mousetrap-rails (1.4.6)
multi_json (1.10.1)
multi_xml (0.5.5)
multipart-post (1.2.0)
mysql2 (0.3.16)
- net-ldap (0.3.1)
+ net-ldap (0.7.0)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.8.0)
@@ -311,20 +312,22 @@ GEM
omniauth-github (1.1.1)
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.1)
- omniauth-google-oauth2 (0.2.1)
- omniauth (~> 1.0)
- omniauth-oauth2
+ omniauth-google-oauth2 (0.2.5)
+ omniauth (> 1.0)
+ omniauth-oauth2 (~> 1.1)
omniauth-oauth (1.0.1)
oauth
omniauth (~> 1.0)
omniauth-oauth2 (1.1.1)
oauth2 (~> 0.8.0)
omniauth (~> 1.0)
+ omniauth-shibboleth (1.1.1)
+ omniauth (>= 1.0.0)
omniauth-twitter (1.0.1)
multi_json (~> 1.3)
omniauth-oauth (~> 1.0)
- org-ruby (0.9.1)
- rubypants (>= 0.2.0)
+ org-ruby (0.9.8)
+ rubypants (~> 0.2)
orm_adapter (0.5.0)
pg (0.15.1)
phantomjs (1.9.2.0)
@@ -391,7 +394,7 @@ GEM
ffi (>= 0.5.0)
rdoc (3.12.2)
json (~> 1.4)
- redcarpet (2.2.2)
+ redcarpet (3.1.2)
redis (3.0.6)
redis-actionpack (4.0.0)
actionpack (~> 4)
@@ -489,7 +492,7 @@ GEM
capybara (>= 2.0.0)
railties (>= 3)
spinach (>= 0.4)
- spring (1.1.1)
+ spring (1.1.3)
spring-commands-rspec (1.0.1)
spring (>= 0.9.1)
spring-commands-spinach (1.0.0)
@@ -615,7 +618,7 @@ DEPENDENCIES
gitlab_emoji (~> 0.0.1.1)
gitlab_git (~> 6.0)
gitlab_meta (= 7.0)
- gitlab_omniauth-ldap (= 1.0.4)
+ gitlab_omniauth-ldap (= 1.1.0)
gollum-lib (~> 3.0.0)
gon (~> 5.0.0)
grape (~> 0.6.1)
@@ -636,13 +639,15 @@ DEPENDENCIES
launchy
letter_opener
minitest (~> 5.3.0)
+ mousetrap-rails
mysql2
nprogress-rails
omniauth (~> 1.1.3)
omniauth-github
omniauth-google-oauth2
+ omniauth-shibboleth
omniauth-twitter
- org-ruby (= 0.9.1)
+ org-ruby
pg
poltergeist (~> 1.5.1)
pry
@@ -657,7 +662,7 @@ DEPENDENCIES
rb-fsevent
rb-inotify
rdoc (~> 3.6)
- redcarpet (~> 2.2.2)
+ redcarpet (~> 3.1.2)
redis-rails
request_store
rspec-rails
@@ -676,7 +681,7 @@ DEPENDENCIES
slack-notifier (~> 0.3.2)
slim
spinach-rails
- spring (= 1.1.1)
+ spring (= 1.1.3)
spring-commands-rspec (= 1.0.1)
spring-commands-spinach (= 1.0.0)
stamp
diff --git a/Guardfile b/Guardfile
index e19a312377d..68ac3232b09 100644
--- a/Guardfile
+++ b/Guardfile
@@ -1,7 +1,7 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
-guard 'rspec', cmd: "spring rspec", version: 2, all_on_start: false, all_after_pass: false do
+guard 'rspec', cmd: "spring rspec", all_on_start: false, all_after_pass: false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^lib/api/(.+)\.rb$}) { |m| "spec/requests/api/#{m[1]}_spec.rb" }
@@ -19,7 +19,7 @@ guard 'rspec', cmd: "spring rspec", version: 2, all_on_start: false, all_after_p
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
end
-guard 'spinach' do
+guard 'spinach', command_prefix: 'spring' do
watch(%r|^features/(.*)\.feature|)
watch(%r|^features/steps/(.*)([^/]+)\.rb|) do |m|
"features/#{m[1]}#{m[2]}.feature"
diff --git a/PROCESS.md b/PROCESS.md
index c986013e2f2..c3a787662f7 100644
--- a/PROCESS.md
+++ b/PROCESS.md
@@ -87,7 +87,7 @@ Please use ``` to format console output, logs, and code as it's very hard to rea
### Issue fixed in newer version
-Thanks for the issue report. This issue has already been fixed in newer versions of GitLab. Due to the size of this project and our limited resources we are only able to support the latest stable release as outlined in our \[contributing guidelines\]\(https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#issue-tracker). In order to get this bug fix and enjoy many new features please \[upgrade\]\(https://github.com/gitlabhq/gitlabhq/tree/master/doc/update). If you still experience issues at that time please open a new issue following our issue tracker guidelines found in the \[contributing guidelines\]\(https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#issue-tracker-guidelines).
+Thanks for the issue report. This issue has already been fixed in newer versions of GitLab. Due to the size of this project and our limited resources we are only able to support the latest stable release as outlined in our \[contributing guidelines\]\(https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#issue-tracker). In order to get this bug fix and enjoy many new features please \[upgrade\]\(https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/update). If you still experience issues at that time please open a new issue following our issue tracker guidelines found in the \[contributing guidelines\]\(https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#issue-tracker-guidelines).
### Improperly formatted merge request
diff --git a/README.md b/README.md
index f5f7a8aad49..fbcde347be6 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,8 @@
-# GitLab
+# ![logo](https://about.gitlab.com/images/gitlab_logo.png) GitLab
## Open source software to collaborate on code
-![logo](https://gitlab.com/gitlab-org/gitlab-ce/raw/master/public/gitlab_logo.png)
-
-![animated-screenshots](https://gist.github.com/fnkr/2f9badd56bfe0ed04ee7/raw/4f48806fbae97f556c2f78d8c2d299c04500cb0d/compiled.gif)
+![Animated screenshots](https://about.gitlab.com/images/animated/compiled.gif)
- Manage Git repositories with fine grained access controls that keep your code secure
- Perform code reviews and enhance collaboration with merge requests
@@ -21,7 +19,9 @@
- [![build status](https://ci.gitlab.org/projects/1/status.png?ref=master)](https://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch)
-- [![Code Climate](https://codeclimate.com/github/gitlabhq/gitlabhq.png)](https://codeclimate.com/github/gitlabhq/gitlabhq)
+- [![Build Status](https://semaphoreapp.com/api/v1/projects/2f1a5809-418b-4cc2-a1f4-819607579fe7/243338/badge.png)](https://semaphoreapp.com/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)
@@ -29,14 +29,14 @@
## Website
-On [www.gitlab.com](https://www.gitlab.com/) you can find more information about:
+On [about.gitlab.com](https://about.gitlab.com/) you can find more information about:
-- [Subscriptions](https://www.gitlab.com/subscription/)
-- [Consultancy](https://www.gitlab.com/consultancy/)
-- [Community](https://www.gitlab.com/community/)
-- [Hosted GitLab.com](https://www.gitlab.com/gitlab-com/) use GitLab as a free service
-- [GitLab Enterprise Edition](https://www.gitlab.com/gitlab-ee/) with additional features aimed at larger organizations.
-- [GitLab CI](https://www.gitlab.com/gitlab-ci/) a continuous integration (CI) server that is easy to integrate with GitLab.
+- [Subscriptions](https://about.gitlab.com/subscription/)
+- [Consultancy](https://about.gitlab.com/consultancy/)
+- [Community](https://about.gitlab.com/community/)
+- [Hosted GitLab.com](https://about.gitlab.com/gitlab-com/) use GitLab as a free service
+- [GitLab Enterprise Edition](https://about.gitlab.com/gitlab-ee/) with additional features aimed at larger organizations.
+- [GitLab CI](https://about.gitlab.com/gitlab-ci/) a continuous integration (CI) server that is easy to integrate with GitLab.
## Third-party applications
@@ -61,11 +61,11 @@ These applications are maintained by contributors, GitLab B.V. does not offer su
## Installation
-Please see [the installation page on the GitLab website](https://www.gitlab.com/installation/).
+Please see [the installation page on the GitLab website](https://about.gitlab.com/installation/).
### New versions
-Since 2011 a minor or major version of GitLab is released on the 22nd of every month. Patch and security releases come out when needed. New features are detailed on the [blog](https://www.gitlab.com/blog/) and in the [changelog](CHANGELOG). For more information about the release process see the release [documentation](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/release). Features that will likely be in the next releases can be found on the [feature request forum](http://feedback.gitlab.com/forums/176466-general) with the status [started](http://feedback.gitlab.com/forums/176466-general/status/796456) and [completed](http://feedback.gitlab.com/forums/176466-general/status/796457).
+Since 2011 a minor or major version of GitLab is released on the 22nd of every month. Patch and security releases come out when needed. New features are detailed on the [blog](https://about.gitlab.com/blog/) and in the [changelog](CHANGELOG). For more information about the release process see the release [documentation](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/release). Features that will likely be in the next releases can be found on the [feature request forum](http://feedback.gitlab.com/forums/176466-general) with the status [started](http://feedback.gitlab.com/forums/176466-general/status/796456) and [completed](http://feedback.gitlab.com/forums/176466-general/status/796457).
### Upgrading
@@ -85,7 +85,8 @@ Please login with `root` / `5iveL!fe`
## Install a development environment
-We recommend setting up your development environment with [the cookbook](https://gitlab.com/gitlab-org/cookbook-gitlab/blob/master/README.md#installation). If you do not use the cookbook you might need to copy the example development unicorn configuration file
+We recommend setting up your development environment with [the GitLab Development Kit](https://gitlab.com/gitlab-org/gitlab-development-kit).
+If you do not use the development kit you might need to copy the example development unicorn configuration file
cp config/unicorn.rb.example.development config/unicorn.rb
@@ -126,7 +127,7 @@ All documentation can be found on [doc.gitlab.com/ce/](http://doc.gitlab.com/ce/
## Getting help
-Please see [Getting help for GitLab](https://www.gitlab.com/getting-help/) on our website for the many options to get help.
+Please see [Getting help for GitLab](https://about.gitlab.com/getting-help/) on our website for the many options to get help.
## Is it any good?
diff --git a/VERSION b/VERSION
index d2e57d3064d..ab8884ed9bc 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-7.2.0.pre
+7.3.0.pre
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index 1960479321c..9add1304dc7 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -15,6 +15,7 @@
#= require jquery.atwho
#= require jquery.scrollTo
#= require jquery.blockUI
+#= require jquery.sticky
#= require turbolinks
#= require jquery.turbolinks
#= require bootstrap
@@ -25,12 +26,20 @@
#= require branch-graph
#= require highlight.pack
#= require ace/ace
+#= require ace/ext-searchbox
#= require d3
#= require underscore
#= require nprogress
#= require nprogress-turbolinks
#= require dropzone
#= require semantic-ui/sidebar
+#= require mousetrap
+#= require mousetrap/pause
+#= require shortcuts
+#= require shortcuts_navigation
+#= require shortcuts_dashboard_navigation
+#= require shortcuts_issueable
+#= require shortcuts_network
#= require_tree .
window.slugify = (text) ->
@@ -117,6 +126,13 @@ $ ->
# Initialize select2 selects
$('select.select2').select2(width: 'resolve', dropdownAutoWidth: true)
+ # Close select2 on escape
+ $('.js-select2').bind 'select2-close', ->
+ setTimeout ( ->
+ $('.select2-container-active').removeClass('select2-container-active')
+ $(':focus').blur()
+ ), 1
+
# Initialize tooltips
$('.has_tooltip').tooltip()
@@ -149,20 +165,6 @@ $ ->
# Show/Hide the profile menu when hovering the account box
$('.account-box').hover -> $(@).toggleClass('hover')
- # Focus search field by pressing 's' key
- $(document).keypress (e) ->
- # Don't do anything if typing in an input
- return if $(e.target).is(":input")
-
- switch e.which
- when 115
- $("#search").focus()
- e.preventDefault()
- when 63
- new Shortcuts()
- e.preventDefault()
-
-
# Commit show suppressed diff
$(".diff-content").on "click", ".supp_diff_link", ->
$(@).next('table').show()
diff --git a/app/assets/javascripts/behaviors/toggle_diff_line_wrap_behavior.coffee b/app/assets/javascripts/behaviors/toggle_diff_line_wrap_behavior.coffee
new file mode 100644
index 00000000000..691ed4f98ae
--- /dev/null
+++ b/app/assets/javascripts/behaviors/toggle_diff_line_wrap_behavior.coffee
@@ -0,0 +1,14 @@
+$ ->
+ # Toggle line wrapping in diff.
+ #
+ # %div.diff-file
+ # %input.js-toggle-diff-line-wrap
+ # %td.line_content
+ #
+ $("body").on "click", ".js-toggle-diff-line-wrap", (e) ->
+ diffFile = $(@).closest(".diff-file")
+ if $(@).is(":checked")
+ diffFile.addClass("diff-wrap-lines")
+ else
+ diffFile.removeClass("diff-wrap-lines")
+
diff --git a/app/assets/javascripts/branch-graph.js.coffee b/app/assets/javascripts/branch-graph.js.coffee
index f6d57bd55bb..b8af07579f2 100644
--- a/app/assets/javascripts/branch-graph.js.coffee
+++ b/app/assets/javascripts/branch-graph.js.coffee
@@ -1,4 +1,4 @@
-class BranchGraph
+class @BranchGraph
constructor: (@element, @options) ->
@preparedCommits = {}
@mtime = 0
@@ -120,23 +120,32 @@ class BranchGraph
@top.toFront()
bindEvents: ->
- drag = {}
element = @element
$(element).scroll (event) =>
@renderPartialGraph()
- $(window).on
- keydown: (event) =>
- # left
- element.scrollLeft element.scrollLeft() - 50 if event.keyCode is 37
- # top
- element.scrollTop element.scrollTop() - 50 if event.keyCode is 38
- # right
- element.scrollLeft element.scrollLeft() + 50 if event.keyCode is 39
- # bottom
- element.scrollTop element.scrollTop() + 50 if event.keyCode is 40
- @renderPartialGraph()
+ scrollDown: =>
+ @element.scrollTop @element.scrollTop() + 50
+ @renderPartialGraph()
+
+ scrollUp: =>
+ @element.scrollTop @element.scrollTop() - 50
+ @renderPartialGraph()
+
+ scrollLeft: =>
+ @element.scrollLeft @element.scrollLeft() - 50
+ @renderPartialGraph()
+
+ scrollRight: =>
+ @element.scrollLeft @element.scrollLeft() + 50
+ @renderPartialGraph()
+
+ scrollBottom: =>
+ @element.scrollTop @element.find('svg').height()
+
+ scrollTop: =>
+ @element.scrollTop 0
appendLabel: (x, y, commit) ->
return unless commit.refs
@@ -325,5 +334,3 @@ Raphael::textWrap = (t, width) ->
b = t.getBBox()
h = Math.abs(b.y2) - Math.abs(b.y) + 1
t.attr y: b.y + h
-
-@BranchGraph = BranchGraph
diff --git a/app/assets/javascripts/diff.js.coffee b/app/assets/javascripts/diff.js.coffee
index dbe00c487dc..78bb385b5bb 100644
--- a/app/assets/javascripts/diff.js.coffee
+++ b/app/assets/javascripts/diff.js.coffee
@@ -34,7 +34,8 @@ class Diff
$.get(link, params, (response) =>
target.parent().replaceWith(response)
)
- )
+ ).ready =>
+ $(".diff-header").sticky {responsiveWidth:true, getWidthFrom: ".diff-file"}
lineNumbers: (line) ->
return ([0, 0]) unless line.children().length
diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee
index a463a2eb194..086c09f196e 100644
--- a/app/assets/javascripts/dispatcher.js.coffee
+++ b/app/assets/javascripts/dispatcher.js.coffee
@@ -15,49 +15,87 @@ class Dispatcher
return false
path = page.split(':')
+ shortcut_handler = null
switch page
when 'projects:issues:index'
Issues.init()
+ shortcut_handler = new ShortcutsNavigation()
when 'projects:issues:show'
new Issue()
+ shortcut_handler = new ShortcutsIssueable()
+ new ZenMode()
when 'projects:milestones:show'
new Milestone()
- when 'projects:issues:new'
+ when 'projects:issues:new','projects:issues:edit'
GitLab.GfmAutoComplete.setup()
- when 'projects:merge_requests:new'
+ shortcut_handler = new ShortcutsNavigation()
+ new ZenMode()
+ when 'projects:merge_requests:new', 'projects:merge_requests:edit'
GitLab.GfmAutoComplete.setup()
new Diff()
+ shortcut_handler = new ShortcutsNavigation()
+ new ZenMode()
when 'projects:merge_requests:show'
new Diff()
+ shortcut_handler = new ShortcutsIssueable()
+ new ZenMode()
when "projects:merge_requests:diffs"
new Diff()
+ when 'projects:merge_requests:index'
+ shortcut_handler = new ShortcutsNavigation()
when 'dashboard:show'
new Dashboard()
new Activities()
when 'projects:commit:show'
new Commit()
new Diff()
+ shortcut_handler = new ShortcutsNavigation()
+ when 'projects:commits:show'
+ shortcut_handler = new ShortcutsNavigation()
when 'groups:show', 'projects:show'
new Activities()
- when 'projects:new', 'projects:edit'
+ shortcut_handler = new ShortcutsNavigation()
+ when 'projects:new'
new Project()
+ when 'projects:edit'
+ new Project()
+ shortcut_handler = new ShortcutsNavigation()
when 'projects:teams:members:index'
new TeamMembers()
when 'groups:members'
new GroupMembers()
when 'projects:tree:show'
new TreeView()
+ shortcut_handler = new ShortcutsNavigation()
when 'projects:blob:show'
new BlobView()
- when 'projects:labels:new'
+ shortcut_handler = new ShortcutsNavigation()
+ when 'projects:labels:new', 'projects:labels:edit'
new Labels()
+ when 'projects:network:show'
+ # Ensure we don't create a particular shortcut handler here. This is
+ # already created, where the network graph is created.
+ shortcut_handler = true
switch path.first()
when 'admin' then new Admin()
+ when 'dashboard'
+ shortcut_handler = new ShortcutsDashboardNavigation()
when 'projects'
- new Wikis() if path[1] == 'wikis'
+ switch path[1]
+ when 'wikis'
+ new Wikis()
+ shortcut_handler = new ShortcutsNavigation()
+ when 'snippets', 'labels', 'graphs'
+ shortcut_handler = new ShortcutsNavigation()
+ when 'team_members', 'deploy_keys', 'hooks', 'services', 'protected_branches'
+ shortcut_handler = new ShortcutsNavigation()
+
+ # If we haven't installed a custom shortcut handler, install the default one
+ if not shortcut_handler
+ new Shortcuts()
initSearch: ->
opts = $('.search-autocomplete-opts')
diff --git a/app/assets/javascripts/issues.js.coffee b/app/assets/javascripts/issues.js.coffee
index 54de93a4e04..2499ad5ad80 100644
--- a/app/assets/javascripts/issues.js.coffee
+++ b/app/assets/javascripts/issues.js.coffee
@@ -43,25 +43,31 @@
$(".selected_issue").bind "change", Issues.checkChanged
-
+ # Make sure we trigger ajax request only after user stop typing
initSearch: ->
- form = $("#issue_search_form")
- last_terms = ""
+ @timer = null
$("#issue_search").keyup ->
- terms = $(this).val()
- unless terms is last_terms
- last_terms = terms
- if terms.length >= 2 or terms.length is 0
- $.ajax
- type: "GET"
- url: location.href
- data: "issue_search=" + terms
- complete: ->
- $(".loading").hide()
- success: (data) ->
- $('.issues-holder').html(data.html)
- Issues.reload()
- dataType: "json"
+ clearTimeout(@timer);
+ @timer = setTimeout(Issues.filterResults, 500)
+
+ filterResults: =>
+ form = $("#issue_search_form")
+ search = $("#issue_search").val()
+ $('.issues-holder').css("opacity", '0.5')
+ issues_url = form.attr('action') + '? '+ form.serialize()
+
+ $.ajax
+ type: "GET"
+ url: form.attr('action')
+ data: form.serialize()
+ complete: ->
+ $('.issues-holder').css("opacity", '1.0')
+ success: (data) ->
+ $('.issues-holder').html(data.html)
+ # Change url so if user reload a page - search results are saved
+ History.replaceState {page: issues_url}, document.title, issues_url
+ Issues.reload()
+ dataType: "json"
checkChanged: ->
checked_issues = $(".selected_issue:checked")
diff --git a/app/assets/javascripts/labels.js.coffee b/app/assets/javascripts/labels.js.coffee
index 8e53d6929df..d306ad64f5b 100644
--- a/app/assets/javascripts/labels.js.coffee
+++ b/app/assets/javascripts/labels.js.coffee
@@ -4,7 +4,7 @@ class Labels
@setupLabelForm(form)
@cleanBinding()
@addBinding()
- @updateColorPreview
+ @updateColorPreview()
addBinding: ->
$(document).on 'click', '.suggest-colors a', @setSuggestedColor
diff --git a/app/assets/javascripts/markdown_area.js.coffee b/app/assets/javascripts/markdown_area.js.coffee
index bee2785562d..a971e5dbf1d 100644
--- a/app/assets/javascripts/markdown_area.js.coffee
+++ b/app/assets/javascripts/markdown_area.js.coffee
@@ -27,7 +27,7 @@ $(document).ready ->
dropzone = $(".div-dropzone").dropzone(
url: project_image_path_upload
dictDefaultMessage: ""
- clickable: true
+ clickable: false
paramName: "markdown_img"
maxFilesize: 10
uploadMultiple: false
diff --git a/app/assets/javascripts/network.js.coffee b/app/assets/javascripts/network.js.coffee
index cea5986f45a..f4ef07a50a7 100644
--- a/app/assets/javascripts/network.js.coffee
+++ b/app/assets/javascripts/network.js.coffee
@@ -1,11 +1,9 @@
-class Network
+class @Network
constructor: (opts) ->
$("#filter_ref").click ->
$(this).closest('form').submit()
- branch_graph = new BranchGraph($(".network-graph"), opts)
+ @branch_graph = new BranchGraph($(".network-graph"), opts)
vph = $(window).height() - 250
$('.network-graph').css 'height': (vph + 'px')
-
-@Network = Network
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index 83b1bae0ea1..597d6d26b69 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -16,13 +16,19 @@ class Notes
$(document).on "ajax:success", ".js-main-target-form", @addNote
$(document).on "ajax:success", ".js-discussion-note-form", @addDiscussionNote
- # change note in UI after update
+ # change note in UI after update
$(document).on "ajax:success", "form.edit_note", @updateNote
# Edit note link
$(document).on "click", ".js-note-edit", @showEditForm
$(document).on "click", ".note-edit-cancel", @cancelEdit
+ # Reopen and close actions for Issue/MR combined with note form submit
+ $(document).on "click", ".js-note-target-reopen", @targetReopen
+ $(document).on "click", ".js-note-target-close", @targetClose
+ $(document).on "click", ".js-comment-button", @updateCloseButton
+ $(document).on "keyup", ".js-note-text", @updateTargetButtons
+
# remove a note (in general)
$(document).on "click", ".js-note-delete", @removeNote
@@ -78,7 +84,9 @@ class Notes
$(document).off "click", ".js-add-diff-note-button"
$(document).off "visibilitychange"
$(document).off "keypress", @notes_forms
-
+ $(document).off "keyup", ".js-note-text"
+ $(document).off "click", ".js-note-target-reopen"
+ $(document).off "click", ".js-note-target-close"
initRefresh: ->
clearInterval(Notes.interval)
@@ -407,30 +415,6 @@ class Notes
form.addClass "js-discussion-note-form"
###
- General note form setup.
-
- deactivates the submit button when text is empty
- hides the preview button when text is empty
- setup GFM auto complete
- show the form
- ###
- setupNoteForm: (form) =>
- disableButtonIfEmptyField form.find(".js-note-text"), form.find(".js-comment-button")
- form.removeClass "js-new-note-form"
- form.removeClass "js-new-note-form"
- GitLab.GfmAutoComplete.setup()
-
- # setup preview buttons
- previewButton = form.find(".js-note-preview-button")
- form.find(".js-note-text").on "input", ->
- if $(this).val().trim() isnt ""
- previewButton.removeClass("turn-off").addClass "turn-on"
- else
- previewButton.removeClass("turn-on").addClass "turn-off"
-
- form.show()
-
- ###
Called when clicking on the "add a comment" button on the side of a diff line.
Inserts a temporary row for the form below the line.
@@ -502,4 +486,33 @@ class Notes
visibilityChange: =>
@refresh()
+ targetReopen: (e) =>
+ @submitNoteForm($(e.target).parents('form'))
+
+ targetClose: (e) =>
+ @submitNoteForm($(e.target).parents('form'))
+
+ submitNoteForm: (form) =>
+ noteText = form.find(".js-note-text").val()
+ if noteText.trim().length > 0
+ form.submit()
+
+ updateCloseButton: (e) =>
+ textarea = $(e.target)
+ form = textarea.parents('form')
+ form.find('.js-note-target-close').text('Close')
+
+ updateTargetButtons: (e) =>
+ textarea = $(e.target)
+ form = textarea.parents('form')
+
+ if textarea.val().trim().length > 0
+ form.find('.js-note-target-reopen').text('Comment & reopen')
+ form.find('.js-note-target-close').text('Comment & close')
+ else
+ form.find('.js-note-target-reopen').text('Reopen')
+ form.find('.js-note-target-close').text('Close')
+
+
+
@Notes = Notes
diff --git a/app/assets/javascripts/project.js.coffee b/app/assets/javascripts/project.js.coffee
index f7c64b4b816..d81cc087df9 100644
--- a/app/assets/javascripts/project.js.coffee
+++ b/app/assets/javascripts/project.js.coffee
@@ -47,7 +47,7 @@ $ ->
$(@).parents('.no-ssh-key-message').hide()
e.preventDefault()
- $('.project-side .star').on 'ajax:success', (e, data, status, xhr) ->
+ $('.project-home-panel .star').on 'ajax:success', (e, data, status, xhr) ->
$(@).toggleClass('on').find('.count').html(data.star_count)
.on 'ajax:error', (e, xhr, status, error) ->
new Flash('Star toggle failed. Try again later.', 'alert')
diff --git a/app/assets/javascripts/shortcuts.js.coffee b/app/assets/javascripts/shortcuts.js.coffee
index e7e40a066ec..e9aeb1e9525 100644
--- a/app/assets/javascripts/shortcuts.js.coffee
+++ b/app/assets/javascripts/shortcuts.js.coffee
@@ -1,11 +1,30 @@
-class Shortcuts
+class @Shortcuts
constructor: ->
+ @enabledHelp = []
+ Mousetrap.reset()
+ Mousetrap.bind('?', @selectiveHelp)
+ Mousetrap.bind('s', Shortcuts.focusSearch)
+
+ selectiveHelp: (e) =>
+ Shortcuts.showHelp(e, @enabledHelp)
+
+ @showHelp: (e, location) ->
if $('#modal-shortcuts').length > 0
$('#modal-shortcuts').modal('show')
else
$.ajax(
url: '/help/shortcuts',
- dataType: "script"
+ dataType: 'script',
+ success: (e) ->
+ if location and location.length > 0
+ for l in location
+ $(l).show()
+ else
+ $('.hidden-shortcut').show()
+ $('.js-more-help-button').remove()
)
+ e.preventDefault()
-@Shortcuts = Shortcuts
+ @focusSearch: (e) ->
+ $('#search').focus()
+ e.preventDefault()
diff --git a/app/assets/javascripts/shortcuts_dashboard_navigation.js.coffee b/app/assets/javascripts/shortcuts_dashboard_navigation.js.coffee
new file mode 100644
index 00000000000..d522d9f3b90
--- /dev/null
+++ b/app/assets/javascripts/shortcuts_dashboard_navigation.js.coffee
@@ -0,0 +1,14 @@
+#= require shortcuts
+
+class @ShortcutsDashboardNavigation extends Shortcuts
+ constructor: ->
+ super()
+ Mousetrap.bind('g a', -> ShortcutsDashboardNavigation.findAndollowLink('.shortcuts-activity'))
+ Mousetrap.bind('g p', -> ShortcutsDashboardNavigation.findAndollowLink('.shortcuts-projects'))
+ Mousetrap.bind('g i', -> ShortcutsDashboardNavigation.findAndollowLink('.shortcuts-issues'))
+ Mousetrap.bind('g m', -> ShortcutsDashboardNavigation.findAndollowLink('.shortcuts-merge_requests'))
+
+ @findAndollowLink: (selector) ->
+ link = $(selector).attr('href')
+ if link
+ window.location = link
diff --git a/app/assets/javascripts/shortcuts_issueable.coffee b/app/assets/javascripts/shortcuts_issueable.coffee
new file mode 100644
index 00000000000..b8dae71e037
--- /dev/null
+++ b/app/assets/javascripts/shortcuts_issueable.coffee
@@ -0,0 +1,19 @@
+#= require shortcuts_navigation
+
+class @ShortcutsIssueable extends ShortcutsNavigation
+ constructor: (isMergeRequest) ->
+ super()
+ Mousetrap.bind('a', ->
+ $('.js-assignee').select2('open')
+ return false
+ )
+ Mousetrap.bind('m', ->
+ $('.js-milestone').select2('open')
+ return false
+ )
+
+ if isMergeRequest
+ @enabledHelp.push('.hidden-shortcut.merge_reuests')
+ else
+ @enabledHelp.push('.hidden-shortcut.issues')
+
diff --git a/app/assets/javascripts/shortcuts_navigation.coffee b/app/assets/javascripts/shortcuts_navigation.coffee
new file mode 100644
index 00000000000..e592b700e7c
--- /dev/null
+++ b/app/assets/javascripts/shortcuts_navigation.coffee
@@ -0,0 +1,20 @@
+#= require shortcuts
+
+class @ShortcutsNavigation extends Shortcuts
+ constructor: ->
+ super()
+ Mousetrap.bind('g p', -> ShortcutsNavigation.findAndollowLink('.shortcuts-project'))
+ Mousetrap.bind('g f', -> ShortcutsNavigation.findAndollowLink('.shortcuts-tree'))
+ Mousetrap.bind('g c', -> ShortcutsNavigation.findAndollowLink('.shortcuts-commits'))
+ Mousetrap.bind('g n', -> ShortcutsNavigation.findAndollowLink('.shortcuts-network'))
+ Mousetrap.bind('g g', -> ShortcutsNavigation.findAndollowLink('.shortcuts-graphs'))
+ Mousetrap.bind('g i', -> ShortcutsNavigation.findAndollowLink('.shortcuts-issues'))
+ Mousetrap.bind('g m', -> ShortcutsNavigation.findAndollowLink('.shortcuts-merge_requests'))
+ Mousetrap.bind('g w', -> ShortcutsNavigation.findAndollowLink('.shortcuts-wiki'))
+ Mousetrap.bind('g s', -> ShortcutsNavigation.findAndollowLink('.shortcuts-snippets'))
+ @enabledHelp.push('.hidden-shortcut.project')
+
+ @findAndollowLink: (selector) ->
+ link = $(selector).attr('href')
+ if link
+ window.location = link
diff --git a/app/assets/javascripts/shortcuts_network.js.coffee b/app/assets/javascripts/shortcuts_network.js.coffee
new file mode 100644
index 00000000000..cc95ad7ebfe
--- /dev/null
+++ b/app/assets/javascripts/shortcuts_network.js.coffee
@@ -0,0 +1,12 @@
+#= require shortcuts_navigation
+
+class @ShortcutsNetwork extends ShortcutsNavigation
+ constructor: (@graph) ->
+ super()
+ Mousetrap.bind(['left', 'h'], @graph.scrollLeft)
+ Mousetrap.bind(['right', 'l'], @graph.scrollRight)
+ Mousetrap.bind(['up', 'k'], @graph.scrollUp)
+ Mousetrap.bind(['down', 'j'], @graph.scrollDown)
+ Mousetrap.bind(['shift+up', 'shift+k'], @graph.scrollTop)
+ Mousetrap.bind(['shift+down', 'shift+j'], @graph.scrollBottom)
+ @enabledHelp.push('.hidden-shortcut.network')
diff --git a/app/assets/javascripts/zen_mode.js.coffee b/app/assets/javascripts/zen_mode.js.coffee
new file mode 100644
index 00000000000..aea707d8550
--- /dev/null
+++ b/app/assets/javascripts/zen_mode.js.coffee
@@ -0,0 +1,51 @@
+class @ZenMode
+ @fullscreen_prefix = 'fullscreen_'
+ @ESC = 27
+
+ constructor: ->
+ @active_zen_area = null
+ @active_checkbox = null
+
+ $('body').on 'change', '.zennable input[type=checkbox]', (e) =>
+ checkbox = e.currentTarget;
+ if checkbox.checked
+ Mousetrap.pause()
+ @udpateActiveZenArea(checkbox)
+ else
+ @exitZenMode()
+
+ $(document).on 'keydown', (e) =>
+ console.log("esc")
+ if e.keyCode is ZenMode.ESC
+ @exitZenMode()
+
+ $(window).on 'hashchange', @updateZenModeFromLocationHash
+
+ udpateActiveZenArea: (checkbox) =>
+ @active_checkbox = $(checkbox)
+ @active_checkbox.prop('checked', true)
+ @active_zen_area = @active_checkbox.parent().find('textarea')
+ @active_zen_area.focus()
+ window.location.hash = ZenMode.fullscreen_prefix + @active_checkbox.prop('id')
+
+ exitZenMode: =>
+ if @active_zen_area isnt null
+ Mousetrap.unpause()
+ @active_checkbox.prop('checked', false)
+ @active_zen_area = null
+ @active_checkbox = null
+ window.location.hash = ''
+
+ checkboxFromLocationHash: (e) ->
+ id = $.trim(window.location.hash.replace('#' + ZenMode.fullscreen_prefix, ''))
+ if id
+ return $('.zennable input[type=checkbox]#' + id)[0]
+ else
+ return null
+
+ updateZenModeFromLocationHash: (e) =>
+ checkbox = @checkboxFromLocationHash()
+ if checkbox
+ @udpateActiveZenArea(checkbox)
+ else
+ @exitZenMode()
diff --git a/app/assets/stylesheets/generic/common.scss b/app/assets/stylesheets/generic/common.scss
index 9d3c9f372a9..803219a2e86 100644
--- a/app/assets/stylesheets/generic/common.scss
+++ b/app/assets/stylesheets/generic/common.scss
@@ -128,7 +128,7 @@ p.time {
}
.highlight_word {
- border-bottom: 2px solid #F90;
+ background: #fafe3d;
}
.thin_area{
diff --git a/app/assets/stylesheets/generic/forms.scss b/app/assets/stylesheets/generic/forms.scss
index 2a31cae5dfb..3b90c4f27f0 100644
--- a/app/assets/stylesheets/generic/forms.scss
+++ b/app/assets/stylesheets/generic/forms.scss
@@ -83,3 +83,140 @@ label {
.form-control {
@include box-shadow(none);
}
+
+.issuable-description {
+ margin-top: 35px;
+}
+
+.zennable {
+ position: relative;
+
+ input {
+ display: none;
+ }
+
+ .collapse {
+ display: none;
+ opacity: 0.5;
+
+ &:before {
+ content: '\f066';
+ font-family: FontAwesome;
+ color: #000;
+ font-size: 28px;
+ position: relative;
+ padding: 30px 40px 0 0;
+ }
+
+ &:hover {
+ opacity: 0.8;
+ }
+ }
+
+ .expand {
+ opacity: 0.5;
+
+ &:before {
+ content: '\f065';
+ font-family: FontAwesome;
+ color: #000;
+ font-size: 14px;
+ line-height: 14px;
+ padding-right: 20px;
+ position: relative;
+ vertical-align: middle;
+ }
+
+ &:hover {
+ opacity: 0.8;
+ }
+ }
+
+ input:checked ~ .zen-backdrop .expand {
+ display: none;
+ }
+
+ input:checked ~ .zen-backdrop .collapse {
+ display: block;
+ position: absolute;
+ top: 0;
+ }
+
+ label {
+ position: absolute;
+ top: -26px;
+ right: 0;
+ font-variant: small-caps;
+ text-transform: uppercase;
+ font-size: 10px;
+ padding: 4px;
+ font-weight: 500;
+ letter-spacing: 1px;
+
+ &:before {
+ display: inline-block;
+ width: 10px;
+ height: 14px;
+ }
+ }
+
+ input:checked ~ .zen-backdrop {
+ background-color: white;
+ position: fixed;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ z-index: 1031;
+
+ textarea {
+ border: none;
+ box-shadow: none;
+ border-radius: 0;
+ color: #000;
+ font-size: 20px;
+ line-height: 26px;
+ padding: 30px;
+ display: block;
+ outline: none;
+ resize: none;
+ height: 100vh;
+ max-width: 900px;
+ margin: 0 auto;
+ }
+ }
+
+ .zen-backdrop textarea::-webkit-input-placeholder {
+ color: white;
+ }
+
+ .zen-backdrop textarea:-moz-placeholder {
+ color: white;
+ }
+
+ .zen-backdrop textarea::-moz-placeholder {
+ color: white;
+ }
+
+ .zen-backdrop textarea:-ms-input-placeholder {
+ color: white;
+ }
+
+ input:checked ~ .zen-backdrop textarea::-webkit-input-placeholder {
+ color: #999;
+ }
+
+ input:checked ~ .zen-backdrop textarea:-moz-placeholder {
+ color: #999;
+ opacity: 1;
+ }
+
+ input:checked ~ .zen-backdrop textarea::-moz-placeholder {
+ color: #999;
+ opacity: 1;
+ }
+
+ input:checked ~ .zen-backdrop textarea:-ms-input-placeholder {
+ color: #999;
+ }
+}
diff --git a/app/assets/stylesheets/generic/issue_box.scss b/app/assets/stylesheets/generic/issue_box.scss
index c468980f64d..0679690c05f 100644
--- a/app/assets/stylesheets/generic/issue_box.scss
+++ b/app/assets/stylesheets/generic/issue_box.scss
@@ -88,6 +88,10 @@
.description {
padding: 0 15px 10px 15px;
+
+ code {
+ white-space: pre-wrap;
+ }
}
.title, .context, .description {
diff --git a/app/assets/stylesheets/generic/lists.scss b/app/assets/stylesheets/generic/lists.scss
index 0cab6c44c91..d347ab2c2e4 100644
--- a/app/assets/stylesheets/generic/lists.scss
+++ b/app/assets/stylesheets/generic/lists.scss
@@ -39,7 +39,7 @@
&:hover {
background: $hover;
- border-bottom: 1px solid #ADF;
+ border-bottom: 1px solid darken($hover, 10%);
}
&:last-child {
diff --git a/app/assets/stylesheets/generic/timeline.scss b/app/assets/stylesheets/generic/timeline.scss
new file mode 100644
index 00000000000..f29cf25fa4c
--- /dev/null
+++ b/app/assets/stylesheets/generic/timeline.scss
@@ -0,0 +1,77 @@
+.timeline {
+ list-style: none;
+ padding: 20px 0 20px;
+ position: relative;
+
+ &:before {
+ top: 0;
+ bottom: 0;
+ position: absolute;
+ content: " ";
+ width: 3px;
+ background-color: #eeeeee;
+ margin-left: 29px;
+ }
+
+ .timeline-entry {
+ position: relative;
+ margin-top: 5px;
+ margin-left: 30px;
+ margin-bottom: 10px;
+ clear: both;
+
+
+ &:target {
+ .timeline-entry-inner .timeline-content {
+ -webkit-animation:target-note 2s linear;
+ background: $hover;
+ }
+ }
+
+ .timeline-entry-inner {
+ position: relative;
+ margin-left: -20px;
+
+ &:before, &:after {
+ content: " ";
+ display: table;
+ }
+
+ .timeline-icon {
+ margin-top: 2px;
+ background: #fff;
+ color: #737881;
+ float: left;
+ @include border-radius(40px);
+ @include box-shadow(0 0 0 3px #EEE);
+ overflow: hidden;
+
+ .avatar {
+ margin: 0;
+ padding: 0;
+ }
+ }
+
+ .timeline-content {
+ position: relative;
+ background: #f5f5f6;
+ padding: 10px 15px;
+ margin-left: 60px;
+
+ &:after {
+ content: '';
+ display: block;
+ position: absolute;
+ width: 0;
+ height: 0;
+ border-style: solid;
+ border-width: 9px 9px 9px 0;
+ border-color: transparent #f5f5f6 transparent transparent;
+ left: 0;
+ top: 10px;
+ margin-left: -9px;
+ }
+ }
+ }
+ }
+}
diff --git a/app/assets/stylesheets/generic/typography.scss b/app/assets/stylesheets/generic/typography.scss
index 9aa819d40fc..385a627b4be 100644
--- a/app/assets/stylesheets/generic/typography.scss
+++ b/app/assets/stylesheets/generic/typography.scss
@@ -40,7 +40,7 @@ a {
outline: none;
color: $link_color;
&:hover {
- text-decoration: none;
+ text-decoration: underline;
color: $link_hover_color;
}
@@ -89,6 +89,8 @@ a:focus {
.wiki {
@include md-typography;
+ word-wrap: break-word;
+
/* Link to current header. */
h1, h2, h3, h4, h5, h6 {
position: relative;
diff --git a/app/assets/stylesheets/main/layout.scss b/app/assets/stylesheets/main/layout.scss
index e28da65c01f..2800feb81f2 100644
--- a/app/assets/stylesheets/main/layout.scss
+++ b/app/assets/stylesheets/main/layout.scss
@@ -16,3 +16,4 @@ body {
.container .content {
margin: 0 0;
}
+
diff --git a/app/assets/stylesheets/main/variables.scss b/app/assets/stylesheets/main/variables.scss
index 02ce2c8338f..72d84226fe7 100644
--- a/app/assets/stylesheets/main/variables.scss
+++ b/app/assets/stylesheets/main/variables.scss
@@ -2,13 +2,13 @@
* General Colors
*/
$style_color: #474D57;
-$hover: #D9EDF7;
+$hover: #FFECDB;
/*
* Link colors
*/
$link_color: #446e9b;
-$link_hover_color: #2FA0BB;
+$link_hover_color: darken($link-color, 10%);
$btn-border: 1px solid #ccc;
diff --git a/app/assets/stylesheets/sections/dashboard.scss b/app/assets/stylesheets/sections/dashboard.scss
index 6487e0acd91..d181d83e857 100644
--- a/app/assets/stylesheets/sections/dashboard.scss
+++ b/app/assets/stylesheets/sections/dashboard.scss
@@ -60,12 +60,13 @@
}
.project-row, .group-row {
- padding: 8px 15px !important;
+ padding: 0 !important;
font-size: 14px;
line-height: 24px;
a {
display: block;
+ padding: 8px 15px;
}
.project-name, .group-name {
@@ -89,20 +90,19 @@
}
}
+.project-description {
+ overflow: hidden;
+}
+
.project-access-icon {
margin-left: 10px;
float: left;
margin-right: 15px;
font-size: 20px;
margin-bottom: 15px;
- border: 1px solid #EEE;
- padding: 8px 12px;
- border-radius: 50px;
- background: #f5f5f5;
- text-align: center;
i {
- color: #BBB;
+ color: #888;
}
}
diff --git a/app/assets/stylesheets/sections/diff.scss b/app/assets/stylesheets/sections/diff.scss
index 488d06919b0..758f15c8013 100644
--- a/app/assets/stylesheets/sections/diff.scss
+++ b/app/assets/stylesheets/sections/diff.scss
@@ -125,8 +125,6 @@
}
.line_content {
display: block;
- white-space: pre;
- height: 18px;
margin: 0px;
padding: 0px 0.5em;
border: none;
@@ -341,3 +339,12 @@
margin: 0;
border: none;
}
+
+.diff-file .line_content {
+ white-space: pre;
+}
+
+.diff-wrap-lines .line_content {
+ white-space: pre-wrap;
+}
+
diff --git a/app/assets/stylesheets/sections/help.scss b/app/assets/stylesheets/sections/help.scss
index 90ed98ba25f..07c62f98c36 100644
--- a/app/assets/stylesheets/sections/help.scss
+++ b/app/assets/stylesheets/sections/help.scss
@@ -17,3 +17,56 @@
}
}
}
+
+
+.shortcut-mappings {
+ font-size: 12px;
+ color: #555;
+
+ tbody:first-child tr:first-child {
+ padding-top: 0
+ }
+
+ th {
+ padding-top: 15px;
+ font-size: 14px;
+ line-height: 1.5;
+ color: #333;
+ text-align: left
+ }
+
+ td {
+ padding-top: 3px;
+ padding-bottom: 3px;
+ vertical-align: top;
+ line-height: 20px
+ }
+
+ .shortcut {
+ padding-right: 10px;
+ color: #999;
+ text-align: right;
+ white-space: nowrap
+ }
+
+ .key {
+ @extend .label;
+ @extend .label-inverse;
+ font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
+ padding: 3px 5px;
+ }
+}
+
+.modal-body {
+ position: relative;
+ overflow-y: auto;
+ padding: 15px;
+}
+
+body.modal-open {
+ overflow: hidden;
+}
+
+.modal .modal-dialog {
+ width: 860px;
+}
diff --git a/app/assets/stylesheets/sections/login.scss b/app/assets/stylesheets/sections/login.scss
index 77ebef690c3..1bcb1f6d68e 100644
--- a/app/assets/stylesheets/sections/login.scss
+++ b/app/assets/stylesheets/sections/login.scss
@@ -6,6 +6,21 @@
}
.login-box{
+ padding: 0 15px;
+
+ .login-heading h3 {
+ font-weight: 300;
+ line-height: 2;
+ }
+
+ .login-footer {
+ margin-top: 10px;
+ }
+
+ .btn {
+ padding: 12px !important;
+ @extend .btn-block;
+ }
}
.brand-image {
@@ -19,7 +34,7 @@
}
}
- .login-logo{
+ .login-logo {
margin: 10px 0 30px 0;
display: block;
}
@@ -64,4 +79,8 @@
color: #a00;
}
}
+
+ .brand-holder {
+ border-right: 1px solid #EEE;
+ }
}
diff --git a/app/assets/stylesheets/sections/nav.scss b/app/assets/stylesheets/sections/nav.scss
index f5d09c2df10..778953984d6 100644
--- a/app/assets/stylesheets/sections/nav.scss
+++ b/app/assets/stylesheets/sections/nav.scss
@@ -35,39 +35,31 @@
width: 1%;
&.active {
a {
- color: #333;
+ color: $link_color;
font-weight: bold;
&:after {
content: '';
display: block;
position: relative;
- bottom: 8px;
- left: 50%;
- width: 0;
- height: 0;
- border-color: transparent transparent #333 transparent;
+ bottom: -1px;
+ border-color: $link_color;
border-style: solid;
- border-width: 6px;
- margin-left: -6px;
+ border-width: 2px;
}
}
}
&:hover {
a {
- color: $link_color;
+ color: $link_hover_color;
&:after {
content: '';
display: block;
position: relative;
- bottom: 8px;
- left: 50%;
- width: 0;
- height: 0;
- border-color: transparent transparent $link_color transparent;
+ bottom: -1px;
+ border-color: $link_hover_color;
border-style: solid;
- border-width: 6px;
- margin-left: -6px;
+ border-width: 2px;
}
}
}
@@ -90,7 +82,6 @@
line-height: 34px;
color: #777;
text-shadow: 0 1px 1px white;
- padding: 0 10px;
text-decoration: none;
padding-top: 2px;
}
diff --git a/app/assets/stylesheets/sections/notes.scss b/app/assets/stylesheets/sections/notes.scss
index 18db7abc64e..4e13e30bac8 100644
--- a/app/assets/stylesheets/sections/notes.scss
+++ b/app/assets/stylesheets/sections/notes.scss
@@ -17,7 +17,6 @@ ul.notes {
.discussion-header,
.note-header {
@extend .cgray;
- padding-top: 5px;
padding-bottom: 15px;
.avatar {
@@ -43,34 +42,19 @@ ul.notes {
}
.discussion {
- padding: 10px 0;
overflow: hidden;
display: block;
position:relative;
- border-bottom: 1px solid #EEE;
-
- .discussion-body {
- margin-left: 50px;
- }
}
.note {
- padding: 8px 0;
- overflow: hidden;
display: block;
position:relative;
- border-bottom: 1px solid #eee;
- p { color: $style_color; }
-
- .avatar {
- margin-top: 3px;
- }
.attachment {
font-size: 14px;
}
.note-body {
@include md-typography;
- margin-left: 43px;
}
.note-header {
padding-bottom: 3px;
@@ -80,11 +64,6 @@ ul.notes {
border-bottom: none;
}
}
-
- .note:target {
- -webkit-animation:target-note 2s linear;
- background: #fffff0;
- }
}
.diff-file .notes_holder {
@@ -99,7 +78,7 @@ ul.notes {
&.notes_line {
text-align: center;
padding: 10px 0;
- background: #eee;
+ background: #FFF;
}
&.notes_line2 {
text-align: center;
@@ -362,3 +341,7 @@ ul.notes {
border-top: 1px solid #DDD;
}
}
+
+.discussion-notes-count {
+ font-size: 16px;
+}
diff --git a/app/assets/stylesheets/sections/projects.scss b/app/assets/stylesheets/sections/projects.scss
index 6757cbd30f6..918ac554ea3 100644
--- a/app/assets/stylesheets/sections/projects.scss
+++ b/app/assets/stylesheets/sections/projects.scss
@@ -15,62 +15,64 @@
}
.project-home-panel {
- border-bottom: 1px solid #DDD;
- padding-bottom: 15px;
- margin-bottom: 30px;
+ margin-bottom: 15px;
&.empty-project {
- border-bottom: 0px;
- padding-bottom: 15px;
- margin-bottom: 0px;
+ border-bottom: 0px;
+ padding-bottom: 15px;
+ margin-bottom: 0px;
}
- .project-home-title {
- font-size: 18px;
- color: #444;
- margin: 0;
- line-height: 32px;
- }
.project-home-dropdown {
margin-left: 10px;
float: right;
}
- .project-home-extra {
- margin-top: 15px;
+
+ .project-home-row {
+ @extend .clearfix;
+ margin-bottom: 15px;
.project-home-desc {
float: left;
- color: #777;
- margin-bottom: 10px;
+ color: #666;
+ font-size: 16px;
}
- .project-home-links {
+ .star-fork-buttons {
float: right;
- a {
- margin-left: 10px;
- font-weight: 500;
+ width: 200px;
+ font-size: 14px;
+ font-weight: bold;
+
+ .star-buttons, .fork-buttons {
+ float: right;
+ margin-left: 20px;
+
+ .count {
+ margin-left: 5px;
+ }
}
}
}
.visibility-level-label {
- font-size: 17px;
- background: #f1f1f1;
- border-radius: 4px;
- color: #444;
- position: absolute;
- margin-left: -55px;
- text-shadow: 0 1px 1px #FFF;
- width: 40px;
- text-align: center;
- padding: 6px;
-
+ color: #555;
+ font-weight: bold;
i {
color: inherit;
}
}
}
+.project-home-links {
+ padding: 10px 0px;
+ float: right;
+ a {
+ margin-left: 10px;
+ font-weight: 500;
+ }
+}
+
.git-clone-holder {
.project-home-dropdown + & {
margin-right: 45px;
@@ -159,6 +161,7 @@ ul.nav.nav-projects-tabs {
li {
.project-info {
margin-bottom: 10px;
+ overflow: hidden;
}
.access-icon {
@@ -192,10 +195,11 @@ ul.nav.nav-projects-tabs {
background-image: none;
.btn, &.btn {
+ white-space: normal;
text-align: left;
padding: 10px 15px;
- background-color: #F1f1f1;
- border-color: #EEE;
+ background-color: #F9F9F9;
+ border-color: #DDD;
&:hover {
background-color: #eee;
diff --git a/app/assets/stylesheets/sections/search.scss b/app/assets/stylesheets/sections/search.scss
new file mode 100644
index 00000000000..bdaa17ac339
--- /dev/null
+++ b/app/assets/stylesheets/sections/search.scss
@@ -0,0 +1,7 @@
+.search-results {
+ .search-result-row {
+ border-bottom: 1px solid #EEE;
+ padding-bottom: 10px;
+ margin-bottom: 10px;
+ }
+}
diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb
index 3c8e7ec73f6..6845fc5e6e6 100644
--- a/app/controllers/projects/branches_controller.rb
+++ b/app/controllers/projects/branches_controller.rb
@@ -17,9 +17,17 @@ class Projects::BranchesController < Projects::ApplicationController
end
def create
- @branch = CreateBranchService.new.execute(project, params[:branch_name], params[:ref], current_user)
-
- redirect_to project_tree_path(@project, @branch.name)
+ result = CreateBranchService.new.execute(project,
+ params[:branch_name],
+ params[:ref],
+ current_user)
+ if result[:status] == :success
+ @branch = result[:branch]
+ redirect_to project_tree_path(@project, @branch.name)
+ else
+ @error = result[:message]
+ render action: 'new'
+ end
end
def destroy
diff --git a/app/controllers/projects/edit_tree_controller.rb b/app/controllers/projects/edit_tree_controller.rb
index ca83b21f429..72a41f771c0 100644
--- a/app/controllers/projects/edit_tree_controller.rb
+++ b/app/controllers/projects/edit_tree_controller.rb
@@ -31,7 +31,7 @@ class Projects::EditTreeController < Projects::BaseTreeController
diffy = Diffy::Diff.new(@blob.data, @content, diff: '-U 3',
include_diff_info: true)
- @diff = Gitlab::DiffParser.new(diffy.diff.scan(/.*\n/))
+ @diff_lines = Gitlab::Diff::Parser.new.parse(diffy.diff.scan(/.*\n/))
render layout: false
end
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index bde90466ea1..0b49803cfec 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -20,7 +20,7 @@ class Projects::IssuesController < Projects::ApplicationController
terms = params['issue_search']
@issues = issues_filtered
- @issues = @issues.where("title LIKE ? OR description LIKE ?", "%#{terms}%", "%#{terms}%") if terms.present?
+ @issues = @issues.full_search(terms) if terms.present?
@issues = @issues.page(params[:page]).per(20)
assignee_id, milestone_id = params[:assignee_id], params[:milestone_id]
diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb
index 87d1c942034..6c7bde9c5d5 100644
--- a/app/controllers/projects/labels_controller.rb
+++ b/app/controllers/projects/labels_controller.rb
@@ -52,7 +52,7 @@ class Projects::LabelsController < Projects::ApplicationController
respond_to do |format|
format.html { redirect_to project_labels_path(@project), notice: 'Label was removed' }
- format.js { render nothing: true }
+ format.js
end
end
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb
index 2154b6ed2eb..7b08b79d236 100644
--- a/app/controllers/projects/notes_controller.rb
+++ b/app/controllers/projects/notes_controller.rb
@@ -30,8 +30,10 @@ class Projects::NotesController < Projects::ApplicationController
end
def update
- note.update_attributes(note_params)
- note.reset_events_cache
+ if note.editable?
+ note.update_attributes(note_params)
+ note.reset_events_cache
+ end
respond_to do |format|
format.json { render_note_json(note) }
@@ -40,8 +42,10 @@ class Projects::NotesController < Projects::ApplicationController
end
def destroy
- note.destroy
- note.reset_events_cache
+ if note.editable?
+ note.destroy
+ note.reset_events_cache
+ end
respond_to do |format|
format.js { render nothing: true }
diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb
index a6b7ae3f127..5ec9c576a66 100644
--- a/app/controllers/projects/raw_controller.rb
+++ b/app/controllers/projects/raw_controller.rb
@@ -29,12 +29,10 @@ class Projects::RawController < Projects::ApplicationController
private
def get_blob_type
- if @blob.mime_type =~ /html|javascript/
+ if @blob.text?
'text/plain; charset=utf-8'
- elsif @blob.name =~ /(?:msi|exe|rar|r0\d|7z|7zip|zip)$/
- 'application/octet-stream'
else
- @blob.mime_type
+ 'application/octet-stream'
end
end
end
diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb
index 25026973118..cba058fe214 100644
--- a/app/controllers/projects/snippets_controller.rb
+++ b/app/controllers/projects/snippets_controller.rb
@@ -63,7 +63,7 @@ class Projects::SnippetsController < Projects::ApplicationController
def raw
send_data(
@snippet.content,
- type: "text/plain",
+ type: 'text/plain; charset=utf-8',
disposition: 'inline',
filename: @snippet.file_name
)
diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb
index e03a9f4d66d..c80ad8355d5 100644
--- a/app/controllers/projects/tags_controller.rb
+++ b/app/controllers/projects/tags_controller.rb
@@ -13,10 +13,16 @@ class Projects::TagsController < Projects::ApplicationController
end
def create
- @tag = CreateTagService.new.execute(@project, params[:tag_name],
- params[:ref], current_user)
-
- redirect_to project_tags_path(@project)
+ result = CreateTagService.new.execute(@project, params[:tag_name],
+ params[:ref], params[:message],
+ current_user)
+ if result[:status] == :success
+ @tag = result[:tag]
+ redirect_to project_tags_path(@project)
+ else
+ @error = result[:message]
+ render action: 'new'
+ end
end
def destroy
@@ -28,7 +34,7 @@ class Projects::TagsController < Projects::ApplicationController
respond_to do |format|
format.html { redirect_to project_tags_path }
- format.js { render nothing: true }
+ format.js
end
end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index f23afaf28fa..b3380a6ff23 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -103,7 +103,15 @@ class ProjectsController < ApplicationController
::Projects::DestroyService.new(@project, current_user, {}).execute
respond_to do |format|
- format.html { redirect_to root_path }
+ format.html do
+ flash[:alert] = "Project deleted."
+
+ if request.referer.include?("/admin")
+ redirect_to admin_projects_path
+ else
+ redirect_to projects_dashboard_path
+ end
+ end
end
end
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index 8df84e9884a..55926a1ed22 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -4,14 +4,33 @@ class SearchController < ApplicationController
def show
@project = Project.find_by(id: params[:project_id]) if params[:project_id].present?
@group = Group.find_by(id: params[:group_id]) if params[:group_id].present?
+ @scope = params[:scope]
+ @show_snippets = params[:snippets].eql? 'true'
- if @project
- return access_denied! unless can?(current_user, :download_code, @project)
+ @search_results = if @project
+ return access_denied! unless can?(current_user, :download_code, @project)
- @search_results = Search::ProjectService.new(@project, current_user, params).execute
- else
- @search_results = Search::GlobalService.new(current_user, params).execute
- end
+ unless %w(blobs notes issues merge_requests wiki_blobs).
+ include?(@scope)
+ @scope = 'blobs'
+ end
+
+ Search::ProjectService.new(@project, current_user, params).execute
+ elsif @show_snippets
+ unless %w(snippet_blobs snippet_titles).include?(@scope)
+ @scope = 'snippet_blobs'
+ end
+
+ Search::SnippetService.new(current_user, params).execute
+ else
+ unless %w(projects issues merge_requests).include?(@scope)
+ @scope = 'projects'
+ end
+
+ Search::GlobalService.new(current_user, params).execute
+ end
+
+ @objects = @search_results.objects(@scope, params[:page])
end
def autocomplete
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index e75db61e680..3927584235e 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -86,7 +86,7 @@ class SnippetsController < ApplicationController
def raw
send_data(
@snippet.content,
- type: "text/plain",
+ type: 'text/plain; charset=utf-8',
disposition: 'inline',
filename: @snippet.file_name
)
diff --git a/app/finders/base_finder.rb b/app/finders/issuable_finder.rb
index ec5f5919d7e..56c4f22120d 100644
--- a/app/finders/base_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -1,4 +1,4 @@
-# BaseFinder
+# IssuableFinder
#
# Used to filter Issues and MergeRequests collections by set of params
#
@@ -16,7 +16,9 @@
# label_name: string
# sort: string
#
-class BaseFinder
+require_relative 'projects_finder'
+
+class IssuableFinder
attr_accessor :current_user, :params
def execute(current_user, params)
diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb
index 8e0c606249e..20a2b0ce8f0 100644
--- a/app/finders/issues_finder.rb
+++ b/app/finders/issues_finder.rb
@@ -15,7 +15,7 @@
# label_name: string
# sort: string
#
-class IssuesFinder < BaseFinder
+class IssuesFinder < IssuableFinder
def klass
Issue
end
diff --git a/app/finders/merge_requests_finder.rb b/app/finders/merge_requests_finder.rb
index 3727149c8fb..b258216d0d4 100644
--- a/app/finders/merge_requests_finder.rb
+++ b/app/finders/merge_requests_finder.rb
@@ -15,7 +15,7 @@
# label_name: string
# sort: string
#
-class MergeRequestsFinder < BaseFinder
+class MergeRequestsFinder < IssuableFinder
def klass
MergeRequest
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e6d50bea4d1..c2c9301cc17 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -178,6 +178,8 @@ module ApplicationHelper
def search_placeholder
if @project && @project.persisted?
"Search in this project"
+ elsif @snippet || @snippets || @show_snippets
+ 'Search snippets'
elsif @group && @group.persisted?
"Search in this group"
else
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index f61aa259154..cab2984a4c4 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -16,38 +16,6 @@ module CommitsHelper
commit_person_link(commit, options.merge(source: :committer))
end
- def each_diff_line(diff, index)
- Gitlab::DiffParser.new(diff.diff.lines.to_a, diff.new_path)
- .each do |full_line, type, line_code, line_new, line_old|
- yield(full_line, type, line_code, line_new, line_old)
- end
- end
-
- def each_diff_line_near(diff, index, expected_line_code)
- max_number_of_lines = 16
-
- prev_match_line = nil
- prev_lines = []
-
- each_diff_line(diff, index) do |full_line, type, line_code, line_new, line_old|
- line = [full_line, type, line_code, line_new, line_old]
- if line_code != expected_line_code
- if type == "match"
- prev_lines.clear
- prev_match_line = line
- else
- prev_lines.push(line)
- prev_lines.shift if prev_lines.length >= max_number_of_lines
- end
- else
- yield(prev_match_line) if !prev_match_line.nil?
- prev_lines.each { |ln| yield(ln) }
- yield(line)
- break
- end
- end
- end
-
def image_diff_class(diff)
if diff.deleted_file
"deleted"
@@ -63,14 +31,6 @@ module CommitsHelper
escape_javascript(render "projects/commits/#{template}", commit: commit, project: project) unless commit.nil?
end
- def diff_line_content(line)
- if line.blank?
- " &nbsp;"
- else
- line
- end
- end
-
# Breadcrumb links for a Project and, if applicable, a tree path
def commits_breadcrumbs
return unless @project && @ref
@@ -105,82 +65,6 @@ module CommitsHelper
branches.sort.map { |branch| link_to(branch, project_tree_path(project, branch)) }.join(", ").html_safe
end
- def parallel_diff_lines(project, commit, diff, file)
- old_file = project.repository.blob_at(commit.parent_id, diff.old_path) if commit.parent_id
- deleted_lines = {}
- added_lines = {}
- each_diff_line(diff, 0) do |line, type, line_code, line_new, line_old|
- if type == "old"
- deleted_lines[line_old] = { line_code: line_code, type: type, line: line }
- elsif type == "new"
- added_lines[line_new] = { line_code: line_code, type: type, line: line }
- end
- end
- max_length = old_file ? [old_file.loc, file.loc].max : file.loc
-
- offset1 = 0
- offset2 = 0
- old_lines = []
- new_lines = []
-
- max_length.times do |line_index|
- line_index1 = line_index - offset1
- line_index2 = line_index - offset2
- deleted_line = deleted_lines[line_index1 + 1]
- added_line = added_lines[line_index2 + 1]
- old_line = old_file.lines[line_index1] if old_file
- new_line = file.lines[line_index2]
-
- if deleted_line && added_line
- elsif deleted_line
- new_line = nil
- offset2 += 1
- elsif added_line
- old_line = nil
- offset1 += 1
- end
-
- old_lines[line_index] = DiffLine.new
- new_lines[line_index] = DiffLine.new
-
- # old
- if line_index == 0 && diff.new_file
- old_lines[line_index].type = :file_created
- old_lines[line_index].content = 'File was created'
- elsif deleted_line
- old_lines[line_index].type = :deleted
- old_lines[line_index].content = old_line
- old_lines[line_index].num = line_index1 + 1
- old_lines[line_index].code = deleted_line[:line_code]
- elsif old_line
- old_lines[line_index].type = :no_change
- old_lines[line_index].content = old_line
- old_lines[line_index].num = line_index1 + 1
- else
- old_lines[line_index].type = :added
- end
-
- # new
- if line_index == 0 && diff.deleted_file
- new_lines[line_index].type = :file_deleted
- new_lines[line_index].content = "File was deleted"
- elsif added_line
- new_lines[line_index].type = :added
- new_lines[line_index].num = line_index2 + 1
- new_lines[line_index].content = new_line
- new_lines[line_index].code = added_line[:line_code]
- elsif new_line
- new_lines[line_index].type = :no_change
- new_lines[line_index].num = line_index2 + 1
- new_lines[line_index].content = new_line
- else
- new_lines[line_index].type = :deleted
- end
- end
-
- return old_lines, new_lines
- end
-
def link_to_browse_code(project, commit)
if current_controller?(:projects, :commits)
if @repo.blob_at(commit.id, @path)
@@ -229,14 +113,6 @@ module CommitsHelper
end
end
- def diff_file_mode_changed?(diff)
- diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
- end
-
- def unfold_bottom_class(bottom)
- (bottom) ? 'js-unfold-bottom' : ''
- end
-
def view_file_btn(commit_sha, diff, project)
link_to project_blob_path(project, tree_join(commit_sha, diff.new_path)),
class: 'btn btn-small view-file js-view-file' do
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
index ee4d4fbdff5..afe7447d4e2 100644
--- a/app/helpers/diff_helper.rb
+++ b/app/helpers/diff_helper.rb
@@ -1,14 +1,20 @@
module DiffHelper
- def safe_diff_files(diffs)
+ def allowed_diff_size
if diff_hard_limit_enabled?
- diffs.first(Commit::DIFF_HARD_LIMIT_FILES)
+ Commit::DIFF_HARD_LIMIT_FILES
else
- diffs.first(Commit::DIFF_SAFE_FILES)
+ Commit::DIFF_SAFE_FILES
+ end
+ end
+
+ def safe_diff_files(diffs)
+ diffs.first(allowed_diff_size).map do |diff|
+ Gitlab::Diff::File.new(diff)
end
end
- def show_diff_size_warninig?(diffs)
- safe_diff_files(diffs).size < diffs.size
+ def show_diff_size_warning?(diffs)
+ diffs.size > allowed_diff_size
end
def diff_hard_limit_enabled?
@@ -19,4 +25,76 @@ module DiffHelper
false
end
end
+
+ def generate_line_code(file_path, line)
+ Gitlab::Diff::LineCode.generate(file_path, line.new_pos, line.old_pos)
+ end
+
+ def parallel_diff(diff_file, index)
+ lines = []
+ skip_next = false
+
+ # Building array of lines
+ #
+ # [left_type, left_line_number, left_line_content, line_code, right_line_type, right_line_number, right_line_content]
+ #
+ diff_file.diff_lines.each do |line|
+
+ full_line = line.text
+ type = line.type
+ line_code = generate_line_code(diff_file.file_path, line)
+ line_new = line.new_pos
+ line_old = line.old_pos
+
+ next_line = diff_file.next_line(line.index)
+
+ if next_line
+ next_type = next_line.type
+ next_line = next_line.text
+ end
+
+ line = [type, line_old, full_line, line_code, next_type, line_new]
+ if type == 'match' || type.nil?
+ # line in the right panel is the same as in the left one
+ line = [type, line_old, full_line, line_code, type, line_new, full_line]
+ lines.push(line)
+ elsif type == 'old'
+ if next_type == 'new'
+ # Left side has text removed, right side has text added
+ line.push(next_line)
+ lines.push(line)
+ skip_next = true
+ elsif next_type == 'old' || next_type.nil?
+ # Left side has text removed, right side doesn't have any change
+ line.pop # remove the newline
+ line.push(nil) # no line number on the right panel
+ line.push("&nbsp;") # empty line on the right panel
+ lines.push(line)
+ end
+ elsif type == 'new'
+ if skip_next
+ # Change has been already included in previous line so no need to do it again
+ skip_next = false
+ next
+ else
+ # Change is only on the right side, left side has no change
+ line = [nil, nil, "&nbsp;", line_code, type, line_new, full_line]
+ lines.push(line)
+ end
+ end
+ end
+ lines
+ end
+
+ def unfold_bottom_class(bottom)
+ (bottom) ? 'js-unfold-bottom' : ''
+ end
+
+ def diff_line_content(line)
+ if line.blank?
+ " &nbsp;"
+ else
+ line
+ end
+ end
end
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb
index c7e8fdad7a0..a4f93689a7b 100644
--- a/app/helpers/events_helper.rb
+++ b/app/helpers/events_helper.rb
@@ -52,6 +52,8 @@ module EventsHelper
"#{event.author_name} #{event.push_action_name} #{event.ref_type} #{event.ref_name} at #{event.project_name}"
elsif event.membership_changed?
"#{event.author_name} #{event.action_name} #{event.project_name}"
+ elsif event.note? && event.note_commit?
+ "#{event.author_name} commented on #{event.note_target_type} #{event.note_short_commit_id} at #{event.project_name}"
elsif event.note?
"#{event.author_name} commented on #{event.note_target_type} ##{truncate event.note_target_iid} at #{event.project_name}"
else
@@ -64,6 +66,8 @@ module EventsHelper
project_issue_url(event.project, event.issue)
elsif event.merge_request?
project_merge_request_url(event.project, event.merge_request)
+ elsif event.note? && event.note_commit?
+ project_commit_url(event.project, event.note_target)
elsif event.note?
if event.note_target
if event.note_commit?
@@ -94,6 +98,8 @@ module EventsHelper
render "events/event_push", event: event
elsif event.merge_request?
render "events/event_merge_request", merge_request: event.merge_request
+ elsif event.push?
+ render "events/event_push", event: event
elsif event.note?
render "events/event_note", note: event.note
end
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index 5bfba4f14f2..19d688c4bb8 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -14,13 +14,13 @@ module LabelsHelper
def suggested_colors
[
- '#d9534f',
- '#f0ad4e',
- '#428bca',
- '#5cb85c',
- '#34495e',
- '#7f8c8d',
- '#8e44ad',
+ '#D9534F',
+ '#F0AD4E',
+ '#428BCA',
+ '#5CB85C',
+ '#34495E',
+ '#7F8C8D',
+ '#8E44AD',
'#FFECDB'
]
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 8350f5dc072..d22526947dd 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -123,7 +123,7 @@ module ProjectsHelper
end
def link_to_toggle_star(title, starred, signed_in)
- cls = 'btn btn-block'
+ cls = 'star-btn'
cls += ' disabled' unless signed_in
toggle_html = content_tag('span', class: 'toggle') do
@@ -151,7 +151,7 @@ module ProjectsHelper
content_tag 'span', class: starred ? 'turn-on' : 'turn-off' do
link_to toggle_star_project_path(@project), link_opts do
- toggle_html + count_html
+ toggle_html + ' ' + count_html
end
end
end
@@ -261,4 +261,10 @@ module ProjectsHelper
project_blob_path(project, tree_join(project.default_branch, project.repository.contribution_guide.name))
end
end
+
+ def hidden_pass_url(original_url)
+ result = URI(original_url)
+ result.password = '*****' if result.password.present?
+ result
+ end
end
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb
index ecd8d3994d0..94e15c0f81c 100644
--- a/app/helpers/search_helper.rb
+++ b/app/helpers/search_helper.rb
@@ -91,4 +91,21 @@ module SearchHelper
def search_result_sanitize(str)
Sanitize.clean(str)
end
+
+ def search_filter_path(options={})
+ exist_opts = {
+ search: params[:search],
+ project_id: params[:project_id],
+ group_id: params[:group_id],
+ scope: params[:scope]
+ }
+
+ options = exist_opts.merge(options)
+ search_path(options)
+ end
+
+ # Sanitize html generated after parsing markdown from issue description or comment
+ def search_md_sanitize(html)
+ sanitize(html, tags: %w(a p ol ul li pre code))
+ end
end
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index 0a5fe24b5af..698b5b8c30a 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -49,6 +49,10 @@ module Issuable
where("LOWER(title) like :query", query: "%#{query.downcase}%")
end
+ def full_search(query)
+ where("LOWER(title) like :query OR LOWER(description) like :query", query: "%#{query.downcase}%")
+ end
+
def sort(method)
case method.to_s
when 'newest' then reorder("#{table_name}.created_at DESC")
@@ -138,6 +142,10 @@ module Issuable
labels.order('title ASC').pluck(:title)
end
+ def remove_labels
+ labels.delete_all
+ end
+
def add_labels_by_names(label_names)
label_names.each do |label_name|
label = project.labels.create_with(
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 92a8ff9b677..45a8e43b03d 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -15,7 +15,6 @@
# milestone_id :integer
# state :string(255)
# iid :integer
-# attachment :string(255)
#
require 'carrierwave/orm/activerecord'
diff --git a/app/models/key.rb b/app/models/key.rb
index d59993b1905..095c73d8baf 100644
--- a/app/models/key.rb
+++ b/app/models/key.rb
@@ -29,7 +29,9 @@ class Key < ActiveRecord::Base
after_create :add_to_shell
after_create :notify_user
+ after_create :post_create_hook
after_destroy :remove_from_shell
+ after_destroy :post_destroy_hook
def strip_white_space
self.key = key.strip unless key.blank?
@@ -56,6 +58,10 @@ class Key < ActiveRecord::Base
NotificationService.new.new_key(self)
end
+ def post_create_hook
+ SystemHooksService.new.execute_hooks_for(self, :create)
+ end
+
def remove_from_shell
GitlabShellWorker.perform_async(
:remove_key,
@@ -64,6 +70,10 @@ class Key < ActiveRecord::Base
)
end
+ def post_destroy_hook
+ SystemHooksService.new.execute_hooks_for(self, :destroy)
+ end
+
private
def generate_fingerpint
diff --git a/app/models/label.rb b/app/models/label.rb
index 819d6cefa41..2b2b02e0645 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -1,19 +1,31 @@
+# == Schema Information
+#
+# Table name: labels
+#
+# id :integer not null, primary key
+# title :string(255)
+# color :string(255)
+# project_id :integer
+# created_at :datetime
+# updated_at :datetime
+#
+
class Label < ActiveRecord::Base
- DEFAULT_COLOR = '#428bca'
+ DEFAULT_COLOR = '#428BCA'
belongs_to :project
has_many :label_links, dependent: :destroy
has_many :issues, through: :label_links, source: :target, source_type: 'Issue'
validates :color,
- format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ },
+ format: { with: /\A#[0-9A-Fa-f]{6}\Z/ },
allow_blank: false
validates :project, presence: true
# Don't allow '?', '&', and ',' for label titles
validates :title,
presence: true,
- format: { with: /\A[^&\?,&]*\z/ },
+ format: { with: /\A[^&\?,&]+\z/ },
uniqueness: { scope: :project_id }
scope :order_by_name, -> { reorder("labels.title ASC") }
diff --git a/app/models/label_link.rb b/app/models/label_link.rb
index 47bd6eaf35f..b94c9c777af 100644
--- a/app/models/label_link.rb
+++ b/app/models/label_link.rb
@@ -1,3 +1,15 @@
+# == Schema Information
+#
+# Table name: label_links
+#
+# id :integer not null, primary key
+# label_id :integer
+# target_id :integer
+# target_type :string(255)
+# created_at :datetime
+# updated_at :datetime
+#
+
class LabelLink < ActiveRecord::Base
belongs_to :target, polymorphic: true
belongs_to :label
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index b5705ef151d..10bd76b1c35 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -17,6 +17,7 @@
# target_project_id :integer not null
# iid :integer
# description :text
+# position :integer default(0)
#
require Rails.root.join("app/models/commit")
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb
index 248fa18353e..409e82ed1ef 100644
--- a/app/models/merge_request_diff.rb
+++ b/app/models/merge_request_diff.rb
@@ -3,7 +3,7 @@
# Table name: merge_request_diffs
#
# id :integer not null, primary key
-# state :string(255) default("collected"), not null
+# state :string(255)
# st_commits :text
# st_diffs :text
# merge_request_id :integer not null
diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb
index 424819f3501..9c95470beb1 100644
--- a/app/models/network/graph.rb
+++ b/app/models/network/graph.rb
@@ -178,12 +178,6 @@ module Network
space = find_free_space(time_range, 2, space_base)
leaves.each do |l|
l.spaces << space
- # Also add space to parent
- l.parents(@map).each do |parent|
- if 0 < parent.space && parent.space < space
- parent.spaces << space
- end
- end
end
# and mark it as reserved
diff --git a/app/models/note.rb b/app/models/note.rb
index 7ff6444cc9b..fa5fdea4eb0 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -117,6 +117,25 @@ class Note < ActiveRecord::Base
})
end
+ def create_new_commits_note(noteable, project, author, commits)
+ commits_text = ActionController::Base.helpers.pluralize(commits.size, 'new commit')
+ body = "Added #{commits_text}:\n\n"
+
+ commits.each do |commit|
+ message = "* #{commit.short_id} - #{commit.title}"
+ body << message
+ body << "\n"
+ end
+
+ create(
+ noteable: noteable,
+ project: project,
+ author: author,
+ note: body,
+ system: true
+ )
+ end
+
def discussions_from_notes(notes)
discussion_ids = []
discussions = []
@@ -146,6 +165,10 @@ class Note < ActiveRecord::Base
def cross_reference_exists?(noteable, mentioner)
where(noteable_id: noteable.id, system: true, note: "_mentioned in #{mentioner.gfm_reference}_").any?
end
+
+ def search(query)
+ where("note like :query", query: "%#{query}%")
+ end
end
def commit_author
@@ -186,9 +209,10 @@ class Note < ActiveRecord::Base
noteable.diffs.each do |mr_diff|
next unless mr_diff.new_path == self.diff.new_path
- Gitlab::DiffParser.new(mr_diff.diff.lines.to_a, mr_diff.new_path).
- each do |full_line, type, line_code, line_new, line_old|
- if full_line == diff_line
+ lines = Gitlab::Diff::Parser.new.parse(mr_diff.diff.lines.to_a)
+
+ lines.each do |line|
+ if line.text == diff_line
return true
end
end
@@ -209,6 +233,14 @@ class Note < ActiveRecord::Base
diff.new_path if diff
end
+ def file_path
+ if diff.new_path.present?
+ diff.new_path
+ elsif diff.old_path.present?
+ diff.old_path
+ end
+ end
+
def diff_old_line
line_code.split('_')[1].to_i
end
@@ -217,19 +249,49 @@ class Note < ActiveRecord::Base
line_code.split('_')[2].to_i
end
+ def generate_line_code(line)
+ Gitlab::Diff::LineCode.generate(file_path, line.new_pos, line.old_pos)
+ end
+
def diff_line
return @diff_line if @diff_line
if diff
- Gitlab::DiffParser.new(diff.diff.lines.to_a, diff.new_path)
- .each do |full_line, type, line_code, line_new, line_old|
- @diff_line = full_line if line_code == self.line_code
+ diff_lines.each do |line|
+ if generate_line_code(line) == self.line_code
+ @diff_line = line.text
end
+ end
end
@diff_line
end
+ def truncated_diff_lines
+ max_number_of_lines = 16
+ prev_match_line = nil
+ prev_lines = []
+
+ diff_lines.each do |line|
+ if generate_line_code(line) != self.line_code
+ if line.type == "match"
+ prev_lines.clear
+ prev_match_line = line
+ else
+ prev_lines.push(line)
+ prev_lines.shift if prev_lines.length >= max_number_of_lines
+ end
+ else
+ prev_lines << line
+ return prev_lines
+ end
+ end
+ end
+
+ def diff_lines
+ @diff_lines ||= Gitlab::Diff::Parser.new.parse(diff.diff.lines.to_a)
+ end
+
def discussion_id
@discussion_id ||= Note.build_discussion_id(noteable_type, noteable_id || commit_id, line_code)
end
@@ -333,4 +395,8 @@ class Note < ActiveRecord::Base
def set_references
notice_added_references(project, author)
end
+
+ def editable?
+ !system
+ end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 7f6aa6d4249..114e40983f8 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -22,7 +22,8 @@
# visibility_level :integer default(0), not null
# archived :boolean default(FALSE), not null
# import_status :string(255)
-# star_count :integer
+# repository_size :float default(0.0)
+# star_count :integer default(0), not null
#
class Project < ActiveRecord::Base
@@ -69,7 +70,7 @@ class Project < ActiveRecord::Base
has_many :merge_requests, dependent: :destroy, foreign_key: "target_project_id"
# Merge requests from source project should be kept when source project was removed
has_many :fork_merge_requests, foreign_key: "source_project_id", class_name: MergeRequest
- has_many :issues, -> { order "state DESC, created_at DESC" }, dependent: :destroy
+ has_many :issues, -> { order 'issues.state DESC, issues.created_at DESC' }, dependent: :destroy
has_many :labels, dependent: :destroy
has_many :services, dependent: :destroy
has_many :events, dependent: :destroy
@@ -176,11 +177,11 @@ class Project < ActiveRecord::Base
joins(:issues, :notes, :merge_requests).order("issues.created_at, notes.created_at, merge_requests.created_at DESC")
end
- def search query
+ def search(query)
joins(:namespace).where("projects.archived = ?", false).where("projects.name LIKE :query OR projects.path LIKE :query OR namespaces.name LIKE :query OR projects.description LIKE :query", query: "%#{query}%")
end
- def search_by_title query
+ def search_by_title(query)
where("projects.archived = ?", false).where("LOWER(projects.name) LIKE :query", query: "%#{query.downcase}%")
end
@@ -399,18 +400,35 @@ class Project < ActiveRecord::Base
def update_merge_requests(oldrev, newrev, ref, user)
return true unless ref =~ /heads/
branch_name = ref.gsub("refs/heads/", "")
- c_ids = self.repository.commits_between(oldrev, newrev).map(&:id)
+ commits = self.repository.commits_between(oldrev, newrev)
+ c_ids = commits.map(&:id)
# Close merge requests
mrs = self.merge_requests.opened.where(target_branch: branch_name).to_a
mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) }
- mrs.each { |merge_request| MergeRequests::MergeService.new.execute(merge_request, user, nil) }
+
+ mrs.uniq.each do |merge_request|
+ MergeRequests::MergeService.new.execute(merge_request, user, nil)
+ end
# Update code for merge requests into project between project branches
mrs = self.merge_requests.opened.by_branch(branch_name).to_a
# Update code for merge requests between project and project fork
mrs += self.fork_merge_requests.opened.by_branch(branch_name).to_a
- mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked }
+
+ mrs.uniq.each do |merge_request|
+ merge_request.reload_code
+ merge_request.mark_as_unchecked
+ end
+
+ # Add comment about pushing new commits to merge requests
+ mrs = self.merge_requests.opened.where(source_branch: branch_name).to_a
+ mrs += self.fork_merge_requests.opened.where(source_branch: branch_name).to_a
+
+ mrs.uniq.each do |merge_request|
+ Note.create_new_commits_note(merge_request, merge_request.project,
+ user, commits)
+ end
true
end
diff --git a/app/models/project_services/assembla_service.rb b/app/models/project_services/assembla_service.rb
index 9a8cbb32ac1..3421a0330aa 100644
--- a/app/models/project_services/assembla_service.rb
+++ b/app/models/project_services/assembla_service.rb
@@ -5,21 +5,17 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
class AssemblaService < Service
include HTTParty
+ prop_accessor :token, :subdomain
validates :token, presence: true, if: :activated?
def title
diff --git a/app/models/project_services/campfire_service.rb b/app/models/project_services/campfire_service.rb
index 83e1bac1ef2..2d8950db491 100644
--- a/app/models/project_services/campfire_service.rb
+++ b/app/models/project_services/campfire_service.rb
@@ -5,19 +5,15 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
class CampfireService < Service
+ prop_accessor :token, :subdomain, :room
validates :token, presence: true, if: :activated?
def title
diff --git a/app/models/project_services/ci_service.rb b/app/models/project_services/ci_service.rb
index fd34a2a35ea..829f495abc6 100644
--- a/app/models/project_services/ci_service.rb
+++ b/app/models/project_services/ci_service.rb
@@ -1,3 +1,17 @@
+# == Schema Information
+#
+# Table name: services
+#
+# id :integer not null, primary key
+# type :string(255)
+# title :string(255)
+# project_id :integer not null
+# created_at :datetime
+# updated_at :datetime
+# active :boolean default(FALSE), not null
+# properties :text
+#
+
# Base class for CI services
# List methods you need to implement to get your CI service
# working with GitLab Merge Requests
diff --git a/app/models/project_services/emails_on_push_service.rb b/app/models/project_services/emails_on_push_service.rb
index be5bab4ec32..5c4537cfca5 100644
--- a/app/models/project_services/emails_on_push_service.rb
+++ b/app/models/project_services/emails_on_push_service.rb
@@ -5,19 +5,15 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
class EmailsOnPushService < Service
+ prop_accessor :recipients
validates :recipients, presence: true, if: :activated?
def title
diff --git a/app/models/project_services/flowdock_service.rb b/app/models/project_services/flowdock_service.rb
index 6cdd04a8648..4d11b00c192 100644
--- a/app/models/project_services/flowdock_service.rb
+++ b/app/models/project_services/flowdock_service.rb
@@ -5,21 +5,17 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
require "flowdock-git-hook"
class FlowdockService < Service
+ prop_accessor :token
validates :token, presence: true, if: :activated?
def title
diff --git a/app/models/project_services/gemnasium_service.rb b/app/models/project_services/gemnasium_service.rb
index b363d7f57d2..7b6c87e4cec 100644
--- a/app/models/project_services/gemnasium_service.rb
+++ b/app/models/project_services/gemnasium_service.rb
@@ -5,21 +5,17 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
require "gemnasium/gitlab_service"
class GemnasiumService < Service
+ prop_accessor :token, :api_key
validates :token, :api_key, presence: true, if: :activated?
def title
diff --git a/app/models/project_services/gitlab_ci_service.rb b/app/models/project_services/gitlab_ci_service.rb
index 58ddce45288..0f327e75289 100644
--- a/app/models/project_services/gitlab_ci_service.rb
+++ b/app/models/project_services/gitlab_ci_service.rb
@@ -5,19 +5,15 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# property :text
#
class GitlabCiService < CiService
+ prop_accessor :project_url, :token
validates :project_url, presence: true, if: :activated?
validates :token, presence: true, if: :activated?
diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb
index 256debffc51..3a1ba168e6a 100644
--- a/app/models/project_services/hipchat_service.rb
+++ b/app/models/project_services/hipchat_service.rb
@@ -5,21 +5,17 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
class HipchatService < Service
MAX_COMMITS = 3
+ prop_accessor :token, :room
validates :token, presence: true, if: :activated?
def title
diff --git a/app/models/project_services/pivotaltracker_service.rb b/app/models/project_services/pivotaltracker_service.rb
index aa2bcc5def7..3aa928b92a0 100644
--- a/app/models/project_services/pivotaltracker_service.rb
+++ b/app/models/project_services/pivotaltracker_service.rb
@@ -5,21 +5,17 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
class PivotaltrackerService < Service
include HTTParty
+ prop_accessor :token
validates :token, presence: true, if: :activated?
def title
diff --git a/app/models/project_services/slack_service.rb b/app/models/project_services/slack_service.rb
index 7e54188abf7..4bda93f6006 100644
--- a/app/models/project_services/slack_service.rb
+++ b/app/models/project_services/slack_service.rb
@@ -5,19 +5,15 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
class SlackService < Service
+ prop_accessor :room, :subdomain, :token
validates :room, presence: true, if: :activated?
validates :subdomain, presence: true, if: :activated?
validates :token, presence: true, if: :activated?
diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb
index a8ba5efcc7c..a82a300a672 100644
--- a/app/models/project_wiki.rb
+++ b/app/models/project_wiki.rb
@@ -2,8 +2,9 @@ class ProjectWiki
include Gitlab::ShellAdapter
MARKUPS = {
- "Markdown" => :markdown,
- "RDoc" => :rdoc
+ 'Markdown' => :markdown,
+ 'RDoc' => :rdoc,
+ 'AsciiDoc' => :asciidoc
}
class CouldNotCreateWikiError < StandardError; end
diff --git a/app/models/repository.rb b/app/models/repository.rb
index e970c449a73..9dd8603621f 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -64,10 +64,10 @@ class Repository
gitlab_shell.add_branch(path_with_namespace, branch_name, ref)
end
- def add_tag(tag_name, ref)
+ def add_tag(tag_name, ref, message = nil)
Rails.cache.delete(cache_key(:tag_names))
- gitlab_shell.add_tag(path_with_namespace, tag_name, ref)
+ gitlab_shell.add_tag(path_with_namespace, tag_name, ref, message)
end
def rm_branch(branch_name)
diff --git a/app/models/service.rb b/app/models/service.rb
index 0dc6d514b46..1f3a6520473 100644
--- a/app/models/service.rb
+++ b/app/models/service.rb
@@ -5,23 +5,21 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
-#
+# properties :text
# To add new service you should build a class inherited from Service
# and implement a set of methods
class Service < ActiveRecord::Base
+ serialize :properties, JSON
+
default_value_for :active, false
+ after_initialize :initialize_properties
+
belongs_to :project
has_one :service_hook
@@ -35,6 +33,10 @@ class Service < ActiveRecord::Base
:common
end
+ def initialize_properties
+ self.properties = {} if properties.nil?
+ end
+
def title
# implement inside child
end
@@ -63,4 +65,20 @@ class Service < ActiveRecord::Base
def can_test?
!project.empty_repo?
end
+
+ # Provide convenient accessor methods
+ # for each serialized property.
+ def self.prop_accessor(*args)
+ args.each do |arg|
+ class_eval %{
+ def #{arg}
+ properties['#{arg}']
+ end
+
+ def #{arg}=(value)
+ self.properties['#{arg}'] = value
+ end
+ }
+ end
+ end
end
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index 2c38e7939bd..80c1af8f337 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -65,4 +65,18 @@ class Snippet < ActiveRecord::Base
def expired?
expires_at && expires_at < Time.current
end
+
+ class << self
+ def search(query)
+ where('(title LIKE :query OR file_name LIKE :query)', query: "%#{query}%")
+ end
+
+ def search_code(query)
+ where('(content LIKE :query)', query: "%#{query}%")
+ end
+
+ def accessible_to(user)
+ where('private = ? OR author_id = ?', false, user)
+ end
+ end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index f1ff76edd15..15e56a62a68 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -474,10 +474,6 @@ class User < ActiveRecord::Base
email =~ /\Atemp-email-for-oauth/
end
- def generate_tmp_oauth_email
- self.email = "temp-email-for-oauth-#{username}@gitlab.localhost"
- end
-
def public_profile?
authorized_projects.public_only.any?
end
diff --git a/app/models/users_star_project.rb b/app/models/users_star_project.rb
index 80e756bd00c..3d49cb05949 100644
--- a/app/models/users_star_project.rb
+++ b/app/models/users_star_project.rb
@@ -2,11 +2,11 @@
#
# Table name: users_star_projects
#
-# id :integer not null, primary key
-# starrer_id :integer not null
-# project_id :integer not null
-# created_at :datetime
-# updated_at :datetime
+# id :integer not null, primary key
+# project_id :integer not null
+# user_id :integer not null
+# created_at :datetime
+# updated_at :datetime
#
class UsersStarProject < ActiveRecord::Base
diff --git a/app/models/web_hook.rb b/app/models/web_hook.rb
index 6cf0c1f683e..752eb8074ac 100644
--- a/app/models/web_hook.rb
+++ b/app/models/web_hook.rb
@@ -23,7 +23,7 @@ class WebHook < ActiveRecord::Base
default_value_for :merge_requests_events, false
# HTTParty timeout
- default_timeout 10
+ default_timeout Gitlab.config.gitlab.webhook_timeout
validates :url, presence: true,
format: { with: URI::regexp(%w(http https)), message: "should be a valid url" }
diff --git a/app/services/compare_service.rb b/app/services/compare_service.rb
index c5e04702914..6aa9df4b194 100644
--- a/app/services/compare_service.rb
+++ b/app/services/compare_service.rb
@@ -4,8 +4,8 @@ class CompareService
def execute(current_user, source_project, source_branch, target_project, target_branch)
# Try to compare branches to get commits list and diffs
#
- # Note: Use satellite only when need to compare between to repos
- # because satellites are slower then operations on bare repo
+ # Note: Use satellite only when need to compare between two repos
+ # because satellites are slower than operations on bare repo
if target_project == source_project
Gitlab::CompareResult.new(
Gitlab::Git::Compare.new(
diff --git a/app/services/create_branch_service.rb b/app/services/create_branch_service.rb
index 98beeee8354..79b8239602e 100644
--- a/app/services/create_branch_service.rb
+++ b/app/services/create_branch_service.rb
@@ -1,13 +1,38 @@
class CreateBranchService
def execute(project, branch_name, ref, current_user)
+ valid_branch = Gitlab::GitRefValidator.validate(branch_name)
+ if valid_branch == false
+ return error('Branch name invalid')
+ end
+
repository = project.repository
+ existing_branch = repository.find_branch(branch_name)
+ if existing_branch
+ return error('Branch already exists')
+ end
+
repository.add_branch(branch_name, ref)
new_branch = repository.find_branch(branch_name)
if new_branch
Event.create_ref_event(project, current_user, new_branch, 'add')
+ return success(new_branch)
+ else
+ return error('Invalid reference name')
end
+ end
+
+ def error(message)
+ {
+ message: message,
+ status: :error
+ }
+ end
- new_branch
+ def success(branch)
+ {
+ branch: branch,
+ status: :success
+ }
end
end
diff --git a/app/services/create_tag_service.rb b/app/services/create_tag_service.rb
index 97766677405..3716abd4b2b 100644
--- a/app/services/create_tag_service.rb
+++ b/app/services/create_tag_service.rb
@@ -1,13 +1,42 @@
class CreateTagService
- def execute(project, tag_name, ref, current_user)
+ def execute(project, tag_name, ref, message, current_user)
+ valid_tag = Gitlab::GitRefValidator.validate(tag_name)
+ if valid_tag == false
+ return error('Tag name invalid')
+ end
+
repository = project.repository
- repository.add_tag(tag_name, ref)
+ existing_tag = repository.find_tag(tag_name)
+ if existing_tag
+ return error('Tag already exists')
+ end
+
+ if message
+ message.gsub!(/^\s+|\s+$/, '')
+ end
+
+ repository.add_tag(tag_name, ref, message)
new_tag = repository.find_tag(tag_name)
if new_tag
Event.create_ref_event(project, current_user, new_tag, 'add', 'refs/tags')
+ return success(new_tag)
+ else
+ return error('Invalid reference name')
end
+ end
+
+ def error(message)
+ {
+ message: message,
+ status: :error
+ }
+ end
- new_tag
+ def success(branch)
+ {
+ tag: branch,
+ status: :success
+ }
end
end
diff --git a/app/services/delete_branch_service.rb b/app/services/delete_branch_service.rb
index ce2d8093dff..a94dabcdfc0 100644
--- a/app/services/delete_branch_service.rb
+++ b/app/services/delete_branch_service.rb
@@ -5,21 +5,21 @@ class DeleteBranchService
# No such branch
unless branch
- return error('No such branch')
+ return error('No such branch', 404)
end
if branch_name == repository.root_ref
- return error('Cannot remove HEAD branch')
+ return error('Cannot remove HEAD branch', 405)
end
# Dont allow remove of protected branch
if project.protected_branch?(branch_name)
- return error('Protected branch cant be removed')
+ return error('Protected branch cant be removed', 405)
end
# Dont allow user to remove branch if he is not allowed to push
unless current_user.can?(:push_code, project)
- return error('You dont have push access to repo')
+ return error('You dont have push access to repo', 405)
end
if repository.rm_branch(branch_name)
@@ -30,9 +30,10 @@ class DeleteBranchService
end
end
- def error(message)
+ def error(message, return_code = 400)
{
message: message,
+ return_code: return_code,
state: :error
}
end
diff --git a/app/services/projects/fork_service.rb b/app/services/projects/fork_service.rb
index 2f1c7b18aa0..66f0a02f0af 100644
--- a/app/services/projects/fork_service.rb
+++ b/app/services/projects/fork_service.rb
@@ -7,7 +7,12 @@ module Projects
end
def execute
- project = @from_project.dup
+ project_params = {
+ visibility_level: @from_project.visibility_level,
+ description: @from_project.description,
+ }
+
+ project = Project.new(project_params)
project.name = @from_project.name
project.path = @from_project.path
project.namespace = current_user.namespace
diff --git a/app/services/search/global_service.rb b/app/services/search/global_service.rb
index d213e1375e0..0bcc50c81a7 100644
--- a/app/services/search/global_service.rb
+++ b/app/services/search/global_service.rb
@@ -7,30 +7,12 @@ module Search
end
def execute
- query = params[:search]
- query = Shellwords.shellescape(query) if query.present?
- return result unless query.present?
-
group = Group.find_by(id: params[:group_id]) if params[:group_id].present?
projects = ProjectsFinder.new.execute(current_user)
projects = projects.where(namespace_id: group.id) if group
project_ids = projects.pluck(:id)
- result[:projects] = projects.search(query).limit(20)
- result[:merge_requests] = MergeRequest.in_projects(project_ids).search(query).order('updated_at DESC').limit(20)
- result[:issues] = Issue.where(project_id: project_ids).search(query).order('updated_at DESC').limit(20)
- result[:total_results] = %w(projects issues merge_requests).sum { |items| result[items.to_sym].size }
- result
- end
-
- def result
- @result ||= {
- projects: [],
- merge_requests: [],
- issues: [],
- notes: [],
- total_results: 0,
- }
+ Gitlab::SearchResults.new(project_ids, params[:search])
end
end
end
diff --git a/app/services/search/project_service.rb b/app/services/search/project_service.rb
index 8aac18840e4..f630c0a3790 100644
--- a/app/services/search/project_service.rb
+++ b/app/services/search/project_service.rb
@@ -7,39 +7,9 @@ module Search
end
def execute
- query = params[:search]
- query = Shellwords.shellescape(query) if query.present?
- return result unless query.present?
-
- if params[:search_code].present?
- if !@project.empty_repo?
- blobs = project.repository.search_files(query,
- params[:repository_ref])
- else
- blobs = Array.new
- end
-
- blobs = Kaminari.paginate_array(blobs).page(params[:page]).per(20)
- result[:blobs] = blobs
- result[:total_results] = blobs.total_count
- else
- result[:merge_requests] = project.merge_requests.search(query).order('updated_at DESC').limit(20)
- result[:issues] = project.issues.where("title like :query OR description like :query ", query: "%#{query}%").order('updated_at DESC').limit(20)
- result[:notes] = Note.where(noteable_type: 'issue').where(project_id: project.id).where("note like :query", query: "%#{query}%").order('updated_at DESC').limit(20)
- result[:total_results] = %w(issues merge_requests notes).sum { |items| result[items.to_sym].size }
- end
-
- result
- end
-
- def result
- @result ||= {
- merge_requests: [],
- issues: [],
- blobs: [],
- notes: [],
- total_results: 0,
- }
+ Gitlab::ProjectSearchResults.new(project.id,
+ params[:search],
+ params[:repository_ref])
end
end
end
diff --git a/app/services/search/snippet_service.rb b/app/services/search/snippet_service.rb
new file mode 100644
index 00000000000..8ca0877321d
--- /dev/null
+++ b/app/services/search/snippet_service.rb
@@ -0,0 +1,14 @@
+module Search
+ class SnippetService
+ attr_accessor :current_user, :params
+
+ def initialize(user, params)
+ @current_user, @params = user, params.dup
+ end
+
+ def execute
+ snippet_ids = Snippet.accessible_to(current_user).pluck(:id)
+ Gitlab::SnippetSearchResults.new(snippet_ids, params[:search])
+ end
+ end
+end
diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb
index 41014f199d5..bfc725e5eb5 100644
--- a/app/services/system_hooks_service.rb
+++ b/app/services/system_hooks_service.rb
@@ -22,6 +22,16 @@ class SystemHooksService
}
case model
+ when Key
+ data.merge!(
+ key: model.key,
+ id: model.id
+ )
+ if model.user
+ data.merge!(
+ username: model.user.username
+ )
+ end
when Project
owner = model.owner
diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml
index 41760f8b1e3..7427cea7e8b 100644
--- a/app/views/admin/dashboard/index.html.haml
+++ b/app/views/admin/dashboard/index.html.haml
@@ -94,7 +94,7 @@
%span.light.pull-right
= Milestone.count
%p
- Monthly active users
+ Active users last 30 days
%span.light.pull-right
= User.where("current_sign_in_at > ?", 30.days.ago).count
.col-md-4
diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml
index 3c30ccd78b3..f60d40b5334 100644
--- a/app/views/admin/users/show.html.haml
+++ b/app/views/admin/users/show.html.haml
@@ -71,6 +71,14 @@
No
%li
+ %span.light Current sign-in at:
+ %strong
+ - if @user.current_sign_in_at
+ = @user.current_sign_in_at.stamp("Nov 12, 2031")
+ - else
+ never
+
+ %li
%span.light Last sign-in at:
%strong
- if @user.last_sign_in_at
diff --git a/app/views/dashboard/_groups.html.haml b/app/views/dashboard/_groups.html.haml
index cb9c18b7966..9bcc77b8d8e 100644
--- a/app/views/dashboard/_groups.html.haml
+++ b/app/views/dashboard/_groups.html.haml
@@ -2,10 +2,9 @@
.panel-heading.clearfix
= search_field_tag :filter_group, nil, placeholder: 'Filter by name', class: 'dash-filter form-control'
- if current_user.can_create_group?
- %span.pull-right
- = link_to new_group_path, class: "btn btn-new" do
- %i.icon-plus
- New group
+ = link_to new_group_path, class: "btn btn-new pull-right" do
+ %i.icon-plus
+ New group
%ul.well-list.dash-list
- groups.each do |group|
%li.group-row
diff --git a/app/views/dashboard/_projects.html.haml b/app/views/dashboard/_projects.html.haml
index 5a49bf0c6b1..0cc253a8dd1 100644
--- a/app/views/dashboard/_projects.html.haml
+++ b/app/views/dashboard/_projects.html.haml
@@ -2,10 +2,9 @@
.panel-heading.clearfix
= search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'dash-filter form-control'
- if current_user.can_create_project?
- %span.pull-right
- = link_to new_project_path, class: "btn btn-new" do
- %i.icon-plus
- New project
+ = link_to new_project_path, class: "btn btn-new pull-right" do
+ %i.icon-plus
+ New project
%ul.well-list.dash-list
- projects.each do |project|
diff --git a/app/views/devise/confirmations/new.html.haml b/app/views/devise/confirmations/new.html.haml
index 08e17490865..8d17f39eba2 100755
--- a/app/views/devise/confirmations/new.html.haml
+++ b/app/views/devise/confirmations/new.html.haml
@@ -1,7 +1,7 @@
-.login-box.panel.panel-default
- .panel-heading
- %h3.panel-title Resend confirmation instructions
- .panel-body
+.login-box
+ .login-heading
+ %h3 Resend confirmation instructions
+ .login-body
= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
.devise-errors
= devise_error_messages!
@@ -9,5 +9,5 @@
= f.email_field :email, placeholder: 'Email', class: "form-control", required: true
.clearfix.append-bottom-10
= f.submit "Resend confirmation instructions", class: 'btn btn-success'
- .panel-footer
+ .login-footer
= render 'devise/shared/sign_in_link'
diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml
index efcd0296176..1326cc0aac9 100644
--- a/app/views/devise/passwords/edit.html.haml
+++ b/app/views/devise/passwords/edit.html.haml
@@ -1,7 +1,7 @@
-.login-box.panel.panel-default
- .panel-heading
- %h3.panel-title Change your password
- .panel-body
+.login-box
+ .login-heading
+ %h3 Change your password
+ .login-body
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
.devise-errors
= devise_error_messages!
@@ -12,7 +12,7 @@
= f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm new password", required: true
.clearfix.append-bottom-10
= f.submit "Change my password", class: "btn btn-primary"
- .panel-footer
+ .login-footer
%p
= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
= render 'devise/shared/sign_in_link'
diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml
index bf44dee5ad7..b8af1b8693a 100755
--- a/app/views/devise/passwords/new.html.haml
+++ b/app/views/devise/passwords/new.html.haml
@@ -1,7 +1,7 @@
-.login-box.panel.panel-default
- .panel-heading
- %h3.panel-title Reset password
- .panel-body
+.login-box
+ .login-heading
+ %h3 Reset password
+ .login-body
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
.devise-errors
= devise_error_messages!
@@ -9,5 +9,5 @@
= f.email_field :email, placeholder: "Email", class: "form-control", required: true
.clearfix.append-bottom-10
= f.submit "Reset password", class: "btn-primary btn"
- .panel-footer
+ .login-footer
= render 'devise/shared/sign_in_link'
diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml
index 52d484949b6..d6a952f3dc5 100644
--- a/app/views/devise/registrations/new.html.haml
+++ b/app/views/devise/registrations/new.html.haml
@@ -1,7 +1,7 @@
-.login-box.panel.panel-success
- .panel-heading
- %h3.panel-title Sign up
- .panel-body
+.login-box
+ .login-heading
+ %h3 Sign up
+ .login-body
= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
.devise-errors
= devise_error_messages!
@@ -17,7 +17,7 @@
= f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm password", required: true
%div
= f.submit "Sign up", class: "btn-create btn"
- .panel-footer
+ .login-footer
%p
%span.light
Have an account?
diff --git a/app/views/devise/sessions/_new_base.html.haml b/app/views/devise/sessions/_new_base.html.haml
index 4e196044892..e819847e5ea 100644
--- a/app/views/devise/sessions/_new_base.html.haml
+++ b/app/views/devise/sessions/_new_base.html.haml
@@ -6,7 +6,7 @@
%label.checkbox.remember_me{for: "user_remember_me"}
= f.check_box :remember_me
%span Remember me
+ .pull-right
+ = link_to "Forgot your password?", new_password_path(resource_name)
%div
- = f.submit "Sign in", class: "btn-save btn"
- .pull-right
- = link_to "Forgot your password?", new_password_path(resource_name), class: "btn"
+ = f.submit "Sign in", class: "btn btn-save"
diff --git a/app/views/devise/sessions/_oauth_providers.html.haml b/app/views/devise/sessions/_oauth_providers.html.haml
index 935bc6af505..15048a78063 100644
--- a/app/views/devise/sessions/_oauth_providers.html.haml
+++ b/app/views/devise/sessions/_oauth_providers.html.haml
@@ -1,7 +1,6 @@
- providers = (enabled_oauth_providers - [:ldap])
- if providers.present?
- %hr
- %div{:'data-no-turbolink' => 'data-no-turbolink'}
+ .bs-callout.bs-callout-info{:'data-no-turbolink' => 'data-no-turbolink'}
%span Sign in with: &nbsp;
- providers.each do |provider|
%span
diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml
index f53d6f09daf..b70b0d66172 100644
--- a/app/views/devise/sessions/new.html.haml
+++ b/app/views/devise/sessions/new.html.haml
@@ -1,7 +1,7 @@
-.login-box.panel.panel-primary
- .panel-heading
- %h3.panel-title Sign in
- .panel-body
+.login-box
+ .login-heading
+ %h3 Sign in
+ .login-body
- if ldap_enabled? && gitlab_config.signin_enabled
%ul.nav.nav-tabs
%li.active
@@ -24,7 +24,7 @@
= render 'devise/sessions/oauth_providers' if Gitlab.config.omniauth.enabled && devise_mapping.omniauthable?
- .panel-footer
+ .login-footer
- if gitlab_config.signup_enabled
%p
%span.light
diff --git a/app/views/events/_event_issue.atom.haml b/app/views/events/_event_issue.atom.haml
index 56801107d05..030c961c355 100644
--- a/app/views/events/_event_issue.atom.haml
+++ b/app/views/events/_event_issue.atom.haml
@@ -1,2 +1,2 @@
-%div{:xmlns => "http://www.w3.org/1999/xhtml"}
- %p= markdown issue.description
+%div{xmlns: "http://www.w3.org/1999/xhtml"}
+ = markdown issue.description
diff --git a/app/views/events/_event_merge_request.atom.haml b/app/views/events/_event_merge_request.atom.haml
index dea256bb7f2..ab3a485e908 100644
--- a/app/views/events/_event_merge_request.atom.haml
+++ b/app/views/events/_event_merge_request.atom.haml
@@ -1,2 +1,2 @@
%div{xmlns: "http://www.w3.org/1999/xhtml"}
- %p= markdown merge_request.description
+ = markdown merge_request.description
diff --git a/app/views/events/_event_note.atom.haml b/app/views/events/_event_note.atom.haml
index 96039ad18dc..be0e05481ed 100644
--- a/app/views/events/_event_note.atom.haml
+++ b/app/views/events/_event_note.atom.haml
@@ -1,2 +1,2 @@
-%div{:xmlns => "http://www.w3.org/1999/xhtml"}
- %p= markdown note.note
+%div{xmlns: "http://www.w3.org/1999/xhtml"}
+ = markdown note.note
diff --git a/app/views/explore/projects/_project.html.haml b/app/views/explore/projects/_project.html.haml
index a9498416c8a..fd5aacbfdb4 100644
--- a/app/views/explore/projects/_project.html.haml
+++ b/app/views/explore/projects/_project.html.haml
@@ -8,18 +8,18 @@
%strong.pull-right
= pluralize project.star_count, 'star'
- - if project.description.present?
- %p.project-description.str-truncated
- = project.description
-
- .repo-info
- - unless project.empty_repo?
- = link_to pluralize(project.repository.round_commit_count, 'commit'), project_commits_path(project, project.default_branch)
- &middot;
- = link_to pluralize(project.repository.branch_names.count, 'branch'), project_branches_path(project)
- &middot;
- = link_to pluralize(project.repository.tag_names.count, 'tag'), project_tags_path(project)
- - else
- %i.icon-warning-sign
- Empty repository
+ .project-info
+ - if project.description.present?
+ %p.project-description.str-truncated
+ = project.description
+ .repo-info
+ - unless project.empty_repo?
+ = link_to pluralize(project.repository.round_commit_count, 'commit'), project_commits_path(project, project.default_branch)
+ &middot;
+ = link_to pluralize(project.repository.branch_names.count, 'branch'), project_branches_path(project)
+ &middot;
+ = link_to pluralize(project.repository.tag_names.count, 'tag'), project_tags_path(project)
+ - else
+ %i.icon-warning-sign
+ Empty repository
diff --git a/app/views/help/_shortcuts.html.haml b/app/views/help/_shortcuts.html.haml
index 500e5dc65e1..467f003b333 100644
--- a/app/views/help/_shortcuts.html.haml
+++ b/app/views/help/_shortcuts.html.haml
@@ -3,30 +3,207 @@
.modal-content
.modal-header
%a.close{href: "#", "data-dismiss" => "modal"} ×
- %h3 Keyboard Shortcuts
- .modal-body
- %h5 Global Shortcuts
- %p
- %span.label.label-inverse s
- &ndash;
- Focus Search
- %p
- %span.label.label-inverse ?
- &ndash;
- Show this dialog
+ %h4
+ Keyboard Shortcuts
+ %small
+ = link_to '(Show all)', '#', class: 'js-more-help-button'
+ .modal-body.shortcuts-cheatsheet
+ .col-lg-4
+ %table.shortcut-mappings
+ %tbody
+ %tr
+ %th
+ %th Global Shortcuts
+ %tr
+ %td.shortcut
+ .key s
+ %td Focus Search
+ %tr
+ %td.shortcut
+ .key ?
+ %td Show this dialog
+ %tbody
+ %tr
+ %th
+ %th Project Files browsing
+ %tr
+ %td.shortcut
+ .key
+ %i.icon-arrow-up
+ %td Move selection up
+ %tr
+ %td.shortcut
+ .key
+ %i.icon-arrow-down
+ %td Move selection down
+ %tr
+ %td.shortcut
+ .key enter
+ %td Open Selection
- %h5 Project Files browsing
- %p
- %span.label.label-inverse
- %i.icon-arrow-up
- &ndash;
- Move selection up
- %p
- %span.label.label-inverse
- %i.icon-arrow-down
- &ndash;
- Move selection down
- %p
- %span.label.label-inverse Enter
- &ndash;
- Open selection
+ .col-lg-4
+ %table.shortcut-mappings
+ %tbody{ class: 'hidden-shortcut project', style: 'display:none' }
+ %tr
+ %th
+ %th Global Dashboard
+ %tr
+ %td.shortcut
+ .key g
+ .key a
+ %td
+ Go to the activity feed
+ %tr
+ %td.shortcut
+ .key g
+ .key p
+ %td
+ Go to projects
+ %tr
+ %td.shortcut
+ .key g
+ .key i
+ %td
+ Go to issues
+ %tr
+ %td.shortcut
+ .key g
+ .key m
+ %td
+ Go to merge requests
+ %tbody
+ %tr
+ %th
+ %th Project
+ %tr
+ %td.shortcut
+ .key g
+ .key p
+ %td
+ Go to the project's activity feed
+ %tr
+ %td.shortcut
+ .key g
+ .key f
+ %td
+ Go to files
+ %tr
+ %td.shortcut
+ .key g
+ .key c
+ %td
+ Go to commits
+ %tr
+ %td.shortcut
+ .key g
+ .key n
+ %td
+ Go to network graph
+ %tr
+ %td.shortcut
+ .key g
+ .key g
+ %td
+ Go to graphs
+ %tr
+ %td.shortcut
+ .key g
+ .key i
+ %td
+ Go to issues
+ %tr
+ %td.shortcut
+ .key g
+ .key m
+ %td
+ Go to merge requests
+ %tr
+ %td.shortcut
+ .key g
+ .key s
+ %td
+ Go to snippets
+ .col-lg-4
+ %table.shortcut-mappings
+ %tbody{ class: 'hidden-shortcut network', style: 'display:none' }
+ %tr
+ %th
+ %th Network Graph
+ %tr
+ %td.shortcut
+ .key
+ %i.icon-arrow-left
+ \/
+ .key h
+ %td Scroll left
+ %tr
+ %td.shortcut
+ .key
+ %i.icon-arrow-right
+ \/
+ .key l
+ %td Scroll right
+ %tr
+ %td.shortcut
+ .key
+ %i.icon-arrow-up
+ \/
+ .key k
+ %td Scroll up
+ %tr
+ %td.shortcut
+ .key
+ %i.icon-arrow-down
+ \/
+ .key j
+ %td Scroll down
+ %tr
+ %td.shortcut
+ .key
+ shift
+ %i.icon-arrow-up
+ \/
+ .key
+ shift k
+ %td Scroll to top
+ %tr
+ %td.shortcut
+ .key
+ shift
+ %i.icon-arrow-down
+ \/
+ .key
+ shift j
+ %td Scroll to bottom
+ %tbody{ class: 'hidden-shortcut issues', style: 'display:none' }
+ %tr
+ %th
+ %th Issues
+ %tr
+ %td.shortcut
+ .key a
+ %td Change assignee
+ %tr
+ %td.shortcut
+ .key m
+ %td Change milestone
+ %tbody{ class: 'hidden-shortcut merge_reuests', style: 'display:none' }
+ %tr
+ %th
+ %th Merge Requests
+ %tr
+ %td.shortcut
+ .key a
+ %td Change assignee
+ %tr
+ %td.shortcut
+ .key m
+ %td Change milestone
+
+
+:javascript
+ $('.js-more-help-button').click(function(e){
+ $(this).remove()
+ $('.hidden-shortcut').show()
+ e.preventDefault()
+ });
diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml
index 219693af09f..903e093e5fc 100644
--- a/app/views/help/index.html.haml
+++ b/app/views/help/index.html.haml
@@ -37,8 +37,8 @@
= link_to "getting help", "https://www.gitlab.com/getting-help/"
%li
Use the
- = link_to "search bar", '#', onclick: "$('#search').focus();"
+ = link_to 'search bar', '#', onclick: 'Shortcuts.focusSearch(event)'
on the top of this page
%li
Use
- = link_to "shortcuts", '#', onclick: "new Shortcuts()"
+ = link_to 'shortcuts', '#', onclick: 'Shortcuts.showHelp(event)'
diff --git a/app/views/layouts/_search.html.haml b/app/views/layouts/_search.html.haml
index caf0e39234a..5ab82122ad7 100644
--- a/app/views/layouts/_search.html.haml
+++ b/app/views/layouts/_search.html.haml
@@ -5,6 +5,15 @@
- if @project && @project.persisted?
= hidden_field_tag :project_id, @project.id
= hidden_field_tag :search_code, true
+ - if @snippet || @snippets
+ = hidden_field_tag :snippets, true
= hidden_field_tag :repository_ref, @ref
= submit_tag 'Go' if ENV['RAILS_ENV'] == 'test'
.search-autocomplete-opts.hide{:'data-autocomplete-path' => search_autocomplete_path, :'data-autocomplete-project-id' => @project.try(:id), :'data-autocomplete-project-ref' => @ref }
+
+:javascript
+ $('.search-input').on('keyup', function(e) {
+ if (e.keyCode == 27) {
+ $('.search-input').blur()
+ }
+ })
diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml
index dd70836cdc9..ffa48a68b42 100644
--- a/app/views/layouts/devise.html.haml
+++ b/app/views/layouts/devise.html.haml
@@ -11,7 +11,7 @@
.container
.content
.row
- .col-md-7
+ .col-md-7.brand-holder
- if brand_item
.brand-image
= brand_image
diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml
index a300bbc1904..a6e9772d93f 100644
--- a/app/views/layouts/nav/_dashboard.html.haml
+++ b/app/views/layouts/nav/_dashboard.html.haml
@@ -1,16 +1,16 @@
%ul
= nav_link(path: 'dashboard#show', html_options: {class: 'home'}) do
- = link_to root_path, title: "Home" do
+ = link_to root_path, title: 'Home', class: 'shortcuts-activity' do
Activity
= nav_link(path: 'dashboard#projects') do
- = link_to projects_dashboard_path do
+ = link_to projects_dashboard_path, class: 'shortcuts-projects' do
Projects
= nav_link(path: 'dashboard#issues') do
- = link_to issues_dashboard_path do
+ = link_to issues_dashboard_path, class: 'shortcuts-issues' do
Issues
%span.count= current_user.assigned_issues.opened.count
= nav_link(path: 'dashboard#merge_requests') do
- = link_to merge_requests_dashboard_path do
+ = link_to merge_requests_dashboard_path, class: 'shortcuts-merge_requests' do
Merge Requests
%span.count= current_user.assigned_merge_requests.opened.count
= nav_link(controller: :help) do
diff --git a/app/views/layouts/nav/_project.html.haml b/app/views/layouts/nav/_project.html.haml
index 69491c2529e..6cb2a82bac8 100644
--- a/app/views/layouts/nav/_project.html.haml
+++ b/app/views/layouts/nav/_project.html.haml
@@ -1,44 +1,43 @@
-%ul
+%ul.project-navigation
= nav_link(path: 'projects#show', html_options: {class: "home"}) do
- = link_to project_path(@project), title: "Project" do
- Activity
-
+ = link_to project_path(@project), title: 'Project', class: 'shortcuts-project' do
+ Project
- if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame edit_tree new_tree)) do
- = link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref)
+ = link_to 'Files', project_tree_path(@project, @ref || @repository.root_ref), class: 'shortcuts-tree'
- if project_nav_tab? :commits
= nav_link(controller: %w(commit commits compare repositories tags branches)) do
- = link_to "Commits", project_commits_path(@project, @ref || @repository.root_ref)
+ = link_to "Commits", project_commits_path(@project, @ref || @repository.root_ref), class: 'shortcuts-commits'
- if project_nav_tab? :network
= nav_link(controller: %w(network)) do
- = link_to "Network", project_network_path(@project, @ref || @repository.root_ref)
+ = link_to "Network", project_network_path(@project, @ref || @repository.root_ref), class: 'shortcuts-network'
- if project_nav_tab? :graphs
= nav_link(controller: %w(graphs)) do
- = link_to "Graphs", project_graph_path(@project, @ref || @repository.root_ref)
+ = link_to "Graphs", project_graph_path(@project, @ref || @repository.root_ref), class: 'shortcuts-graphs'
- if project_nav_tab? :issues
= nav_link(controller: %w(issues milestones labels)) do
- = link_to url_for_project_issues do
+ = link_to url_for_project_issues, class: 'shortcuts-issues' do
Issues
- if @project.used_default_issues_tracker?
%span.count.issue_counter= @project.issues.opened.count
- if project_nav_tab? :merge_requests
= nav_link(controller: :merge_requests) do
- = link_to project_merge_requests_path(@project) do
+ = link_to project_merge_requests_path(@project), class: 'shortcuts-merge_requests' do
Merge Requests
%span.count.merge_counter= @project.merge_requests.opened.count
- if project_nav_tab? :wiki
= nav_link(controller: :wikis) do
- = link_to 'Wiki', project_wiki_path(@project, :home)
+ = link_to 'Wiki', project_wiki_path(@project, :home), class: 'shortcuts-wiki'
- if project_nav_tab? :snippets
= nav_link(controller: :snippets) do
- = link_to 'Snippets', project_snippets_path(@project)
+ = link_to 'Snippets', project_snippets_path(@project), class: 'shortcuts-snippets'
- if project_nav_tab? :settings
= nav_link(html_options: {class: "#{project_tab_class}"}) do
diff --git a/app/views/notify/_reassigned_issuable_email.html.haml b/app/views/notify/_reassigned_issuable_email.html.haml
new file mode 100644
index 00000000000..56d81b2ed2e
--- /dev/null
+++ b/app/views/notify/_reassigned_issuable_email.html.haml
@@ -0,0 +1,10 @@
+%p
+ Assignee changed
+ - if @previous_assignee
+ from
+ %strong #{@previous_assignee.name}
+ to
+ - if issuable.assignee_id
+ %strong #{issuable.assignee_name}
+ - else
+ %strong Unassigned
diff --git a/app/views/notify/_reassigned_issuable_email.text.erb b/app/views/notify/_reassigned_issuable_email.text.erb
new file mode 100644
index 00000000000..817d030c362
--- /dev/null
+++ b/app/views/notify/_reassigned_issuable_email.text.erb
@@ -0,0 +1,6 @@
+Reassigned <%= issuable.class.model_name.human.titleize %> <%= issuable.iid %>
+
+<%= url_for([issuable.project, issuable, {only_path: false}]) %>
+
+Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee -%>
+ to <%= "#{issuable.assignee_id ? issuable.assignee_name : 'Unassigned'}" %>
diff --git a/app/views/notify/project_was_moved_email.html.haml b/app/views/notify/project_was_moved_email.html.haml
index 1667c59bc07..fe248584e55 100644
--- a/app/views/notify/project_was_moved_email.html.haml
+++ b/app/views/notify/project_was_moved_email.html.haml
@@ -1,5 +1,5 @@
%p
- = "Project was moved to another location"
+ Project was moved to another location
%p
The project is now located under
= link_to project_url(@project) do
diff --git a/app/views/notify/reassigned_issue_email.html.haml b/app/views/notify/reassigned_issue_email.html.haml
index f1458df5c7b..498ba8b8365 100644
--- a/app/views/notify/reassigned_issue_email.html.haml
+++ b/app/views/notify/reassigned_issue_email.html.haml
@@ -1,11 +1 @@
-%p
- Assignee changed
- - if @previous_assignee
- from
- %strong #{@previous_assignee.name}
- to
- - if @issue.assignee_id
- %strong #{@issue.assignee_name}
- - else
- %strong Unassigned
-
+= render 'reassigned_issuable_email', issuable: @issue
diff --git a/app/views/notify/reassigned_issue_email.text.erb b/app/views/notify/reassigned_issue_email.text.erb
index 4becac2749c..710253be984 100644
--- a/app/views/notify/reassigned_issue_email.text.erb
+++ b/app/views/notify/reassigned_issue_email.text.erb
@@ -1,5 +1 @@
-Reassigned Issue <%= @issue.iid %>
-
-<%= url_for(project_issue_url(@issue.project, @issue)) %>
-
-Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee %> to <%= "#{@issue.assignee_id ? @issue.assignee_name : 'Unassigned'}" %>
+<%= render 'reassigned_issuable_email', issuable: @issue %>
diff --git a/app/views/notify/reassigned_merge_request_email.html.haml b/app/views/notify/reassigned_merge_request_email.html.haml
index 00aee6bc952..2a650130f59 100644
--- a/app/views/notify/reassigned_merge_request_email.html.haml
+++ b/app/views/notify/reassigned_merge_request_email.html.haml
@@ -1,7 +1 @@
-%p
- Assignee changed
- - if @previous_assignee
- from
- %strong #{@previous_assignee.name}
- to
- %strong #{@merge_request.assignee_name}
+= render 'reassigned_issuable_email', issuable: @merge_request
diff --git a/app/views/notify/reassigned_merge_request_email.text.erb b/app/views/notify/reassigned_merge_request_email.text.erb
index 87a7847e06d..b5b4f1ff99a 100644
--- a/app/views/notify/reassigned_merge_request_email.text.erb
+++ b/app/views/notify/reassigned_merge_request_email.text.erb
@@ -1,7 +1 @@
-Reassigned Merge Request #<%= @merge_request.iid %>
-
-<%= url_for(project_merge_request_url(@merge_request.target_project, @merge_request)) %>
-
-
-Assignee changed <%= "from #{@previous_assignee.name}" if @previous_assignee %> to <%= @merge_request.assignee_name %>
-
+<%= render 'reassigned_issuable_email', issuable: @merge_request %>
diff --git a/app/views/projects/_home_panel.html.haml b/app/views/projects/_home_panel.html.haml
index 62348f26f0a..1627a61d236 100644
--- a/app/views/projects/_home_panel.html.haml
+++ b/app/views/projects/_home_panel.html.haml
@@ -1,36 +1,48 @@
- empty_repo = @project.empty_repo?
.project-home-panel{:class => ("empty-project" if empty_repo)}
- .visibility-level-label.has_tooltip{'data-title' => "#{visibility_level_label(@project.visibility_level)} project" }
- = visibility_level_icon(@project.visibility_level)
- .row
- .col-sm-6
- %h4.project-home-title
- = @project.name_with_namespace
+ .project-home-row
+ .project-home-desc
+ - if @project.description.present?
+ = auto_link ERB::Util.html_escape(@project.description), link: :urls
+ - if can?(current_user, :admin_project, @project)
+ &ndash;
+ = link_to 'Edit', edit_project_path
+ - elsif !@project.empty_repo? && @repository.readme
+ - readme = @repository.readme
+ &ndash;
+ = link_to project_blob_path(@project, tree_join(@repository.root_ref, readme.name)) do
+ = readme.name
+ .star-fork-buttons
+ - unless @project.empty_repo?
+ .fork-buttons
+ - if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace
+ - if current_user.already_forked?(@project)
+ = link_to project_path(current_user.fork_of(@project)), title: 'Got to my fork' do
+ %i.icon-code-fork
+ Fork
+ %span.count
+ = @project.forks_count
+ - else
+ = link_to fork_project_path(@project), title: "Fork project", method: "POST" do
+ %i.icon-code-fork
+ Fork
+ %span.count
+ = @project.forks_count
- .col-sm-6
- - if current_user && !empty_repo
- .project-home-dropdown
- = render "dropdown"
- = render "shared/clone_panel"
+ .star-buttons
+ %span.star.js-toggler-container{class: @show_star ? 'on' : ''}
+ - if current_user
+ = link_to_toggle_star('Star this project.', false, true)
+ = link_to_toggle_star('Unstar this project.', true, true)
+ - else
+ = link_to_toggle_star('You must sign in to star a project.', false, false)
- .project-home-extra.row
- .col-md-7
- .project-home-desc
- - if @project.description.present?
- = auto_link ERB::Util.html_escape(@project.description), link: :urls
- - if can?(current_user, :admin_project, @project)
- &ndash;
- %strong= link_to 'Edit', edit_project_path
- - elsif !@project.empty_repo? && @repository.readme
- - readme = @repository.readme
- &ndash;
- = link_to project_blob_path(@project, tree_join(@repository.root_ref, readme.name)) do
- = readme.name
-
- .col-md-5
- .project-home-links
- - unless empty_repo
- = link_to pluralize(number_with_delimiter(@repository.commit_count), 'commit'), project_commits_path(@project, @ref || @repository.root_ref)
- = link_to pluralize(number_with_delimiter(@repository.branch_names.count), 'branch'), project_branches_path(@project)
- = link_to pluralize(number_with_delimiter(@repository.tag_names.count), 'tag'), project_tags_path(@project)
- %span.light.prepend-left-20= repository_size
+ .project-home-row
+ - if current_user && !empty_repo
+ .project-home-dropdown
+ = render "dropdown"
+ - unless @project.empty_repo?
+ - if can? current_user, :download_code, @project
+ .pull-right.prepend-left-10
+ = render 'projects/repositories/download_archive', split_button: true
+ = render "shared/clone_panel"
diff --git a/app/views/projects/_issuable_form.html.haml b/app/views/projects/_issuable_form.html.haml
new file mode 100644
index 00000000000..402cdb44182
--- /dev/null
+++ b/app/views/projects/_issuable_form.html.haml
@@ -0,0 +1,43 @@
+.form-group
+ = f.label :title, class: 'control-label' do
+ %strong= 'Title *'
+ .col-sm-10
+ = f.text_field :title, maxlength: 255, autofocus: true,
+ class: 'form-control pad js-gfm-input', required: true
+.form-group.issuable-description
+ = f.label :description, 'Description', class: 'control-label'
+ .col-sm-10
+ .zennable
+ %input#zen-toggle-comment{ tabindex: '-1', type: 'checkbox' }
+ .zen-backdrop
+ = f.text_area :description, rows: 14, class: 'form-control js-gfm-input markdown-area', placeholder: 'Leave a comment'
+ %label{ for: 'zen-toggle-comment', class: 'expand' } Edit in fullscreen
+ %label{ for: 'zen-toggle-comment', class: 'collapse' }
+ .col-sm-12.hint
+ .pull-left
+ Parsed with
+ #{link_to 'GitLab Flavored Markdown', help_page_path('markdown', 'markdown'), target: '_blank'}.
+ .pull-right
+ Attach images (JPG, PNG, GIF) by dragging &amp; dropping
+ or #{link_to 'selecting them', '#', class: 'markdown-selector' }.
+ .clearfix
+ .error-alert
+%hr
+.form-group
+ .issue-assignee
+ = f.label :assignee_id, class: 'control-label' do
+ %i.icon-user
+ Assign to
+ .col-sm-10
+ = project_users_select_tag("#{issuable.class.model_name.param_key}[assignee_id]",
+ placeholder: 'Select a user', class: 'custom-form-control',
+ selected: issuable.assignee_id)
+ &nbsp;
+ = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
+.form-group
+ .issue-milestone
+ = f.label :milestone_id, class: 'control-label' do
+ %i.icon-time
+ Milestone
+ .col-sm-10= f.select(:milestone_id, milestone_options(issuable),
+ { include_blank: 'Select milestone' }, { class: 'select2' })
diff --git a/app/views/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml
index cdca8b2e634..64bbd495102 100644
--- a/app/views/projects/blame/show.html.haml
+++ b/app/views/projects/blame/show.html.haml
@@ -8,7 +8,7 @@
= @path
%small= number_to_human_size @blob.size
%span.options= render "projects/blob/actions"
- .file-content.blame
+ .file-content.blame.highlight
%table
- current_line = 1
- @blame.each do |commit, lines|
@@ -33,7 +33,8 @@
- current_line += 1
%td.lines
%pre
- :erb
- <% lines.each do |line| %>
- <%= line %>
- <% end %>
+ %code{ class: highlightjs_class(@blob.name) }
+ :erb
+ <% lines.each do |line| %>
+ <%= line %>
+ <% end %>
diff --git a/app/views/projects/blob/_actions.html.haml b/app/views/projects/blob/_actions.html.haml
index cabef3c19fe..8587dc4bc6d 100644
--- a/app/views/projects/blob/_actions.html.haml
+++ b/app/views/projects/blob/_actions.html.haml
@@ -13,6 +13,9 @@
- else
= link_to "blame", project_blame_path(@project, @id), class: "btn btn-small" unless @blob.empty?
= link_to "history", project_commits_path(@project, @id), class: "btn btn-small"
+ - if @ref != @commit.sha
+ = link_to 'permalink', project_blob_path(@project,
+ tree_join(@commit.sha, @path)), class: 'btn btn-small'
- if allowed_tree_edit?
= link_to '#modal-remove-blob', class: "remove-blob btn btn-small btn-remove", "data-toggle" => "modal" do
diff --git a/app/views/projects/blob/_remove.html.haml b/app/views/projects/blob/_remove.html.haml
index 692248dd233..93ffd4463b1 100644
--- a/app/views/projects/blob/_remove.html.haml
+++ b/app/views/projects/blob/_remove.html.haml
@@ -19,5 +19,8 @@
.form-group
.col-sm-2
.col-sm-10
- = submit_tag 'Remove file', class: 'btn btn-remove'
+ = submit_tag 'Remove file', class: 'btn btn-remove btn-remove-file'
= link_to "Cancel", '#', class: "btn btn-cancel", "data-dismiss" => "modal"
+
+:javascript
+ disableButtonIfEmptyField('#commit_message', '.btn-remove-file')
diff --git a/app/views/projects/blob/diff.html.haml b/app/views/projects/blob/diff.html.haml
index cfb91d6568a..5c79d0ef11f 100644
--- a/app/views/projects/blob/diff.html.haml
+++ b/app/views/projects/blob/diff.html.haml
@@ -1,7 +1,7 @@
- if @lines.present?
- if @form.unfold? && @form.since != 1 && !@form.bottom?
%tr.line_holder{ id: @form.since }
- = render "projects/commits/diffs/match_line", {line: @match_line,
+ = render "projects/diffs/match_line", {line: @match_line,
line_old: @form.since, line_new: @form.since, bottom: false}
- @lines.each_with_index do |line, index|
@@ -15,5 +15,5 @@
- if @form.unfold? && @form.bottom? && @form.to < @blob.loc
%tr.line_holder{ id: @form.to }
- = render "projects/commits/diffs/match_line", {line: @match_line,
+ = render "projects/diffs/match_line", {line: @match_line,
line_old: @form.to, line_new: @form.to, bottom: true}
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml
index 54a7b934dd7..08a537e0541 100644
--- a/app/views/projects/branches/_branch.html.haml
+++ b/app/views/projects/branches/_branch.html.haml
@@ -2,7 +2,7 @@
%li(class="js-branch-#{branch.name}")
%h4
= link_to project_tree_path(@project, branch.name) do
- %strong= truncate(branch.name, length: 60)
+ %strong.str-truncated= branch.name
- if branch.name == @repository.root_ref
%span.label.label-info default
- if @project.protected_branch? branch.name
diff --git a/app/views/projects/branches/destroy.js.haml b/app/views/projects/branches/destroy.js.haml
index ec1661c0aaa..882a4d0c5e2 100644
--- a/app/views/projects/branches/destroy.js.haml
+++ b/app/views/projects/branches/destroy.js.haml
@@ -1,3 +1 @@
-:plain
- $(".js-branch-#{@branch_name}").remove();
- $('.js-totalbranch-count').html("#{@repository.branches.size}")
+$('.js-totalbranch-count').html("#{@repository.branches.size}")
diff --git a/app/views/projects/branches/new.html.haml b/app/views/projects/branches/new.html.haml
index 5da2ede2937..3f202f7ea6b 100644
--- a/app/views/projects/branches/new.html.haml
+++ b/app/views/projects/branches/new.html.haml
@@ -1,3 +1,7 @@
+- if @error
+ .alert.alert-danger
+ %button{ type: "button", class: "close", "data-dismiss" => "alert"} &times;
+ = @error
%h3.page-title
%i.icon-code-fork
New branch
@@ -5,11 +9,11 @@
.form-group
= label_tag :branch_name, 'Name for new branch', class: 'control-label'
.col-sm-10
- = text_field_tag :branch_name, nil, placeholder: 'enter new branch name', required: true, tabindex: 1, class: 'form-control'
+ = text_field_tag :branch_name, params[:branch_name], placeholder: 'enter new branch name', required: true, tabindex: 1, class: 'form-control'
.form-group
= label_tag :ref, 'Create from', class: 'control-label'
.col-sm-10
- = text_field_tag :ref, nil, placeholder: 'existing branch name, tag or commit SHA', required: true, tabindex: 2, class: 'form-control'
+ = text_field_tag :ref, params[:ref], placeholder: 'existing branch name, tag or commit SHA', required: true, tabindex: 2, class: 'form-control'
.form-actions
= submit_tag 'Create branch', class: 'btn btn-create', tabindex: 3
= link_to 'Cancel', project_branches_path(@project), class: 'btn btn-cancel'
diff --git a/app/views/projects/commit/show.html.haml b/app/views/projects/commit/show.html.haml
index 0a15aef6cb7..fc721067ed4 100644
--- a/app/views/projects/commit/show.html.haml
+++ b/app/views/projects/commit/show.html.haml
@@ -1,3 +1,3 @@
= render "commit_box"
-= render "projects/commits/diffs", diffs: @diffs, project: @project
+= render "projects/diffs/diffs", diffs: @diffs, project: @project
= render "projects/notes/notes_with_form"
diff --git a/app/views/projects/commits/_diff_file.html.haml b/app/views/projects/commits/_diff_file.html.haml
deleted file mode 100644
index 6e6107c8849..00000000000
--- a/app/views/projects/commits/_diff_file.html.haml
+++ /dev/null
@@ -1,44 +0,0 @@
-- file = project.repository.blob_for_diff(@commit, diff)
-- return unless file
-- blob_diff_path = diff_project_blob_path(project,
- tree_join(@commit.id, diff.new_path))
-.diff-file{id: "diff-#{i}", data: {blob_diff_path: blob_diff_path }}
- .diff-header{id: "file-path-#{hexdigest(diff.new_path || diff.old_path)}"}
- - if diff.deleted_file
- %span= diff.old_path
-
- .diff-btn-group
- - if @commit.parent_ids.present?
- = view_file_btn(@commit.parent_id, diff, project)
- - else
- %span= diff.new_path
- - if diff_file_mode_changed?(diff)
- %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"
-
- .diff-btn-group
- = link_to "#", class: "js-toggle-diff-comments btn btn-small" do
- %i.icon-chevron-down
- Diff comments
- &nbsp;
-
- - if @merge_request && @merge_request.source_project
- = link_to project_edit_tree_path(@merge_request.source_project, tree_join(@merge_request.source_branch, diff.new_path), from_merge_request_id: @merge_request.id), { class: 'btn btn-small' } do
- Edit
- &nbsp;
-
- = view_file_btn(@commit.id, diff, project)
-
- .diff-content
- -# Skipp all non non-supported blobs
- - return unless file.respond_to?('text?')
- - if file.text?
- - if params[:view] == 'parallel'
- = render "projects/commits/parallel_view", diff: diff, project: project, file: file, index: i
- - else
- = render "projects/commits/text_file", diff: diff, index: i
- - elsif file.image?
- - old_file = project.repository.prev_blob_for_diff(@commit, diff)
- = render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i
- - else
- .nothing-here-block No preview for this file type
-
diff --git a/app/views/projects/commits/_diffs.html.haml b/app/views/projects/commits/_diffs.html.haml
deleted file mode 100644
index 64d6a2f09cf..00000000000
--- a/app/views/projects/commits/_diffs.html.haml
+++ /dev/null
@@ -1,23 +0,0 @@
-.row
- .col-md-8
- = render 'projects/commits/diff_stats', diffs: diffs
- .col-md-4
- %ul.nav.nav-tabs
- %li.pull-right{class: params[:view] == 'parallel' ? 'active' : ''}
- = link_to "Side-by-side Diff", url_for(view: 'parallel'), {id: "commit-diff-viewtype"}
- %li.pull-right{class: params[:view] != 'parallel' ? 'active' : ''}
- = link_to "Inline Diff", url_for(view: 'inline'), {id: "commit-diff-viewtype"}
-
-- if show_diff_size_warninig?(diffs)
- = render 'projects/commits/diff_warning', diffs: diffs
-
-.files
- - safe_diff_files(diffs).each_with_index do |diff, i|
- = render 'projects/commits/diff_file', diff: diff, i: i, project: project
-
-- if @diff_timeout
- .alert.alert-danger
- %h4
- Failed to collect changes
- %p
- Maybe diff is really big and operation failed with timeout. Try to get diff localy
diff --git a/app/views/projects/commits/_head.html.haml b/app/views/projects/commits/_head.html.haml
index b636e8ffe16..2dcd84af010 100644
--- a/app/views/projects/commits/_head.html.haml
+++ b/app/views/projects/commits/_head.html.haml
@@ -12,7 +12,7 @@
= nav_link(controller: :tags) do
= link_to project_tags_path(@project) do
Tags
- %span.badge= @repository.tags.length
+ %span.badge.js-totaltags-count= @repository.tags.length
= nav_link(controller: :repositories, action: :stats) do
= link_to stats_project_repository_path(@project) do
diff --git a/app/views/projects/commits/_parallel_view.html.haml b/app/views/projects/commits/_parallel_view.html.haml
deleted file mode 100644
index 80f5be98f2f..00000000000
--- a/app/views/projects/commits/_parallel_view.html.haml
+++ /dev/null
@@ -1,38 +0,0 @@
-/ Side-by-side diff view
-- old_lines, new_lines = parallel_diff_lines(project, @commit, diff, file)
-- num_lines = old_lines.length
-
-%div.text-file
- %table
- - num_lines.times do |index|
- - new_line = new_lines[index]
- - old_line = old_lines[index]
- %tr.line_holder.parallel
- -# For old line
- - if old_line.type == :file_created
- %td.old_line= old_line.num
- %td.line_content.parallel= "File was created"
- - elsif old_line.type == :deleted
- %td.old_line.old= old_line.num
- %td.line_content{class: "parallel noteable_line old #{old_line.code}", "line_code" => old_line.code}= old_line.content
- - else old_line.type == :no_change
- %td.old_line= old_line.num
- %td.line_content.parallel= old_line.content
-
- -# For new line
- - if new_line.type == :file_deleted
- %td.new_line= new_line.num
- %td.line_content.parallel= "File was deleted"
- - elsif new_line.type == :added
- %td.new_line.new= new_line.num
- %td.line_content{class: "parallel noteable_line new #{new_line.code}", "line_code" => new_line.code}= new_line.content
- - else new_line.type == :no_change
- %td.new_line= new_line.num
- %td.line_content.parallel= new_line.content
-
- - if @reply_allowed
- - comments1 = @line_notes.select { |n| n.line_code == old_line.code }.sort_by(&:created_at)
- - comments2 = @line_notes.select { |n| n.line_code == new_line.code }.sort_by(&:created_at)
- - unless comments1.empty? and comments2.empty?
- = render "projects/notes/diff_notes_with_reply_parallel", notes1: comments1, notes2: comments2
-
diff --git a/app/views/projects/compare/show.html.haml b/app/views/projects/compare/show.html.haml
index aa79d08509b..45269e662cd 100644
--- a/app/views/projects/compare/show.html.haml
+++ b/app/views/projects/compare/show.html.haml
@@ -18,7 +18,7 @@
- else
%ul.well-list= render Commit.decorate(@commits), project: @project
- = render "projects/commits/diffs", diffs: @diffs, project: @project
+ = render "projects/diffs/diffs", diffs: @diffs, project: @project
- else
.light-well
diff --git a/app/views/projects/diffs/_diffs.html.haml b/app/views/projects/diffs/_diffs.html.haml
new file mode 100644
index 00000000000..334ea1ba82f
--- /dev/null
+++ b/app/views/projects/diffs/_diffs.html.haml
@@ -0,0 +1,27 @@
+.row
+ .col-md-8
+ = render 'projects/diffs/stats', diffs: diffs
+ .col-md-4
+ %ul.nav.nav-tabs
+ %li.pull-right{class: params[:view] == 'parallel' ? 'active' : ''}
+ - params_copy = params.dup
+ - params_copy[:view] = 'parallel'
+ = link_to "Side-by-side Diff", url_for(params_copy), {id: "commit-diff-viewtype"}
+ %li.pull-right{class: params[:view] != 'parallel' ? 'active' : ''}
+ - params_copy[:view] = 'inline'
+ = link_to "Inline Diff", url_for(params_copy), {id: "commit-diff-viewtype"}
+
+
+- if show_diff_size_warning?(diffs)
+ = render 'projects/diffs/warning', diffs: diffs
+
+.files
+ - safe_diff_files(diffs).each_with_index do |diff_file, index|
+ = render 'projects/diffs/file', diff_file: diff_file, i: index, project: project
+
+- if @diff_timeout
+ .alert.alert-danger
+ %h4
+ Failed to collect changes
+ %p
+ Maybe diff is really big and operation failed with timeout. Try to get diff locally
diff --git a/app/views/projects/diffs/_file.html.haml b/app/views/projects/diffs/_file.html.haml
new file mode 100644
index 00000000000..f2a8d148cc6
--- /dev/null
+++ b/app/views/projects/diffs/_file.html.haml
@@ -0,0 +1,48 @@
+- blob = project.repository.blob_for_diff(@commit, diff_file.diff)
+- return unless blob
+- blob_diff_path = diff_project_blob_path(project, tree_join(@commit.id, diff_file.file_path))
+.diff-file{id: "diff-#{i}", data: {blob_diff_path: blob_diff_path }}
+ .diff-header{id: "file-path-#{hexdigest(diff_file.new_path || diff_file.old_path)}"}
+ - if diff_file.deleted_file
+ %span= diff_file.old_path
+
+ .diff-btn-group
+ - if @commit.parent_ids.present?
+ = view_file_btn(@commit.parent_id, diff_file, project)
+ - else
+ %span= diff_file.new_path
+ - if diff_file.mode_changed?
+ %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"
+
+ .diff-btn-group
+ - unless params[:view] == 'parallel'
+ %label
+ = check_box_tag nil, 1, false, class: "js-toggle-diff-line-wrap"
+ Wrap text
+ &nbsp;
+ = link_to "#", class: "js-toggle-diff-comments btn btn-small" do
+ %i.icon-chevron-down
+ Diff comments
+ &nbsp;
+
+ - if @merge_request && @merge_request.source_project
+ = link_to project_edit_tree_path(@merge_request.source_project, tree_join(@merge_request.source_branch, diff_file.new_path), from_merge_request_id: @merge_request.id), { class: 'btn btn-small' } do
+ Edit
+ &nbsp;
+
+ = view_file_btn(@commit.id, diff_file, project)
+
+ .diff-content
+ -# Skipp all non non-supported blobs
+ - return unless blob.respond_to?('text?')
+ - if blob.text?
+ - if params[:view] == 'parallel'
+ = render "projects/diffs/parallel_view", diff_file: diff_file, project: project, blob: blob, index: i
+ - else
+ = render "projects/diffs/text_file", diff_file: diff_file, index: i
+ - elsif blob.image?
+ - old_file = project.repository.prev_blob_for_diff(@commit, diff_file)
+ = render "projects/diffs/image", diff_file: diff_file, old_file: old_file, file: blob, index: i
+ - else
+ .nothing-here-block No preview for this file type
+
diff --git a/app/views/projects/commits/_image.html.haml b/app/views/projects/diffs/_image.html.haml
index 6d9ef5964d9..900646dd0a4 100644
--- a/app/views/projects/commits/_image.html.haml
+++ b/app/views/projects/diffs/_image.html.haml
@@ -1,3 +1,4 @@
+- diff = diff_file.diff
- if diff.renamed_file || diff.new_file || diff.deleted_file
.image
%span.wrap
diff --git a/app/views/projects/commits/diffs/_match_line.html.haml b/app/views/projects/diffs/_match_line.html.haml
index 4ebe3379733..4ebe3379733 100644
--- a/app/views/projects/commits/diffs/_match_line.html.haml
+++ b/app/views/projects/diffs/_match_line.html.haml
diff --git a/app/views/projects/diffs/_match_line_parallel.html.haml b/app/views/projects/diffs/_match_line_parallel.html.haml
new file mode 100644
index 00000000000..815df16aa4a
--- /dev/null
+++ b/app/views/projects/diffs/_match_line_parallel.html.haml
@@ -0,0 +1,4 @@
+%td.old_line
+ %td.line_content.parallel.matched= line
+%td.new_line
+ %td.line_content.parallel.matched= line
diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml
new file mode 100644
index 00000000000..3ec769e0b83
--- /dev/null
+++ b/app/views/projects/diffs/_parallel_view.html.haml
@@ -0,0 +1,27 @@
+/ Side-by-side diff view
+%div.text-file.diff-wrap-lines
+ %table
+ - parallel_diff(diff_file, index).each do |line|
+ - type_left = line[0]
+ - line_number_left = line[1]
+ - line_content_left = line[2]
+ - line_code = line[3]
+ - type_right = line[4]
+ - line_number_right = line[5]
+ - line_content_right = line[6]
+
+ %tr.line_holder.parallel{id: line_code}
+ - if type_left == 'match'
+ = render "projects/diffs/match_line_parallel", { line: line_content_left,
+ line_old: line_number_left, line_new: line_number_right }
+ - elsif type_left == 'old' || type_left.nil?
+ %td.old_line{class: "#{type_left}"}
+ = link_to raw(line_number_left), "##{line_code}", id: line_code
+ %td.line_content{class: "parallel noteable_line #{type_left} #{line_code}", "line_code" => line_code }= raw line_content_left
+ %td.new_line{ class: "#{type_right == 'new' ? 'new' : nil}", data: { linenumber: line_number_right }}
+ = link_to raw(line_number_right), "##{line_code}", id: line_code
+ %td.line_content.parallel{class: "noteable_line #{type_right == 'new' ? 'new' : nil} #{line_code}", "line_code" => line_code}= raw line_content_right
+
+- if diff_file.diff.diff.blank? && diff_file.mode_changed?
+ .file-mode-changed
+ File mode changed
diff --git a/app/views/projects/commits/_diff_stats.html.haml b/app/views/projects/diffs/_stats.html.haml
index 846a1ee10e6..8ef7cc6e086 100644
--- a/app/views/projects/commits/_diff_stats.html.haml
+++ b/app/views/projects/diffs/_stats.html.haml
@@ -26,7 +26,7 @@
%a{href: "#diff-#{i}"}
%i.icon-minus
= diff.old_path
- = "->"
+ \->
= diff.new_path
- elsif diff.new_file
%span.new-file
diff --git a/app/views/projects/commits/_text_file.html.haml b/app/views/projects/diffs/_text_file.html.haml
index 756481c1b21..b1c987563f1 100644
--- a/app/views/projects/commits/_text_file.html.haml
+++ b/app/views/projects/diffs/_text_file.html.haml
@@ -1,33 +1,36 @@
-- too_big = diff.diff.lines.count > Commit::DIFF_SAFE_LINES
+- too_big = diff_file.diff_lines.count > Commit::DIFF_SAFE_LINES
- if too_big
%a.supp_diff_link Changes suppressed. Click to show
%table.text-file{class: "#{'hide' if too_big}"}
- last_line = 0
- - each_diff_line(diff, index) do |line, type, line_code, line_new, line_old, raw_line|
- - last_line = line_new
+ - diff_file.diff_lines.each_with_index do |line, index|
+ - type = line.type
+ - last_line = line.new_pos
+ - line_code = generate_line_code(diff_file.file_path, line)
+ - line_old = line.old_pos
%tr.line_holder{ id: line_code, class: "#{type}" }
- if type == "match"
- = render "projects/commits/diffs/match_line", {line: line,
- line_old: line_old, line_new: line_new, bottom: false}
+ = render "projects/diffs/match_line", {line: line.text,
+ line_old: line_old, line_new: line.new_pos, bottom: false}
- else
%td.old_line
= link_to raw(type == "new" ? "&nbsp;" : line_old), "##{line_code}", id: line_code
- if @comments_allowed
= link_to_new_diff_note(line_code)
- %td.new_line{data: {linenumber: line_new}}
- = link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", id: line_code
- %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line)
+ %td.new_line{data: {linenumber: line.new_pos}}
+ = link_to raw(type == "old" ? "&nbsp;" : line.new_pos) , "##{line_code}", id: line_code
+ %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line.text)
- if @reply_allowed
- comments = @line_notes.select { |n| n.line_code == line_code }.sort_by(&:created_at)
- unless comments.empty?
- = render "projects/notes/diff_notes_with_reply", notes: comments, line: line
+ = render "projects/notes/diff_notes_with_reply", notes: comments, line: line.text
- if last_line > 0
- = render "projects/commits/diffs/match_line", {line: "",
+ = render "projects/diffs/match_line", {line: "",
line_old: last_line, line_new: last_line, bottom: true}
-- if diff.diff.blank? && diff_file_mode_changed?(diff)
+- if diff_file.diff.blank? && diff_file.mode_changed?
.file-mode-changed
File mode changed
diff --git a/app/views/projects/commits/_diff_warning.html.haml b/app/views/projects/diffs/_warning.html.haml
index 05d516efa11..86ed6bbeaa2 100644
--- a/app/views/projects/commits/_diff_warning.html.haml
+++ b/app/views/projects/diffs/_warning.html.haml
@@ -14,6 +14,6 @@
= link_to "Email patch", project_merge_request_path(@project, @merge_request, format: :patch), class: "btn btn-warning btn-small"
%p
To preserve performance only
- %strong #{safe_diff_files(diffs).size} of #{diffs.size}
+ %strong #{allowed_diff_size} of #{diffs.size}
files displayed.
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index 99b6d8ad288..d9acb685517 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -114,7 +114,7 @@
%br
%strong Once active this project shows up in the search and on the dashboard.
= link_to 'Unarchive', unarchive_project_path(@project),
- data: { confirm: "Are you sure that you want to unarchive this project?\nWhen this project is unarchived it is active and can be comitted to again." },
+ data: { confirm: "Are you sure that you want to unarchive this project?\nWhen this project is unarchived it is active and can be committed to again." },
method: :post, class: "btn btn-remove"
- else
%p
diff --git a/app/views/projects/edit_tree/_diff.html.haml b/app/views/projects/edit_tree/_diff.html.haml
deleted file mode 100644
index cf044feb9a4..00000000000
--- a/app/views/projects/edit_tree/_diff.html.haml
+++ /dev/null
@@ -1,13 +0,0 @@
-%table.text-file
- - each_diff_line(diff, 1) do |line, type, line_code, line_new, line_old, raw_line|
- %tr.line_holder{ id: line_code, class: "#{type}" }
- - if type == "match"
- %td.old_line= "..."
- %td.new_line= "..."
- %td.line_content.matched= line
- - else
- %td.old_line
- = link_to raw(type == "new" ? "&nbsp;" : line_old), "##{line_code}", id: line_code
- %td.new_line= link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", id: line_code
- %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line)
-
diff --git a/app/views/projects/edit_tree/preview.html.haml b/app/views/projects/edit_tree/preview.html.haml
index 87ce5dc31d3..e7c3460ad78 100644
--- a/app/views/projects/edit_tree/preview.html.haml
+++ b/app/views/projects/edit_tree/preview.html.haml
@@ -9,18 +9,17 @@
= raw render_markup(@blob.name, @content)
- else
.file-content.code
- - unless @diff.empty?
+ - unless @diff_lines.empty?
%table.text-file
- - @diff.each do |line, type, line_code, line_new, line_old, raw_line|
- %tr.line_holder{ id: line_code, class: "#{type}" }
- - if type == "match"
+ - @diff_lines.each do |line|
+ %tr.line_holder{ class: "#{line.type}" }
+ - if line.type == "match"
%td.old_line= "..."
%td.new_line= "..."
- %td.line_content.matched= line
+ %td.line_content.matched= line.text
- else
%td.old_line
- = link_to raw(type == "new" ? "&nbsp;" : line_old), "##{line_code}", id: line_code
- %td.new_line= link_to raw(type == "old" ? "&nbsp;" : line_new) , "##{line_code}", id: line_code
- %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw diff_line_content(line)
+ %td.new_line
+ %td.line_content{class: "#{line.type}"}= raw diff_line_content(line.text)
- else
.nothing-here-block No changes.
diff --git a/app/views/projects/edit_tree/show.html.haml b/app/views/projects/edit_tree/show.html.haml
index 05050e7df7c..62798b51d82 100644
--- a/app/views/projects/edit_tree/show.html.haml
+++ b/app/views/projects/edit_tree/show.html.haml
@@ -41,6 +41,7 @@
:javascript
ace.config.set("modePath", gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}/ace")
+ ace.config.loadModule("ace/ext/searchbox");
var ace_mode = "#{@blob.language.try(:ace_mode)}";
var editor = ace.edit("editor");
editor.setValue("#{escape_javascript(@blob.data)}");
diff --git a/app/views/projects/empty.html.haml b/app/views/projects/empty.html.haml
index 97dc73bce14..c0baa3f90e4 100644
--- a/app/views/projects/empty.html.haml
+++ b/app/views/projects/empty.html.haml
@@ -17,7 +17,7 @@
git init
touch README
git add README
- git commit -m 'first commit'
+ git commit -m "first commit"
git remote add origin #{ content_tag(:span, default_url_to_repo, class: 'clone')}
git push -u origin master
diff --git a/app/views/projects/import.html.haml b/app/views/projects/import.html.haml
index 9efb1658c25..2b907748486 100644
--- a/app/views/projects/import.html.haml
+++ b/app/views/projects/import.html.haml
@@ -4,7 +4,7 @@
%h2
%i.icon-spinner.icon-spin
Import in progress.
- %p.monospace git clone --bare #{@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.
:javascript
new ProjectImport();
@@ -23,7 +23,7 @@
.col-sm-10
= f.text_field :import_url, class: 'form-control', placeholder: 'https://github.com/randx/six.git'
.bs-callout.bs-callout-info
- This url must be publicly accessible or you can add a username and password like this: https://username:password@gitlab.com/company/project.git.
+ This URL must be publicly accessible or you can add a username and password like this: https://username:password@gitlab.com/company/project.git.
%br
The import will time out after 4 minutes. For big repositories, use a clone/push combination.
.form-actions
diff --git a/app/views/projects/issues/_form.html.haml b/app/views/projects/issues/_form.html.haml
index b2a8e8e091e..d063f92e87f 100644
--- a/app/views/projects/issues/_form.html.haml
+++ b/app/views/projects/issues/_form.html.haml
@@ -16,37 +16,7 @@
- @issue.errors.full_messages.each do |msg|
%span= msg
%br
- .form-group
- = f.label :title, class: 'control-label' do
- %strong= 'Title *'
- .col-sm-10
- = f.text_field :title, maxlength: 255, class: "form-control js-gfm-input", autofocus: true, required: true
- .form-group
- = f.label :description, 'Description', class: 'control-label'
- .col-sm-10
- = f.text_area :description, class: 'form-control js-gfm-input markdown-area', rows: 14
- .col-sm-12.hint
- .pull-left Issues are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
- .pull-right Attach images (JPG, PNG, GIF) by dragging &amp; dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }.
- .clearfix
- .error-alert
- %hr
- .form-group
- .issue-assignee
- = f.label :assignee_id, class: 'control-label' do
- %i.icon-user
- Assign to
- .col-sm-10
- = project_users_select_tag('issue[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @issue.assignee_id)
- &nbsp;
- = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
- .form-group
- .issue-milestone
- = f.label :milestone_id, class: 'control-label' do
- %i.icon-time
- Milestone
- .col-sm-10= f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2'})
-
+ = render 'projects/issuable_form', f: f, issuable: @issue
.form-group
= f.label :label_ids, class: 'control-label' do
%i.icon-tag
diff --git a/app/views/projects/issues/_head.html.haml b/app/views/projects/issues/_head.html.haml
index dad547d4ebc..82cde14e05d 100644
--- a/app/views/projects/issues/_head.html.haml
+++ b/app/views/projects/issues/_head.html.haml
@@ -24,7 +24,7 @@
%i.icon.icon-list
= form_tag project_issues_path(@project), method: :get, id: "issue_search_form", class: 'pull-left issue-search-form' do
.append-right-10.hidden-xs.hidden-sm
- = search_field_tag :issue_search, nil, { placeholder: 'Filter by title or description', class: 'form-control issue_search search-text-input input-mn-300' }
+ = search_field_tag :issue_search, params[:issue_search], { placeholder: 'Filter by title or description', class: 'form-control issue_search search-text-input input-mn-300' }
= hidden_field_tag :state, params['state']
= hidden_field_tag :scope, params['scope']
= hidden_field_tag :assignee_id, params['assignee_id']
diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml
index db28b831182..1dfcd726068 100644
--- a/app/views/projects/issues/_issue.html.haml
+++ b/app/views/projects/issues/_issue.html.haml
@@ -9,7 +9,7 @@
= link_to_gfm issue.title, project_issue_path(issue.project, issue), class: "row_title"
- if issue.closed?
%small.pull-right
- = "CLOSED"
+ CLOSED
.issue-info
- if issue.assignee
@@ -31,7 +31,8 @@
.issue-labels
- issue.labels.each do |label|
- = render_colored_label(label)
+ = link_to project_issues_path(issue.project, label_name: label.name) do
+ = render_colored_label(label)
.issue-actions
- if can? current_user, :modify_issue, issue
diff --git a/app/views/projects/issues/_issue_context.html.haml b/app/views/projects/issues/_issue_context.html.haml
index d7987f43fbb..8c3f0823386 100644
--- a/app/views/projects/issues/_issue_context.html.haml
+++ b/app/views/projects/issues/_issue_context.html.haml
@@ -5,7 +5,7 @@
Assignee:
- if can?(current_user, :modify_issue, @issue)
- = project_users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @issue.assignee_id)
+ = project_users_select_tag('issue[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @issue.assignee_id)
- elsif issue.assignee
= link_to_member(@project, @issue.assignee)
- else
@@ -15,7 +15,7 @@
%strong.append-right-10
Milestone:
- if can?(current_user, :modify_issue, @issue)
- = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2 select2-compact'})
+ = f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'select2 select2-compact js-select2 js-milestone'})
= hidden_field_tag :issue_context
= f.submit class: 'btn'
- elsif issue.milestone
diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml
index bd5f01ff6a7..41532fea741 100644
--- a/app/views/projects/issues/show.html.haml
+++ b/app/views/projects/issues/show.html.haml
@@ -57,9 +57,9 @@
- content_for :note_actions do
- if can?(current_user, :modify_issue, @issue)
- if @issue.closed?
- = link_to 'Reopen Issue', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-grouped btn-reopen"
+ = link_to 'Reopen Issue', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-grouped btn-reopen js-note-target-reopen", title: 'Reopen Issue'
- else
- = link_to 'Close Issue', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close", title: "Close Issue"
+ = link_to 'Close Issue', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close js-note-target-close", title: "Close Issue"
.participants
%cite.cgray #{@issue.participants.count} participants
@@ -68,6 +68,7 @@
.issue-show-labels.pull-right
- @issue.labels.each do |label|
- = render_colored_label(label)
+ = link_to project_issues_path(@project, label_name: label.name) do
+ = render_colored_label(label)
.voting_notes#notes= render "projects/notes/notes_with_form"
diff --git a/app/views/projects/labels/destroy.js.haml b/app/views/projects/labels/destroy.js.haml
new file mode 100644
index 00000000000..1b4c83ab097
--- /dev/null
+++ b/app/views/projects/labels/destroy.js.haml
@@ -0,0 +1,2 @@
+- if @project.labels.size == 0
+ $('.labels').load(document.URL + ' .light-well').hide().fadeIn(1000)
diff --git a/app/views/projects/labels/index.html.haml b/app/views/projects/labels/index.html.haml
index 075779a9c88..06568278de8 100644
--- a/app/views/projects/labels/index.html.haml
+++ b/app/views/projects/labels/index.html.haml
@@ -7,11 +7,11 @@
Labels
%hr
-- if @labels.present?
- %ul.bordered-list.manage-labels-list
- = render @labels
- = paginate @labels, theme: 'gitlab'
-
-- else
- .light-well
- .nothing-here-block Create first label or #{link_to 'generate', generate_project_labels_path(@project), method: :post} default set of labels
+.labels
+ - if @labels.present?
+ %ul.bordered-list.manage-labels-list
+ = render @labels
+ = paginate @labels, theme: 'gitlab'
+ - else
+ .light-well
+ .nothing-here-block Create first label or #{link_to 'generate', generate_project_labels_path(@project), method: :post} default set of labels
diff --git a/app/views/projects/merge_requests/_form.html.haml b/app/views/projects/merge_requests/_form.html.haml
index 0af89b6e376..a97547aabec 100644
--- a/app/views/projects/merge_requests/_form.html.haml
+++ b/app/views/projects/merge_requests/_form.html.haml
@@ -15,37 +15,7 @@
%div= msg
.merge-request-form-info
- .form-group
- = f.label :title, class: 'control-label' do
- %strong= "Title *"
- .col-sm-10= f.text_field :title, class: "form-control pad js-gfm-input", maxlength: 255, rows: 5, required: true
- .form-group
- = f.label :description, "Description", class: 'control-label'
- .col-sm-10
- = f.text_area :description, class: "form-control js-gfm-input markdown-area", rows: 14
- .col-sm-12.hint
- .pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
- .pull-right Attach images (JPG, PNG, GIF) by dragging &amp; dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }.
- .clearfix
- .error-alert
- %hr
- .form-group
- .issue-assignee
- = f.label :assignee_id, class: 'control-label' do
- %i.icon-user
- Assign to
- .col-sm-10
- = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @merge_request.assignee_id)
- &nbsp;
- = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
- .form-group
- .issue-milestone
- = f.label :milestone_id, class: 'control-label' do
- %i.icon-time
- Milestone
- .col-sm-10= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2'})
-
-
+ = render 'projects/issuable_form', f: f, issuable: @merge_request
.form-group
= f.label :label_ids, class: 'control-label' do
%i.icon-tag
diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml
index 7f5de232dcf..2649fb55c30 100644
--- a/app/views/projects/merge_requests/_merge_request.html.haml
+++ b/app/views/projects/merge_requests/_merge_request.html.haml
@@ -5,7 +5,7 @@
- if merge_request.merged?
%small.pull-right
%i.icon-ok
- = "MERGED"
+ MERGED
- else
%span.pull-right
- if merge_request.for_fork?
@@ -34,4 +34,5 @@
.merge-request-labels
- merge_request.labels.each do |label|
- = render_colored_label(label)
+ = link_to project_merge_requests_path(merge_request.project, label_name: label.name) do
+ = render_colored_label(label)
diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml
index 7c43d355987..657a77eb758 100644
--- a/app/views/projects/merge_requests/_new_submit.html.haml
+++ b/app/views/projects/merge_requests/_new_submit.html.haml
@@ -16,12 +16,17 @@
.form-group
.light
= f.label :title do
- = "Title *"
+ Title *
= f.text_field :title, class: "form-control input-lg js-gfm-input", maxlength: 255, rows: 5, required: true
.form-group
.light
= f.label :description, "Description"
- = f.text_area :description, class: "form-control js-gfm-input markdown-area", rows: 10
+ .zennable
+ %input#zen-toggle-comment{ tabindex: '-1', type: 'checkbox' }
+ .zen-backdrop
+ = f.text_area :description, class: 'form-control js-gfm-input markdown-area', rows: 10, placeholder: 'Leave a comment'
+ %label{ for: 'zen-toggle-comment', class: 'expand' } Edit in fullscreen
+ %label{ for: 'zen-toggle-comment', class: 'collapse' }
.clearfix.hint
.pull-left Description is parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"), target: '_blank'}.
.pull-right Attach images (JPG, PNG, GIF) by dragging & dropping or #{link_to "selecting them", '#', class: 'markdown-selector' }.
@@ -75,7 +80,7 @@
%h4 Changes
- if @diffs.present?
- = render "projects/commits/diffs", diffs: @diffs, project: @project
+ = render "projects/diffs/diffs", diffs: @diffs, project: @project
- elsif @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
.bs-callout.bs-callout-danger
%h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits.
diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml
index 8fca9f0212b..4323c8f65a4 100644
--- a/app/views/projects/merge_requests/_show.html.haml
+++ b/app/views/projects/merge_requests/_show.html.haml
@@ -22,9 +22,9 @@
- content_for :note_actions do
- if can?(current_user, :modify_merge_request, @merge_request)
- unless @merge_request.closed? || @merge_request.merged?
- = link_to 'Close', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :close }), method: :put, class: "btn btn-grouped btn-close close-mr-link", title: "Close merge request"
+ = link_to 'Close', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :close }), method: :put, class: "btn btn-grouped btn-close close-mr-link js-note-target-close", title: "Close merge request"
- if @merge_request.closed?
- = link_to 'Reopen', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :reopen }), method: :put, class: "btn btn-grouped btn-reopen reopen-mr-link", title: "Close merge request"
+ = link_to 'Reopen', project_merge_request_path(@project, @merge_request, merge_request: {state_event: :reopen }), method: :put, class: "btn btn-grouped btn-reopen reopen-mr-link js-note-target-reopen", title: "Reopen merge request"
.diffs.tab-content
- if current_page?(action: 'diffs')
diff --git a/app/views/projects/merge_requests/show/_commits.html.haml b/app/views/projects/merge_requests/show/_commits.html.haml
index 92a7bb927e4..ede709ea1df 100644
--- a/app/views/projects/merge_requests/show/_commits.html.haml
+++ b/app/views/projects/merge_requests/show/_commits.html.haml
@@ -17,7 +17,7 @@
- @commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE).each do |commit|
= render "projects/commits/inline_commit", commit: commit, project: @merge_request.source_project
%li
- other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden top prevent performance issues.
+ other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden to prevent performance issues.
- else
%ul.all-commits.hide.well-list
- @commits.each do |commit|
diff --git a/app/views/projects/merge_requests/show/_context.html.haml b/app/views/projects/merge_requests/show/_context.html.haml
index ab00b34242a..089302e3588 100644
--- a/app/views/projects/merge_requests/show/_context.html.haml
+++ b/app/views/projects/merge_requests/show/_context.html.haml
@@ -5,7 +5,7 @@
Assignee:
- if can?(current_user, :modify_merge_request, @merge_request)
- = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control', selected: @merge_request.assignee_id)
+ = project_users_select_tag('merge_request[assignee_id]', placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: @merge_request.assignee_id)
- elsif merge_request.assignee
= link_to_member(@project, @merge_request.assignee)
- else
@@ -15,7 +15,7 @@
%strong.append-right-10
Milestone:
- if can?(current_user, :modify_merge_request, @merge_request)
- = f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2 select2-compact'})
+ = f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2 select2-compact js-select2 js-milestone'})
= hidden_field_tag :merge_request_context
= f.submit class: 'btn'
- elsif merge_request.milestone
diff --git a/app/views/projects/merge_requests/show/_diffs.html.haml b/app/views/projects/merge_requests/show/_diffs.html.haml
index eb63b68106e..d361c5f579a 100644
--- a/app/views/projects/merge_requests/show/_diffs.html.haml
+++ b/app/views/projects/merge_requests/show/_diffs.html.haml
@@ -1,5 +1,5 @@
- if @merge_request_diff.collected?
- = render "projects/commits/diffs", diffs: @merge_request.diffs, project: @merge_request.source_project
+ = render "projects/diffs/diffs", diffs: @merge_request.diffs, project: @merge_request.source_project
- elsif @merge_request_diff.empty?
.nothing-here-block Nothing to merge from #{@merge_request.source_branch} into #{@merge_request.target_branch}
- else
diff --git a/app/views/projects/merge_requests/show/_participants.html.haml b/app/views/projects/merge_requests/show/_participants.html.haml
index 007c111f7fb..b709c89cec2 100644
--- a/app/views/projects/merge_requests/show/_participants.html.haml
+++ b/app/views/projects/merge_requests/show/_participants.html.haml
@@ -5,4 +5,5 @@
.merge-request-show-labels.pull-right
- @merge_request.labels.each do |label|
- = render_colored_label(label)
+ = link_to project_merge_requests_path(@project, label_name: label.name) do
+ = render_colored_label(label)
diff --git a/app/views/projects/milestones/show.html.haml b/app/views/projects/milestones/show.html.haml
index 42c3f45f6c9..1a495aa1c40 100644
--- a/app/views/projects/milestones/show.html.haml
+++ b/app/views/projects/milestones/show.html.haml
@@ -47,6 +47,8 @@
#{@milestone.closed_items_count} closed
&ndash;
#{@milestone.open_items_count} open
+ &nbsp;
+ %span.light #{@milestone.percent_complete}% complete
%span.pull-right= @milestone.expires_at
.progress.progress-info
.progress-bar{style: "width: #{@milestone.percent_complete}%;"}
diff --git a/app/views/projects/network/show.html.haml b/app/views/projects/network/show.html.haml
index 5310822823d..f8206936e6e 100644
--- a/app/views/projects/network/show.html.haml
+++ b/app/views/projects/network/show.html.haml
@@ -2,8 +2,8 @@
.project-network
.controls
= form_tag project_network_path(@project, @id), method: :get, class: 'form-inline network-form' do |f|
- = text_field_tag :extended_sha1, @options[:extended_sha1], placeholder: "Input an extended SHA1 syntax", class: "search-input form-control input-mx-250"
- = button_tag type: 'submit', class: 'btn btn-success' do
+ = text_field_tag :extended_sha1, @options[:extended_sha1], placeholder: "Input an extended SHA1 syntax", class: 'search-input form-control input-mx-250 search-sha'
+ = button_tag type: 'submit', class: 'btn btn-success btn-search-sha' do
%i.icon-search
.inline.prepend-left-20
.checkbox.light
@@ -15,9 +15,12 @@
= spinner nil, true
:javascript
- new Network({
+ disableButtonIfEmptyField('#extended_sha1', '.btn-search-sha')
+
+ network_graph = new Network({
url: '#{project_network_path(@project, @ref, @options.merge(format: :json))}',
commit_url: '#{project_commit_path(@project, 'ae45ca32').gsub("ae45ca32", "%s")}',
ref: '#{@ref}',
commit_id: '#{@commit.id}'
})
+ new ShortcutsNetwork(network_graph.branch_graph)
diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml
index 7efaf5a087b..949b72356d7 100644
--- a/app/views/projects/new.html.haml
+++ b/app/views/projects/new.html.haml
@@ -48,9 +48,9 @@
.col-sm-10
= f.text_field :import_url, class: 'form-control', placeholder: 'https://github.com/randx/six.git'
.bs-callout.bs-callout-info
- This url must be publicly accessible or you can add a username and password like this: https://username:password@gitlab.com/company/project.git.
+ This URL must be publicly accessible or you can add a username and password like this: https://username:password@gitlab.com/company/project.git.
%br
- The import will time out after 2 minutes. For big repositories, use a clone/push combination.
+ The import will time out after 4 minutes. For big repositories, use a clone/push combination.
%hr
.form-group
diff --git a/app/views/projects/new_tree/show.html.haml b/app/views/projects/new_tree/show.html.haml
index 9ecbbe7508e..2f89bba5b06 100644
--- a/app/views/projects/new_tree/show.html.haml
+++ b/app/views/projects/new_tree/show.html.haml
@@ -1,9 +1,9 @@
%h3.page-title New file
%hr
.file-editor
- = form_tag(project_new_tree_path(@project, @id), method: :put, class: "form-horizontal") do
+ = form_tag(project_new_tree_path(@project, @id), method: :put, class: 'form-horizontal form-new-file') do
.form-group.commit_message-group
- = label_tag 'file_name', class: "control-label" do
+ = label_tag 'file_name', class: 'control-label' do
File name
.col-sm-10
.input-group
@@ -24,7 +24,7 @@
= label_tag 'commit_message', class: "control-label" do
Commit message
.col-sm-10
- = render 'shared/commit_message_container', {textarea: text_area_tag('commit_message',
+ = render 'shared/commit_message_container', {textarea: text_area_tag('commit_message form-control',
params[:commit_message], placeholder: "Added new file", required: true, rows: 3, class: 'form-control')}
.file-holder
@@ -46,7 +46,7 @@
ace.config.set("modePath", gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}/ace-src-noconflict")
var editor = ace.edit("editor");
- disableButtonIfEmptyField("#commit_message", ".js-commit-button");
+ disableButtonIfAnyEmptyField($('.form-new-file'), '.form-control', '.btn-create')
$(".js-commit-button").click(function(){
$("#file-content").val(editor.getValue());
diff --git a/app/views/projects/notes/_diff_note_link.html.haml b/app/views/projects/notes/_diff_note_link.html.haml
deleted file mode 100644
index 377c926a204..00000000000
--- a/app/views/projects/notes/_diff_note_link.html.haml
+++ /dev/null
@@ -1,10 +0,0 @@
-- note = @project.notes.new(@comments_target.merge({ line_code: line_code }))
-= link_to "",
- "javascript:;",
- class: "add-diff-note js-add-diff-note-button",
- data: { noteable_type: note.noteable_type,
- noteable_id: note.noteable_id,
- commit_id: note.commit_id,
- line_code: note.line_code,
- discussion_id: note.discussion_id },
- title: "Add a comment to this line"
diff --git a/app/views/projects/notes/_diff_notes_with_reply.html.haml b/app/views/projects/notes/_diff_notes_with_reply.html.haml
index 79a66eff129..a01056b7166 100644
--- a/app/views/projects/notes/_diff_notes_with_reply.html.haml
+++ b/app/views/projects/notes/_diff_notes_with_reply.html.haml
@@ -3,7 +3,7 @@
- if !defined?(line) || line == note.diff_line
%tr.notes_holder
%td.notes_line{ colspan: 2 }
- %span.btn.disabled
+ %span.discussion-notes-count
%i.icon-comment
= notes.count
%td.notes_content
diff --git a/app/views/projects/notes/_discussion.html.haml b/app/views/projects/notes/_discussion.html.haml
index 8c7964cbf3e..f4c6fad2fed 100644
--- a/app/views/projects/notes/_discussion.html.haml
+++ b/app/views/projects/notes/_discussion.html.haml
@@ -1,8 +1,13 @@
- note = discussion_notes.first
-- if note.for_merge_request?
- - if note.outdated?
- = render "projects/notes/discussions/outdated", discussion_notes: discussion_notes
- - else
- = render "projects/notes/discussions/active", discussion_notes: discussion_notes
-- else
- = render "projects/notes/discussions/commit", discussion_notes: discussion_notes
+.timeline-entry
+ .timeline-entry-inner
+ .timeline-icon
+ = image_tag avatar_icon(note.author_email), class: "avatar s40"
+ .timeline-content
+ - if note.for_merge_request?
+ - if note.outdated?
+ = render "projects/notes/discussions/outdated", discussion_notes: discussion_notes
+ - else
+ = render "projects/notes/discussions/active", discussion_notes: discussion_notes
+ - else
+ = render "projects/notes/discussions/commit", discussion_notes: discussion_notes
diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml
index 5ebafb13f1c..66b79e5026b 100644
--- a/app/views/projects/notes/_form.html.haml
+++ b/app/views/projects/notes/_form.html.haml
@@ -14,7 +14,12 @@
Preview
%div
.note-write-holder
- = f.text_area :note, size: 255, class: 'note_text js-note-text js-gfm-input markdown-area'
+ .zennable
+ %input#zen-toggle-comment{ tabindex: '-1', type: 'checkbox' }
+ .zen-backdrop
+ = f.text_area :note, size: 255, class: 'note_text js-note-text js-gfm-input markdown-area', placeholder: 'Leave a comment'
+ %label{ for: 'zen-toggle-comment', class: 'expand' } Edit in fullscreen
+ %label{ for: 'zen-toggle-comment', class: 'collapse' }
.light.clearfix
.pull-left Comments are parsed with #{link_to "GitLab Flavored Markdown", help_page_path("markdown", "markdown"),{ target: '_blank', tabindex: -1 }}
diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml
index 5e84aed0cc4..394fa88e045 100644
--- a/app/views/projects/notes/_note.html.haml
+++ b/app/views/projects/notes/_note.html.haml
@@ -1,66 +1,69 @@
-%li{ id: dom_id(note), class: dom_class(note), data: { discussion: note.discussion_id } }
- .note-header
- .note-actions
- = link_to "##{dom_id(note)}", name: dom_id(note) do
- %i.icon-link
- Link here
- &nbsp;
- - if(note.author_id == current_user.try(:id)) || can?(current_user, :admin_note, @project)
- = link_to "#", title: "Edit comment", class: "js-note-edit" do
- %i.icon-edit
- Edit
- &nbsp;
- = link_to project_note_path(@project, note), title: "Remove comment", method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: "danger js-note-delete" do
- %i.icon-trash.cred
- Remove
- = image_tag avatar_icon(note.author_email), class: "avatar s32"
- = link_to_member(@project, note.author, avatar: false)
- %span.note-last-update
- = note_timestamp(note)
+%li.timeline-entry{ id: dom_id(note), class: dom_class(note), data: { discussion: note.discussion_id } }
+ .timeline-entry-inner
+ .timeline-icon
+ = image_tag avatar_icon(note.author_email), class: "avatar s40"
+ .timeline-content
+ .note-header
+ .note-actions
+ = link_to "##{dom_id(note)}", name: dom_id(note) do
+ %i.icon-link
+ Link here
+ &nbsp;
+ - if can?(current_user, :admin_note, note) && note.editable?
+ = link_to "#", title: "Edit comment", class: "js-note-edit" do
+ %i.icon-edit
+ Edit
+ &nbsp;
+ = link_to project_note_path(@project, note), title: "Remove comment", method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: "danger js-note-delete" do
+ %i.icon-trash.cred
+ Remove
+ = link_to_member(@project, note.author, avatar: false)
+ %span.note-last-update
+ = note_timestamp(note)
- - if note.upvote?
- %span.vote.upvote.label.label-success
- %i.icon-thumbs-up
- \+1
- - if note.downvote?
- %span.vote.downvote.label.label-danger
- %i.icon-thumbs-down
- \-1
+ - if note.upvote?
+ %span.vote.upvote.label.label-success
+ %i.icon-thumbs-up
+ \+1
+ - if note.downvote?
+ %span.vote.downvote.label.label-danger
+ %i.icon-thumbs-down
+ \-1
- .note-body
- .note-text
- = preserve do
- = markdown(note.note, {no_header_anchors: true})
+ .note-body
+ .note-text
+ = preserve do
+ = markdown(note.note, {no_header_anchors: true})
- .note-edit-form
- = form_for note, url: project_note_path(@project, note), method: :put, remote: true, authenticity_token: true do |f|
- = f.text_area :note, class: 'note_text js-note-text js-gfm-input turn-on'
+ .note-edit-form
+ = form_for note, url: project_note_path(@project, note), method: :put, remote: true, authenticity_token: true do |f|
+ = f.text_area :note, class: 'note_text js-note-text js-gfm-input turn-on'
- .form-actions.clearfix
- = f.submit 'Save changes', class: "btn btn-primary btn-save js-comment-button"
+ .form-actions.clearfix
+ = f.submit 'Save changes', class: "btn btn-primary btn-save js-comment-button"
- .note-form-option
- %a.choose-btn.btn.js-choose-note-attachment-button
- %i.icon-paper-clip
- %span Choose File ...
- &nbsp;
- %span.file_name.js-attachment-filename File name...
- = f.file_field :attachment, class: "js-note-attachment-input hidden"
+ .note-form-option
+ %a.choose-btn.btn.js-choose-note-attachment-button
+ %i.icon-paper-clip
+ %span Choose File ...
+ &nbsp;
+ %span.file_name.js-attachment-filename File name...
+ = f.file_field :attachment, class: "js-note-attachment-input hidden"
- = link_to 'Cancel', "#", class: "btn btn-cancel note-edit-cancel"
+ = link_to 'Cancel', "#", class: "btn btn-cancel note-edit-cancel"
- - if note.attachment.url
- .note-attachment
- - if note.attachment.image?
- = link_to note.attachment.secure_url, target: '_blank' do
- = image_tag note.attachment.secure_url, class: 'note-image-attach'
- .attachment.pull-right
- = link_to note.attachment.secure_url, target: "_blank" do
- %i.icon-paper-clip
- = note.attachment_identifier
- = link_to delete_attachment_project_note_path(@project, note),
- title: "Delete this attachment", method: :delete, remote: true, data: { confirm: 'Are you sure you want to remove the attachment?' }, class: "danger js-note-attachment-delete" do
- %i.icon-trash.cred
- .clear
+ - if note.attachment.url
+ .note-attachment
+ - if note.attachment.image?
+ = link_to note.attachment.secure_url, target: '_blank' do
+ = image_tag note.attachment.secure_url, class: 'note-image-attach'
+ .attachment.pull-right
+ = link_to note.attachment.secure_url, target: "_blank" do
+ %i.icon-paper-clip
+ = note.attachment_identifier
+ = link_to delete_attachment_project_note_path(@project, note),
+ title: "Delete this attachment", method: :delete, remote: true, data: { confirm: 'Are you sure you want to remove the attachment?' }, class: "danger js-note-attachment-delete" do
+ %i.icon-trash.cred
+ .clear
diff --git a/app/views/projects/notes/_notes_with_form.html.haml b/app/views/projects/notes/_notes_with_form.html.haml
index 052661962e4..04ee17a40a0 100644
--- a/app/views/projects/notes/_notes_with_form.html.haml
+++ b/app/views/projects/notes/_notes_with_form.html.haml
@@ -1,4 +1,4 @@
-%ul#notes-list.notes.main-notes-list
+%ul#notes-list.notes.main-notes-list.timeline
= render "projects/notes/notes"
.js-notes-busy
diff --git a/app/views/projects/notes/discussions/_active.html.haml b/app/views/projects/notes/discussions/_active.html.haml
index ef296b35dd5..eb416c5b5f0 100644
--- a/app/views/projects/notes/discussions/_active.html.haml
+++ b/app/views/projects/notes/discussions/_active.html.haml
@@ -5,7 +5,6 @@
= link_to "#", class: "js-toggle-button" do
%i.icon-chevron-up
Show/hide discussion
- = image_tag avatar_icon(note.author_email), class: "avatar s32"
%div
= link_to_member(@project, note.author, avatar: false)
started a discussion
diff --git a/app/views/projects/notes/discussions/_commit.html.haml b/app/views/projects/notes/discussions/_commit.html.haml
index 78460974a9b..a928029a5e5 100644
--- a/app/views/projects/notes/discussions/_commit.html.haml
+++ b/app/views/projects/notes/discussions/_commit.html.haml
@@ -5,7 +5,6 @@
= link_to "#", class: "js-toggle-button" do
%i.icon-chevron-up
Show/hide discussion
- = image_tag avatar_icon(note.author_email), class: "avatar s32"
%div
= link_to_member(@project, note.author, avatar: false)
started a discussion on commit
diff --git a/app/views/projects/notes/discussions/_diff.html.haml b/app/views/projects/notes/discussions/_diff.html.haml
index 26c5494f466..da71220af17 100644
--- a/app/views/projects/notes/discussions/_diff.html.haml
+++ b/app/views/projects/notes/discussions/_diff.html.haml
@@ -11,16 +11,17 @@
%br/
.diff-content
%table
- - each_diff_line_near(diff, note.diff_file_index, note.line_code) do |line, type, line_code, line_new, line_old|
+ - note.truncated_diff_lines.each do |line|
+ - line_code = generate_line_code(note.file_path, line)
%tr.line_holder{ id: line_code }
- - if type == "match"
+ - if line.type == "match"
%td.old_line= "..."
%td.new_line= "..."
- %td.line_content.matched= line
+ %td.line_content.matched= line.text
- else
- %td.old_line= raw(type == "new" ? "&nbsp;" : line_old)
- %td.new_line= raw(type == "old" ? "&nbsp;" : line_new)
- %td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line} &nbsp;"
+ %td.old_line= raw(line.type == "new" ? "&nbsp;" : line.old_pos)
+ %td.new_line= raw(line.type == "old" ? "&nbsp;" : line.new_pos)
+ %td.line_content{class: "noteable_line #{line.type} #{line_code}", "line_code" => line_code}= raw "#{line.text} &nbsp;"
- if line_code == note.line_code
= render "projects/notes/diff_notes_with_reply", notes: discussion_notes
diff --git a/app/views/projects/notes/discussions/_outdated.html.haml b/app/views/projects/notes/discussions/_outdated.html.haml
index 67c29be8ac1..4ae914c107b 100644
--- a/app/views/projects/notes/discussions/_outdated.html.haml
+++ b/app/views/projects/notes/discussions/_outdated.html.haml
@@ -5,7 +5,6 @@
= link_to "#", class: "js-toggle-button" do
%i.icon-chevron-down
Show/hide discussion
- = image_tag avatar_icon(note.author_email), class: "avatar s32"
%div
= link_to_member(@project, note.author, avatar: false)
started a discussion on the
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 0fd290b5398..7902f51f72f 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -1,5 +1,16 @@
= render "home_panel"
+%ul.nav.nav-tabs
+ %li.active
+ = link_to project_path(@project) do
+ Activity
+ .project-home-links
+ - unless @project.empty_repo?
+ = link_to pluralize(number_with_delimiter(@repository.commit_count), 'commit'), project_commits_path(@project, @ref || @repository.root_ref)
+ = link_to pluralize(number_with_delimiter(@repository.branch_names.count), 'branch'), project_branches_path(@project)
+ = link_to pluralize(number_with_delimiter(@repository.tag_names.count), 'tag'), project_tags_path(@project)
+ %span.light.prepend-left-20= repository_size
+
.row
%section.col-md-9
= render "events/event_last_push", event: @last_push
@@ -22,33 +33,7 @@
%br
= link_to @project.forked_from_project.name_with_namespace, project_path(@project.forked_from_project)
- .star-buttons
- %span.star.js-toggler-container{class: @show_star ? 'on' : ''}
- - if current_user
- = link_to_toggle_star('Star this project.', false, true)
- = link_to_toggle_star('Unstar this project.', true, true)
- - else
- = link_to_toggle_star('You must sign in to star a project.', false, false)
-
- unless @project.empty_repo?
- .fork-buttons
- - if current_user && can?(current_user, :fork_project, @project) && @project.namespace != current_user.namespace
- - if current_user.already_forked?(@project)
- = link_to project_path(current_user.fork_of(@project)), class: 'btn btn-block' do
- %i.icon-compass
- Go to fork
- %span.count
- = @project.forks_count
- - else
- = link_to fork_project_path(@project), title: "Fork", class: "btn btn-block", method: "POST" do
- %i.icon-code-fork
- Fork repository
- %span.count
- = @project.forks_count
- - unless @project.empty_repo?
- - if can? current_user, :download_code, @project
- = render 'projects/repositories/download_archive', btn_class: 'btn-block btn-group-justified', split_button: true
-
= link_to project_compare_index_path(@project, from: @repository.root_ref, to: @ref || @repository.root_ref), class: 'btn btn-block' do
Compare code
diff --git a/app/views/projects/tags/destroy.js.haml b/app/views/projects/tags/destroy.js.haml
new file mode 100644
index 00000000000..ada6710f940
--- /dev/null
+++ b/app/views/projects/tags/destroy.js.haml
@@ -0,0 +1,3 @@
+$('.js-totaltags-count').html("#{@repository.tags.size}")
+- if @repository.tags.size == 0
+ $('.tags').load(document.URL + ' .nothing-here-block').hide().fadeIn(1000)
diff --git a/app/views/projects/tags/index.html.haml b/app/views/projects/tags/index.html.haml
index dc3188d43b8..6cbf99239ee 100644
--- a/app/views/projects/tags/index.html.haml
+++ b/app/views/projects/tags/index.html.haml
@@ -12,18 +12,19 @@
Tags give the ability to mark specific points in history as being important
%hr
-- unless @tags.empty?
- %ul.bordered-list
- - @tags.each do |tag|
- = render 'tag', tag: @repository.find_tag(tag)
+.tags
+ - unless @tags.empty?
+ %ul.bordered-list
+ - @tags.each do |tag|
+ = render 'tag', tag: @repository.find_tag(tag)
- = paginate @tags, theme: 'gitlab'
+ = paginate @tags, theme: 'gitlab'
-- else
- .nothing-here-block
- Repository has no tags yet.
- %br
- %small
- Use git tag command to add a new one:
+ - else
+ .nothing-here-block
+ Repository has no tags yet.
%br
- %span.monospace git tag -a v1.4 -m 'version 1.4'
+ %small
+ Use git tag command to add a new one:
+ %br
+ %span.monospace git tag -a v1.4 -m 'version 1.4'
diff --git a/app/views/projects/tags/new.html.haml b/app/views/projects/tags/new.html.haml
index a9fd97f8915..45ee61caf68 100644
--- a/app/views/projects/tags/new.html.haml
+++ b/app/views/projects/tags/new.html.haml
@@ -1,3 +1,7 @@
+- if @error
+ .alert.alert-danger
+ %button{ type: "button", class: "close", "data-dismiss" => "alert"} &times;
+ = @error
%h3.page-title
%i.icon-code-fork
New tag
@@ -5,12 +9,17 @@
.form-group
= label_tag :tag_name, 'Name for new tag', class: 'control-label'
.col-sm-10
- = text_field_tag :tag_name, nil, placeholder: 'v3.0.1', required: true, tabindex: 1, class: 'form-control'
+ = text_field_tag :tag_name, params[:tag_name], placeholder: 'v3.0.1', required: true, tabindex: 1, class: 'form-control'
.form-group
= label_tag :ref, 'Create from', class: 'control-label'
.col-sm-10
- = text_field_tag :ref, nil, placeholder: 'master', required: true, tabindex: 2, class: 'form-control'
+ = text_field_tag :ref, params[:ref], placeholder: 'master', required: true, tabindex: 2, class: 'form-control'
.light Branch name or commit SHA
+ .form-group
+ = label_tag :message, 'Message', class: 'control-label'
+ .col-sm-10
+ = text_field_tag :message, nil, placeholder: 'Enter message.', required: false, tabindex: 3, class: 'form-control'
+ .light (Optional) Entering a message will create an annotated tag.
.form-actions
= submit_tag 'Create tag', class: 'btn btn-create', tabindex: 3
= link_to 'Cancel', project_tags_path(@project), class: 'btn btn-cancel'
diff --git a/app/views/projects/team_members/_form.html.haml b/app/views/projects/team_members/_form.html.haml
index dd059fb99d3..5998e4c6b42 100644
--- a/app/views/projects/team_members/_form.html.haml
+++ b/app/views/projects/team_members/_form.html.haml
@@ -1,5 +1,5 @@
%h3.page-title
- = "New project member(s)"
+ New project member(s)
= form_for @user_project_relation, as: :team_member, url: project_team_members_path(@project), html: { class: "form-horizontal users-project-form" } do |f|
-if @user_project_relation.errors.any?
diff --git a/app/views/projects/team_members/import.html.haml b/app/views/projects/team_members/import.html.haml
index d3e4a762018..510b579fe2f 100644
--- a/app/views/projects/team_members/import.html.haml
+++ b/app/views/projects/team_members/import.html.haml
@@ -1,5 +1,5 @@
%h3.page-title
- = "Import members from another project"
+ Import members from another project
%p.light
Only project members will be imported. Group members will be skipped.
%hr
diff --git a/app/views/search/_filter.html.haml b/app/views/search/_filter.html.haml
index 979b18e3856..049aff0bc9b 100644
--- a/app/views/search/_filter.html.haml
+++ b/app/views/search/_filter.html.haml
@@ -9,14 +9,14 @@
%b.caret
%ul.dropdown-menu
%li
- = link_to search_path(group_id: nil, search: params[:search]) do
+ = link_to search_filter_path(group_id: nil) do
Any
- current_user.authorized_groups.sort_by(&:name).each do |group|
%li
- = link_to search_path(group_id: group.id, search: params[:search]) do
+ = link_to search_filter_path(group_id: group.id, project_id: nil) do
= group.name
-.dropdown.inline.prepend-left-10
+.dropdown.inline.prepend-left-10.project-filter
%a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"}
%i.icon-tags
%span.light Project:
@@ -27,9 +27,9 @@
%b.caret
%ul.dropdown-menu
%li
- = link_to search_path(project_id: nil, search: params[:search]) do
+ = link_to search_filter_path(project_id: nil) do
Any
- current_user.authorized_projects.sort_by(&:name_with_namespace).each do |project|
%li
- = link_to search_path(project_id: project.id, search: params[:search]) do
+ = link_to search_filter_path(project_id: project.id, group_id: nil) do
= project.name_with_namespace
diff --git a/app/views/search/_global_filter.html.haml b/app/views/search/_global_filter.html.haml
new file mode 100644
index 00000000000..442bd84f930
--- /dev/null
+++ b/app/views/search/_global_filter.html.haml
@@ -0,0 +1,16 @@
+%ul.nav.nav-pills.nav-stacked.search-filter
+ %li{class: ("active" if @scope == 'projects')}
+ = link_to search_filter_path(scope: 'projects') do
+ Projects
+ .pull-right
+ = @search_results.projects_count
+ %li{class: ("active" if @scope == 'issues')}
+ = link_to search_filter_path(scope: 'issues') do
+ Issues
+ .pull-right
+ = @search_results.issues_count
+ %li{class: ("active" if @scope == 'merge_requests')}
+ = link_to search_filter_path(scope: 'merge_requests') do
+ Merge requests
+ .pull-right
+ = @search_results.merge_requests_count
diff --git a/app/views/search/_global_results.html.haml b/app/views/search/_global_results.html.haml
deleted file mode 100644
index 7f4f0e5e000..00000000000
--- a/app/views/search/_global_results.html.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-.search_results
- %ul.bordered-list
- = render partial: "search/results/project", collection: @search_results[:projects]
- = render partial: "search/results/merge_request", collection: @search_results[:merge_requests]
- = render partial: "search/results/issue", collection: @search_results[:issues]
diff --git a/app/views/search/_project_filter.html.haml b/app/views/search/_project_filter.html.haml
new file mode 100644
index 00000000000..57a45c9acb6
--- /dev/null
+++ b/app/views/search/_project_filter.html.haml
@@ -0,0 +1,31 @@
+%ul.nav.nav-pills.nav-stacked.search-filter
+ %li{class: ("active" if @scope == 'blobs')}
+ = link_to search_filter_path(scope: 'blobs') do
+ %i.icon-code
+ Code
+ .pull-right
+ = @search_results.blobs_count
+ %li{class: ("active" if @scope == 'issues')}
+ = link_to search_filter_path(scope: 'issues') do
+ %i.icon-exclamation-sign
+ Issues
+ .pull-right
+ = @search_results.issues_count
+ %li{class: ("active" if @scope == 'merge_requests')}
+ = link_to search_filter_path(scope: 'merge_requests') do
+ %i.icon-code-fork
+ Merge requests
+ .pull-right
+ = @search_results.merge_requests_count
+ %li{class: ("active" if @scope == 'notes')}
+ = link_to search_filter_path(scope: 'notes') do
+ %i.icon-comments
+ Comments
+ .pull-right
+ = @search_results.notes_count
+ %li{class: ("active" if @scope == 'wiki_blobs')}
+ = link_to search_filter_path(scope: 'wiki_blobs') do
+ Wiki
+ .pull-right
+ = @search_results.wiki_blobs_count
+
diff --git a/app/views/search/_project_results.html.haml b/app/views/search/_project_results.html.haml
deleted file mode 100644
index 5e8346a8262..00000000000
--- a/app/views/search/_project_results.html.haml
+++ /dev/null
@@ -1,24 +0,0 @@
-%ul.nav.nav-tabs
- %li{class: ("active" if params[:search_code].present?)}
- = link_to search_path(params.merge(search_code: true)) do
- Repository Code
- %li{class: ("active" if params[:search_code].blank?)}
- = link_to search_path(params.merge(search_code: nil)) do
- Issues and Merge requests
-
-.search_results
- - if params[:search_code].present?
- .blob-results
- - if !@search_results[:blobs].empty?
- = render partial: "search/results/blob", collection: @search_results[:blobs]
- = paginate @search_results[:blobs], theme: 'gitlab'
- - else
- = render partial: "search/results/empty", :locals => { message: "We couldn't find any matching code" }
- - else
- - if @search_results[:merge_requests].present? || @search_results[:issues].present? || @search_results[:notes].present?
- %ul.bordered-list
- = render partial: "search/results/merge_request", collection: @search_results[:merge_requests]
- = render partial: "search/results/issue", collection: @search_results[:issues]
- = render partial: "search/results/note", collection: @search_results[:notes]
- - else
- = render partial: "search/results/empty", locals: { message: "We couldn't find any issues, merge requests or notes" }
diff --git a/app/views/search/_results.html.haml b/app/views/search/_results.html.haml
index 2336d0f71d5..58bcff9dbe3 100644
--- a/app/views/search/_results.html.haml
+++ b/app/views/search/_results.html.haml
@@ -1,17 +1,28 @@
%h4
- #{@search_results[:total_results]} results found
- - if @project
- for #{link_to @project.name_with_namespace, @project}
- - elsif @group
- for #{link_to @group.name, @group}
+ #{@search_results.total_count} results found
+ - unless @show_snippets
+ - if @project
+ for #{link_to @project.name_with_namespace, @project}
+ - elsif @group
+ for #{link_to @group.name, @group}
%hr
-- if @project
- = render "project_results"
-- else
- = render "global_results"
+.row
+ .col-sm-3
+ - if @project
+ = render "project_filter"
+ - elsif @show_snippets
+ = render 'snippet_filter'
+ - else
+ = render "global_filter"
+ .col-sm-9
+ .search-results
+ - if @search_results.empty?
+ = render partial: "search/results/empty", locals: { message: "We couldn't find any matching results" }
+ - else
+ = render partial: "search/results/#{@scope.singularize}", collection: @objects
+ = paginate @objects, theme: 'gitlab'
:javascript
- $(".search_results .term").highlight("#{escape_javascript(params[:search])}");
-
+ $(".search-results .term").highlight("#{escape_javascript(params[:search])}");
diff --git a/app/views/search/_snippet_filter.html.haml b/app/views/search/_snippet_filter.html.haml
new file mode 100644
index 00000000000..0d1984a0d78
--- /dev/null
+++ b/app/views/search/_snippet_filter.html.haml
@@ -0,0 +1,13 @@
+%ul.nav.nav-pills.nav-stacked.search-filter
+ %li{class: ("active" if @scope == 'snippet_blobs')}
+ = link_to search_filter_path(scope: 'snippet_blobs', snippets: true, group_id: nil, project_id: nil) do
+ %i.icon-code
+ Snippet Contents
+ .pull-right
+ = @search_results.snippet_blobs_count
+ %li{class: ("active" if @scope == 'snippet_titles')}
+ = link_to search_filter_path(scope: 'snippet_titles', snippets: true, group_id: nil, project_id: nil) do
+ %i.icon-book
+ Titles and Filenames
+ .pull-right
+ = @search_results.snippet_titles_count
diff --git a/app/views/search/results/_issue.html.haml b/app/views/search/results/_issue.html.haml
index 8147cf272fb..7868f958261 100644
--- a/app/views/search/results/_issue.html.haml
+++ b/app/views/search/results/_issue.html.haml
@@ -1,9 +1,14 @@
-%li
- issue:
- = link_to [issue.project, issue] do
- %span ##{issue.iid}
- %strong.term
- = truncate issue.title, length: 50
- %span.light (#{issue.project.name_with_namespace})
+.search-result-row
+ %h4
+ = link_to [issue.project, issue] do
+ %span.term.str-truncated= issue.title
+ .pull-right ##{issue.iid}
+ - if issue.description.present?
+ .description.term
+ = preserve do
+ = search_md_sanitize(markdown(issue.description))
+ %span.light
+ #{issue.project.name_with_namespace}
- if issue.closed?
- %span.label.label-danger Closed
+ .pull-right
+ %span.label.label-danger Closed
diff --git a/app/views/search/results/_merge_request.html.haml b/app/views/search/results/_merge_request.html.haml
index de2a79970c1..56b185283bd 100644
--- a/app/views/search/results/_merge_request.html.haml
+++ b/app/views/search/results/_merge_request.html.haml
@@ -1,14 +1,16 @@
-%li
- merge request:
- = link_to [merge_request.target_project, merge_request] do
- %span ##{merge_request.iid}
- %strong.term
- = truncate merge_request.title, length: 50
- - if merge_request.for_fork?
- %span.light (#{merge_request.source_project.name_with_namespace}:#{merge_request.source_branch} &rarr; #{merge_request.target_project.name_with_namespace}:#{merge_request.target_branch})
- - else
- %span.light (#{merge_request.source_branch} &rarr; #{merge_request.target_branch})
- - if merge_request.merged?
- %span.label.label-primary Merged
- - elsif merge_request.closed?
- %span.label.label-danger Closed
+.search-result-row
+ %h4
+ = link_to [merge_request.target_project, merge_request] do
+ %span.term.str-truncated= merge_request.title
+ .pull-right ##{merge_request.iid}
+ - if merge_request.description.present?
+ .description.term
+ = preserve do
+ = search_md_sanitize(markdown(merge_request.description))
+ %span.light
+ #{merge_request.project.name_with_namespace}
+ .pull-right
+ - if merge_request.merged?
+ %span.label.label-primary Merged
+ - elsif merge_request.closed?
+ %span.label.label-danger Closed
diff --git a/app/views/search/results/_note.html.haml b/app/views/search/results/_note.html.haml
index 97e892bdd4d..6a446538574 100644
--- a/app/views/search/results/_note.html.haml
+++ b/app/views/search/results/_note.html.haml
@@ -1,9 +1,26 @@
-%li
- note on issue:
- = link_to [note.project, note.noteable] do
- %span ##{note.noteable.iid}
- %strong.term
- = truncate note.noteable.title, length: 50
- %span.light (#{note.project.name_with_namespace})
- - if note.noteable.closed?
- %span.label Closed
+- project = note.project
+.search-result-row
+ %h5.note-search-caption.str-truncated
+ %i.icon-comment
+ = link_to_member(project, note.author, avatar: false)
+ commented on
+
+ - if note.for_commit?
+ = link_to project do
+ = project.name_with_namespace
+ &middot;
+ = link_to project_commit_path(project, note.commit_id, anchor: dom_id(note)) do
+ Commit #{note.commit_id[0..8]}
+ - else
+ = link_to project do
+ = project.name_with_namespace
+ &middot;
+ %span #{note.noteable_type.titleize} ##{note.noteable.iid}
+ &middot;
+ = link_to [project, note.noteable, anchor: dom_id(note)] do
+ = note.noteable.title
+
+ .note-search-result
+ .term
+ = preserve do
+ = search_md_sanitize(markdown(note.note, {no_header_anchors: true}))
diff --git a/app/views/search/results/_project.html.haml b/app/views/search/results/_project.html.haml
index abc86c72bef..301b65eca29 100644
--- a/app/views/search/results/_project.html.haml
+++ b/app/views/search/results/_project.html.haml
@@ -1,7 +1,6 @@
-%li
- project:
- = link_to project do
- %strong.term= project.name_with_namespace
+.search-result-row
+ %h4
+ = link_to project do
+ %span.term= project.name_with_namespace
- if project.description.present?
- &ndash;
%span.light.term= project.description
diff --git a/app/views/search/results/_snippet_blob.html.haml b/app/views/search/results/_snippet_blob.html.haml
new file mode 100644
index 00000000000..a3d909d44dc
--- /dev/null
+++ b/app/views/search/results/_snippet_blob.html.haml
@@ -0,0 +1,65 @@
+.search-result-row
+ %span
+ = snippet_blob[:snippet_object].title
+ by
+ = link_to user_snippets_path(snippet_blob[:snippet_object].author) do
+ = image_tag avatar_icon(snippet_blob[:snippet_object].author_email), class: "avatar avatar-inline s16", alt: ''
+ = snippet_blob[:snippet_object].author_name
+ %span.light #{time_ago_with_tooltip(snippet_blob[:snippet_object].created_at)}
+ %h4.snippet-title
+ - snippet_path = reliable_snippet_path(snippet_blob[:snippet_object])
+ = link_to snippet_path do
+ .file-holder
+ .file-title
+ %i.icon-file
+ %strong= snippet_blob[:snippet_object].file_name
+ %span.options
+ .btn-group.tree-btn-group.pull-right
+ - if snippet_blob[:snippet_object].author == current_user
+ = link_to "Edit", edit_snippet_path(snippet_blob[:snippet_object]), class: "btn btn-tiny", title: 'Edit Snippet'
+ = link_to "Delete", snippet_path(snippet_blob[:snippet_object]), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-tiny", title: 'Delete Snippet'
+ = link_to "Raw", raw_snippet_path(snippet_blob[:snippet_object]), class: "btn btn-tiny", target: "_blank"
+ - if gitlab_markdown?(snippet_blob[:snippet_object].file_name)
+ .file-content.wiki
+ - snippet_blob[:snippet_chunks].each do |snippet|
+ - unless snippet[:data].empty?
+ = preserve do
+ = markdown(snippet[:data])
+ - else
+ .file-content.code
+ .nothing-here-block Empty file
+ - elsif markup?(snippet_blob[:snippet_object].file_name)
+ .file-content.wiki
+ - snippet_blob[:snippet_chunks].each do |snippet|
+ - unless snippet[:data].empty?
+ = render_markup(snippet_blob[:snippet_object].file_name, snippet[:data])
+ - else
+ .file-content.code
+ .nothing-here-block Empty file
+ - else
+ .file-content.code
+ %div.highlighted-data{class: user_color_scheme_class}
+ .line-numbers
+ - snippet_blob[:snippet_chunks].each do |snippet|
+ - unless snippet[:data].empty?
+ - snippet[:data].lines.to_a.size.times do |index|
+ - offset = defined?(snippet[:start_line]) ? snippet[:start_line] : 1
+ - i = index + offset
+ = link_to snippet_path+"#L#{i}", id: "L#{i}", rel: "#L#{i}" do
+ %i.icon-link
+ = i
+ - unless snippet == snippet_blob[:snippet_chunks].last
+ %a
+ = "."
+ .highlight.term
+ %pre
+ %code
+ - snippet_blob[:snippet_chunks].each do |snippet|
+ - unless snippet[:data].empty?
+ = snippet[:data]
+ - unless snippet == snippet_blob[:snippet_chunks].last
+ %a
+ = "..."
+ - else
+ .file-content.code
+ .nothing-here-block Empty file
diff --git a/app/views/search/results/_snippet_title.html.haml b/app/views/search/results/_snippet_title.html.haml
new file mode 100644
index 00000000000..84abb9293b2
--- /dev/null
+++ b/app/views/search/results/_snippet_title.html.haml
@@ -0,0 +1,23 @@
+.search-result-row
+ %h4.snippet-title.term
+ = link_to reliable_snippet_path(snippet_title) do
+ = truncate(snippet_title.title, length: 60)
+ - if snippet_title.private?
+ %span.label.label-gray
+ %i.icon-lock
+ private
+ %span.cgray.monospace.tiny.pull-right.term
+ = snippet_title.file_name
+
+ %small.pull-right.cgray
+ - if snippet_title.project_id?
+ = link_to snippet_title.project.name_with_namespace, project_path(snippet_title.project)
+
+ .snippet-info
+ = "##{snippet_title.id}"
+ %span
+ by
+ = link_to user_snippets_path(snippet_title.author) do
+ = image_tag avatar_icon(snippet_title.author_email), class: "avatar avatar-inline s16", alt: ''
+ = snippet_title.author_name
+ %span.light #{time_ago_with_tooltip(snippet_title.created_at)}
diff --git a/app/views/search/results/_wiki_blob.html.haml b/app/views/search/results/_wiki_blob.html.haml
new file mode 100644
index 00000000000..75414d73b0c
--- /dev/null
+++ b/app/views/search/results/_wiki_blob.html.haml
@@ -0,0 +1,9 @@
+.blob-result
+ .file-holder
+ .file-title
+ = link_to project_wiki_path(@project, wiki_blob.filename) do
+ %i.icon-file
+ %strong
+ = wiki_blob.filename
+ .file-content.code.term
+ = render 'shared/file_hljs', blob: wiki_blob, first_line_number: wiki_blob.startline
diff --git a/app/views/search/show.html.haml b/app/views/search/show.html.haml
index 3b6f10d4d9c..bae57917a4c 100644
--- a/app/views/search/show.html.haml
+++ b/app/views/search/show.html.haml
@@ -9,11 +9,13 @@
= submit_tag 'Search', class: "btn btn-create"
.form-group
.col-sm-2
- .col-sm-10
- = render 'filter', f: f
+ - unless params[:snippets].eql? 'true'
+ .col-sm-10
+ = render 'filter', f: f
= hidden_field_tag :project_id, params[:project_id]
= hidden_field_tag :group_id, params[:group_id]
- = hidden_field_tag :search_code, params[:search_code]
+ = hidden_field_tag :snippets, params[:snippets]
+ = hidden_field_tag :scope, params[:scope]
.results.prepend-top-10
- if params[:search].present?
diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml
index 8cd426c71e6..1cc6043f56b 100644
--- a/app/views/shared/_clone_panel.html.haml
+++ b/app/views/shared/_clone_panel.html.haml
@@ -4,3 +4,8 @@
%button{class: "btn #{ 'active' if default_clone_protocol == 'ssh' }", :"data-clone" => project.ssh_url_to_repo} SSH
%button{class: "btn #{ 'active' if default_clone_protocol == 'http' }", :"data-clone" => project.http_url_to_repo}= gitlab_config.protocol.upcase
= text_field_tag :project_clone, default_url_to_repo(project), class: "one_click_select form-control", readonly: true
+ - if project.kind_of?(Project)
+ .input-group-addon
+ .visibility-level-label.has_tooltip{'data-title' => "#{visibility_level_label(project.visibility_level)} project" }
+ = visibility_level_icon(project.visibility_level)
+ = visibility_level_label(project.visibility_level).downcase
diff --git a/app/views/shared/_file_hljs.html.haml b/app/views/shared/_file_hljs.html.haml
index ceee2c7527d..7dd97c2b25c 100644
--- a/app/views/shared/_file_hljs.html.haml
+++ b/app/views/shared/_file_hljs.html.haml
@@ -9,4 +9,4 @@
.highlight
%pre
%code{ class: highlightjs_class(blob.name) }
- = blob.data
+ #{blob.data}
diff --git a/app/views/shared/_promo.html.haml b/app/views/shared/_promo.html.haml
index 7dec48e6585..5675e43b05f 100644
--- a/app/views/shared/_promo.html.haml
+++ b/app/views/shared/_promo.html.haml
@@ -2,3 +2,4 @@
= link_to "Homepage", "https://www.gitlab.com/"
= link_to "Blog", "https://www.gitlab.com/blog/"
= link_to "@gitlabhq", "https://twitter.com/gitlabhq"
+ = link_to "Requests", "http://feedback.gitlab.com/"
diff --git a/app/workers/post_receive.rb b/app/workers/post_receive.rb
index f110e20bf00..1406cba2db3 100644
--- a/app/workers/post_receive.rb
+++ b/app/workers/post_receive.rb
@@ -4,8 +4,7 @@ class PostReceive
sidekiq_options queue: :post_receive
- def perform(repo_path, oldrev, newrev, ref, identifier)
-
+ def perform(repo_path, identifier, changes)
if repo_path.start_with?(Gitlab.config.gitlab_shell.repos_path.to_s)
repo_path.gsub!(Gitlab.config.gitlab_shell.repos_path.to_s, "")
else
@@ -22,17 +21,23 @@ class PostReceive
return false
end
- user = identify(identifier, project, newrev)
+ changes = changes.lines if changes.kind_of?(String)
- unless user
- log("Triggered hook for non-existing user \"#{identifier} \"")
- return false
- end
+ changes.each do |change|
+ oldrev, newrev, ref = change.strip.split(' ')
- if tag?(ref)
- GitTagPushService.new.execute(project, user, oldrev, newrev, ref)
- else
- GitPushService.new.execute(project, user, oldrev, newrev, ref)
+ @user ||= identify(identifier, project, newrev)
+
+ unless @user
+ log("Triggered hook for non-existing user \"#{identifier} \"")
+ return false
+ end
+
+ if tag?(ref)
+ GitTagPushService.new.execute(project, @user, oldrev, newrev, ref)
+ else
+ GitPushService.new.execute(project, @user, oldrev, newrev, ref)
+ end
end
end
diff --git a/bin/background_jobs b/bin/background_jobs
index c7ba4398cfb..59a51c5c868 100755
--- a/bin/background_jobs
+++ b/bin/background_jobs
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
cd $(dirname $0)/..
app_root=$(pwd)
@@ -6,22 +6,22 @@ sidekiq_pidfile="$app_root/tmp/pids/sidekiq.pid"
sidekiq_logfile="$app_root/log/sidekiq.log"
gitlab_user=$(ls -l config.ru | awk '{print $3}')
-function warn
+warn()
{
echo "$@" 1>&2
}
-function stop
+stop()
{
bundle exec sidekiqctl stop $sidekiq_pidfile >> $sidekiq_logfile 2>&1
}
-function killall
+killall()
{
pkill -u $gitlab_user -f 'sidekiq [0-9]'
}
-function restart
+restart()
{
if [ -f $sidekiq_pidfile ]; then
stop
@@ -30,20 +30,20 @@ function restart
start_sidekiq -d -L $sidekiq_logfile
}
-function start_no_deamonize
+start_no_deamonize()
{
start_sidekiq
}
-function start_sidekiq
+start_sidekiq()
{
bundle exec sidekiq -q post_receive -q mailer -q system_hook -q project_web_hook -q gitlab_shell -q common -q default -e $RAILS_ENV -P $sidekiq_pidfile $@ >> $sidekiq_logfile 2>&1
}
-function load_ok
+load_ok()
{
sidekiq_pid=$(cat $sidekiq_pidfile)
- if [[ -z $sidekiq_pid ]] ; then
+ if [ -z "$sidekiq_pid" ] ; then
warn "Could not find a PID in $sidekiq_pidfile"
exit 0
fi
diff --git a/bin/web b/bin/web
index 1ad3b5d24b9..67f236eb0bb 100755
--- a/bin/web
+++ b/bin/web
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
cd $(dirname $0)/..
app_root=$(pwd)
@@ -6,28 +6,28 @@ app_root=$(pwd)
unicorn_pidfile="$app_root/tmp/pids/unicorn.pid"
unicorn_config="$app_root/config/unicorn.rb"
-function get_unicorn_pid
+get_unicorn_pid()
{
local pid=$(cat $unicorn_pidfile)
- if [ -z $pid ] ; then
+ if [ -z "$pid" ] ; then
echo "Could not find a PID in $unicorn_pidfile"
exit 1
fi
unicorn_pid=$pid
}
-function start
+start()
{
bundle exec unicorn_rails -D -c $unicorn_config -E $RAILS_ENV
}
-function stop
+stop()
{
get_unicorn_pid
kill -QUIT $unicorn_pid
}
-function reload
+reload()
{
get_unicorn_pid
kill -USR2 $unicorn_pid
diff --git a/config/application.rb b/config/application.rb
index 58a5949c653..68dce05fc59 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -73,5 +73,24 @@ module Gitlab
resource '/api/*', headers: :any, methods: [:get, :post, :options, :put, :delete]
end
end
+
+ # Use Redis caching across all environments
+ redis_config_file = Rails.root.join('config', 'resque.yml')
+
+ redis_url_string = if File.exists?(redis_config_file)
+ YAML.load_file(redis_config_file)[Rails.env]
+ else
+ "redis://localhost:6379"
+ end
+
+ # Redis::Store does not handle Unix sockets well, so let's do it for them
+ redis_config_hash = Redis::Store::Factory.extract_host_options_from_uri(redis_url_string)
+ redis_uri = URI.parse(redis_url_string)
+ if redis_uri.scheme == 'unix'
+ redis_config_hash[:path] = redis_uri.path
+ end
+
+ redis_config_hash[:namespace] = 'cache:gitlab'
+ config.cache_store = :redis_store, redis_config_hash
end
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 2450d5719eb..78bf543402b 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -45,16 +45,6 @@ Gitlab::Application.configure do
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
- # Use a different cache store in production
- config_file = Rails.root.join('config', 'resque.yml')
-
- resque_url = if File.exists?(config_file)
- YAML.load_file(config_file)[Rails.env]
- else
- "redis://localhost:6379"
- end
- config.cache_store = :redis_store, resque_url, {namespace: 'cache:gitlab'}
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
index d897eb4c02d..f041d692f10 100644
--- a/config/gitlab.yml.example
+++ b/config/gitlab.yml.example
@@ -3,9 +3,11 @@
# # # # # # # # # # # # # # # # # #
#
# How to use:
-# 1. copy file as gitlab.yml
-# 2. Replace gitlab -> host with your domain
-# 3. Replace gitlab -> email_from
+# 1. Copy file as gitlab.yml
+# 2. Update gitlab -> host with your fully qualified domain name
+# 3. Update gitlab -> email_from
+# 4. If you installed Git from source, change git -> bin_path to /usr/local/bin/git
+# 5. Review this configuration file for other settings you may want to adjust
production: &base
#
@@ -16,8 +18,8 @@ production: &base
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: localhost
- port: 80
- https: false
+ port: 80 # Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
+ https: false # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
# Uncommment this line below if your ssh host is different from HTTP/HTTPS one
# (you'd obviously need to replace ssh.host_example.com with your own host).
@@ -61,7 +63,7 @@ production: &base
# Restrict setting visibility levels for non-admin users.
# The default is to allow all levels.
- #restricted_visibility_levels: [ "public" ]
+ # restricted_visibility_levels: [ "public" ]
## Automatic issue closing
# If a commit message matches this regular expression, all issues referenced from the matched text will be closed.
@@ -78,6 +80,10 @@ production: &base
snippets: false
visibility_level: "private" # can be "private" | "internal" | "public"
+ ## Webhook settings
+ # Number of seconds to wait for HTTP response after sending webhook HTTP POST request (default: 10)
+ # webhook_timeout: 10
+
## Repository downloads directory
# When a user clicks e.g. 'Download zip' on a project, a temporary zip file is created in the following directory.
# The default is 'tmp/repositories' relative to the root of the Rails app.
@@ -143,7 +149,7 @@ production: &base
#
# If you are using "uid: 'userPrincipalName'" on ActiveDirectory you need to
# disable this setting, because the userPrincipalName contains an '@'.
- allow_username_or_email_login: true
+ allow_username_or_email_login: false
# Base where we can search for users
#
@@ -261,9 +267,9 @@ test:
port: 80
# When you run tests we clone and setup gitlab-shell
- # In order to setup it correctly you need to specify
+ # In order to setup it correctly you need to specify
# your system username you use to run GitLab
- # user: YOUR_USERNAME
+ # user: YOUR_USERNAME
satellites:
path: tmp/tests/gitlab-satellites/
gitlab_shell:
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index 136622c65a2..5b7e69fbc6a 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -92,6 +92,7 @@ Settings.gitlab['restricted_visibility_levels'] = Settings.send(:verify_constant
Settings.gitlab['username_changing_enabled'] = true if Settings.gitlab['username_changing_enabled'].nil?
Settings.gitlab['issue_closing_pattern'] = '([Cc]lose[sd]|[Ff]ixe[sd]) #(\d+)' if Settings.gitlab['issue_closing_pattern'].nil?
Settings.gitlab['default_projects_features'] ||= {}
+Settings.gitlab['webhook_timeout'] ||= 10
Settings.gitlab.default_projects_features['issues'] = true if Settings.gitlab.default_projects_features['issues'].nil?
Settings.gitlab.default_projects_features['merge_requests'] = true if Settings.gitlab.default_projects_features['merge_requests'].nil?
Settings.gitlab.default_projects_features['wiki'] = true if Settings.gitlab.default_projects_features['wiki'].nil?
diff --git a/config/initializers/rack_attack.rb.example b/config/initializers/rack_attack.rb.example
index bc3234bf0b6..332865d2881 100644
--- a/config/initializers/rack_attack.rb.example
+++ b/config/initializers/rack_attack.rb.example
@@ -8,11 +8,19 @@ paths_to_be_protected = [
"#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session.json",
"#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session",
"#{Rails.application.config.relative_url_root}/users",
- "#{Rails.application.config.relative_url_root}/users/confirmation"
+ "#{Rails.application.config.relative_url_root}/users/confirmation",
+ "#{Rails.application.config.relative_url_root}/unsubscribes/"
+
]
+# Create one big regular expression that matches strings starting with any of
+# the paths_to_be_protected.
+paths_regex = Regexp.union(paths_to_be_protected.map { |path| /\A#{Regexp.escape(path)}/ })
+
unless Rails.env.test?
Rack::Attack.throttle('protected paths', limit: 10, period: 60.seconds) do |req|
- req.ip if paths_to_be_protected.include?(req.path) && req.post?
+ if req.post? && req.path =~ paths_regex
+ req.ip
+ end
end
end
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 5fe5270236b..b2d59f1c4b7 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -2,9 +2,10 @@
Gitlab::Application.config.session_store(
:redis_store, # Using the cookie_store would enable session replay attacks.
- servers: Gitlab::Application.config.cache_store[1], # re-use the Redis config from the Rails cache store
+ servers: Gitlab::Application.config.cache_store[1].merge(namespace: 'session:gitlab'), # re-use the Redis config from the Rails cache store
key: '_gitlab_session',
secure: Gitlab.config.gitlab.https,
httponly: true,
+ expire_after: 1.week,
path: (Rails.application.config.relative_url_root.nil?) ? '/' : Rails.application.config.relative_url_root
)
diff --git a/config/unicorn.rb.example b/config/unicorn.rb.example
index e88a4522338..c19a37ed062 100644
--- a/config/unicorn.rb.example
+++ b/config/unicorn.rb.example
@@ -28,9 +28,10 @@ worker_processes 2
# "current" directory that Capistrano sets up.
working_directory "/home/git/gitlab" # available in 0.94.0+
-# listen on both a Unix domain socket and a TCP port,
-# we use a shorter backlog for quicker failover when busy
-listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 64
+# Listen on both a Unix domain socket and a TCP port.
+# If you are load-balancing multiple Unicorn masters, lower the backlog
+# setting to e.g. 64 for faster failover.
+listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 1024
listen "127.0.0.1:8080", :tcp_nopush => true
# nuke workers after 30 seconds instead of 60 seconds (the default)
diff --git a/db/fixtures/development/04_project.rb b/db/fixtures/development/04_project.rb
index b93229a0609..fef9666c6cb 100644
--- a/db/fixtures/development/04_project.rb
+++ b/db/fixtures/development/04_project.rb
@@ -4,10 +4,10 @@ Sidekiq::Testing.inline! do
Gitlab::Seeder.quiet do
project_urls = [
'https://github.com/documentcloud/underscore.git',
- 'https://github.com/gitlabhq/gitlabhq.git',
- 'https://github.com/gitlabhq/gitlab-ci.git',
- 'https://github.com/gitlabhq/gitlab-shell.git',
- 'https://github.com/gitlabhq/testme.git',
+ 'https://gitlab.com/gitlab-org/gitlab-ce.git',
+ 'https://gitlab.com/gitlab-org/gitlab-ci.git',
+ 'https://gitlab.com/gitlab-org/gitlab-shell.git',
+ 'https://gitlab.com/gitlab-org/testme.git',
'https://github.com/twitter/flight.git',
'https://github.com/twitter/typeahead.js.git',
'https://github.com/h5bp/html5-boilerplate.git',
diff --git a/db/fixtures/development/05_users.rb b/db/fixtures/development/05_users.rb
index f4a5b8631a4..c263dd232af 100644
--- a/db/fixtures/development/05_users.rb
+++ b/db/fixtures/development/05_users.rb
@@ -13,4 +13,20 @@ Gitlab::Seeder.quiet do
print 'F'
end
end
+
+ (1..5).each do |i|
+ begin
+ User.seed(:id, [
+ id: i + 10,
+ username: "user#{i}",
+ name: "User #{i}",
+ email: "user#{i}@example.com",
+ confirmed_at: DateTime.now,
+ password: '12345678'
+ ])
+ print '.'
+ rescue ActiveRecord::RecordNotSaved
+ print 'F'
+ end
+ end
end
diff --git a/db/fixtures/production/001_admin.rb b/db/fixtures/production/001_admin.rb
index c00ba3c10ba..21c10f31923 100644
--- a/db/fixtures/production/001_admin.rb
+++ b/db/fixtures/production/001_admin.rb
@@ -1,9 +1,15 @@
+password = if ENV['GITLAB_ROOT_PASSWORD'].nil? || ENV['GITLAB_ROOT_PASSWORD'].empty?
+ "5iveL!fe"
+ else
+ ENV['GITLAB_ROOT_PASSWORD']
+ end
+
admin = User.create(
email: "admin@example.com",
name: "Administrator",
username: 'root',
- password: "5iveL!fe",
- password_confirmation: "5iveL!fe",
+ password: password,
+ password_confirmation: password,
password_expires_at: Time.now,
theme_id: Gitlab::Theme::MARS
@@ -19,6 +25,6 @@ puts %q[
Administrator account created:
login.........root
-password......5iveL!fe
+password......#{password}
]
end
diff --git a/db/migrate/20140729152420_migrate_taggable_labels.rb b/db/migrate/20140729152420_migrate_taggable_labels.rb
index 0b844720ba1..dc28d727d9a 100644
--- a/db/migrate/20140729152420_migrate_taggable_labels.rb
+++ b/db/migrate/20140729152420_migrate_taggable_labels.rb
@@ -2,6 +2,12 @@ class MigrateTaggableLabels < ActiveRecord::Migration
def up
taggings = ActsAsTaggableOn::Tagging.where(taggable_type: ['Issue', 'MergeRequest'], context: 'labels')
taggings.find_each(batch_size: 500) do |tagging|
+ # Clean up orphaned taggings while we are here
+ if tagging.taggable.blank? || tagging.tag.nil?
+ tagging.destroy
+ print 'D'
+ next
+ end
create_label_from_tagging(tagging)
end
end
@@ -16,9 +22,11 @@ class MigrateTaggableLabels < ActiveRecord::Migration
def create_label_from_tagging(tagging)
target = tagging.taggable
label_name = tagging.tag.name
- label = target.project.labels.find_or_create_by(title: label_name)
+ # '?', '&' and ',' are no longer allowed in label names so we remove them
+ label_name.tr!('?&,', '')
+ label = target.project.labels.find_or_create_by(title: label_name, color: Label::DEFAULT_COLOR)
- if LabelLink.create(label: label, target: target)
+ if label.valid? && LabelLink.create(label: label, target: target)
print '.'
else
print 'F'
diff --git a/db/migrate/20140903115954_migrate_to_new_shell.rb b/db/migrate/20140903115954_migrate_to_new_shell.rb
new file mode 100644
index 00000000000..2d832109513
--- /dev/null
+++ b/db/migrate/20140903115954_migrate_to_new_shell.rb
@@ -0,0 +1,10 @@
+class MigrateToNewShell < ActiveRecord::Migration
+ def change
+ gitlab_shell_path = Gitlab.config.gitlab_shell.path
+ if system("#{gitlab_shell_path}/bin/create-hooks")
+ puts 'Repositories updated with new hooks'
+ else
+ raise 'Failed to rewrite gitlab-shell hooks in repositories'
+ end
+ end
+end
diff --git a/db/migrate/20140907220153_serialize_service_properties.rb b/db/migrate/20140907220153_serialize_service_properties.rb
new file mode 100644
index 00000000000..b95f5b82e03
--- /dev/null
+++ b/db/migrate/20140907220153_serialize_service_properties.rb
@@ -0,0 +1,36 @@
+class SerializeServiceProperties < ActiveRecord::Migration
+ def change
+ add_column :services, :properties, :text
+ Service.reset_column_information
+
+ associations =
+ {
+ AssemblaService: [:token, :subdomain],
+ CampfireService: [:token, :subdomain, :room],
+ EmailsOnPushService: [:recipients],
+ FlowdockService: [:token],
+ GemnasiumService: [:api_key, :token],
+ GitlabCiService: [:token, :project_url],
+ HipchatService: [:token, :room],
+ PivotaltrackerService: [:token],
+ SlackService: [:subdomain, :token, :room],
+ JenkinsService: [:project_url],
+ JiraService: [:project_url, :username, :password,
+ :api_version, :jira_issue_transition_id],
+ }
+
+ Service.all.each do |service|
+ associations[service.type.to_sym].each do |attribute|
+ service.send("#{attribute}=", service.attributes[attribute.to_s])
+ end
+ service.save!
+ end
+
+ remove_column :services, :project_url, :string
+ remove_column :services, :subdomain, :string
+ remove_column :services, :room, :string
+ remove_column :services, :recipients, :text
+ remove_column :services, :api_key, :string
+ remove_column :services, :token, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 9159556ac72..e9b3713557d 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: 20140730111702) do
+ActiveRecord::Schema.define(version: 20140907220153) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -265,16 +265,11 @@ ActiveRecord::Schema.define(version: 20140730111702) do
create_table "services", force: true do |t|
t.string "type"
t.string "title"
- t.string "token"
- t.integer "project_id", null: false
+ t.integer "project_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
- t.boolean "active", default: false, null: false
- t.string "project_url"
- t.string "subdomain"
- t.string "room"
- t.text "recipients"
- t.string "api_key"
+ t.boolean "active", default: false, null: false
+ t.text "properties"
end
add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree
diff --git a/doc/api/branches.md b/doc/api/branches.md
index 31469b6fe97..74386615545 100644
--- a/doc/api/branches.md
+++ b/doc/api/branches.md
@@ -196,6 +196,8 @@ Parameters:
}
```
+It return 200 if succeed or 400 if failed with error message explaining reason.
+
## Delete repository branch
```
@@ -207,4 +209,5 @@ Parameters:
- `id` (required) - The ID of a project
- `branch` (required) - The name of the branch
-It return 200 if succeed or 405 if failed with error message explaining reason.
+It return 200 if succeed, 404 if the branch to be deleted does not exist
+or 400 for other reasons. In case of an error, an explaining message is provided.
diff --git a/doc/api/issues.md b/doc/api/issues.md
index a4b3b3e9918..a935b146d37 100644
--- a/doc/api/issues.md
+++ b/doc/api/issues.md
@@ -7,8 +7,18 @@ Get all issues created by authenticated user. This function takes pagination par
```
GET /issues
+GET /issues?state=opened
+GET /issues?state=closed
+GET /issues?labels=foo
+GET /issues?labels=foo,bar
+GET /issues?labels=foo,bar&state=opened
```
+Parameters:
+
+- `state` (optional) - Return `all` issues or just those that are `opened` or `closed`
+- `labels` (optional) - Comma-separated list of label names
+
```json
[
{
@@ -80,11 +90,18 @@ to return the list of project issues.
```
GET /projects/:id/issues
+GET /projects/:id/issues?state=opened
+GET /projects/:id/issues?state=closed
+GET /projects/:id/issues?labels=foo
+GET /projects/:id/issues?labels=foo,bar
+GET /projects/:id/issues?labels=foo,bar&state=opened
```
Parameters:
- `id` (required) - The ID of a project
+- `state` (optional) - Return `all` issues or just those that are `opened` or `closed`
+- `labels` (optional) - Comma-separated list of label names
## Single issue
diff --git a/doc/api/labels.md b/doc/api/labels.md
index 95fd4e84119..de41f35d284 100644
--- a/doc/api/labels.md
+++ b/doc/api/labels.md
@@ -45,7 +45,7 @@ Parameters:
It returns 200 and the newly created label, if the operation succeeds.
If the label already exists, 409 and an error message is returned.
-If label parameters are invalid, 405 and an explaining error message is returned.
+If label parameters are invalid, 400 and an explaining error message is returned.
## Delete a label
@@ -58,8 +58,8 @@ DELETE /projects/:id/labels
- `id` (required) - The ID of a project
- `name` (required) - The name of the label to be deleted
-It returns 200 if the label successfully was deleted, 404 for wrong parameters
-and 400 if the label does not exist.
+It returns 200 if the label successfully was deleted, 400 for wrong parameters
+and 404 if the label does not exist.
In case of an error, additionally an error message is returned.
## Edit an existing label
@@ -79,7 +79,6 @@ Parameters:
- `color` (optional) - New color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB)
On success, this method returns 200 with the updated label.
-If required parameters are missing, 400 is returned.
+If required parameters are missing or parameters are invalid, 400 is returned.
If the label to be updated is missing, 404 is returned.
-If parameters are invalid, 405 is returned. In case of an error,
-additionally an error message is returned.
+In case of an error, additionally an error message is returned.
diff --git a/doc/api/projects.md b/doc/api/projects.md
index 8995551b9ea..9f6f6741093 100644
--- a/doc/api/projects.md
+++ b/doc/api/projects.md
@@ -248,6 +248,7 @@ POST /projects
Parameters:
- `name` (required) - new project name
+- `path` (optional) - custom repository name for new project. By default generated based on name
- `namespace_id` (optional) - namespace for the new project (defaults to user)
- `description` (optional) - short project description
- `issues_enabled` (optional)
diff --git a/doc/api/repositories.md b/doc/api/repositories.md
index 1074b78fd73..a412f60c0d9 100644
--- a/doc/api/repositories.md
+++ b/doc/api/repositories.md
@@ -50,6 +50,7 @@ Parameters:
- `id` (required) - The ID of a project
- `tag_name` (required) - The name of a tag
- `ref` (required) - Create tag using commit SHA, another tag name, or branch name.
+- `message` (optional) - Creates annotated tag.
```json
[
@@ -71,6 +72,9 @@ Parameters:
]
```
+It returns 200 if the operation succeed. In case of an error,
+405 with an explaining error message is returned.
+
## List repository tree
Get a list of repository files and directories in a project.
diff --git a/doc/install/database_mysql.md b/doc/install/database_mysql.md
index 270ad3b0b86..362c492d0ac 100644
--- a/doc/install/database_mysql.md
+++ b/doc/install/database_mysql.md
@@ -1,4 +1,4 @@
-# Database Mysql
+# Database MySQL
## Note
@@ -12,31 +12,31 @@ We do not recommend using MySQL due to various issues. For example, case [(in)se
# Ensure you have MySQL version 5.5.14 or later
mysql --version
- # Pick a database root password (can be anything), type it and press enter
- # Retype the database root password and press enter
+ # Pick a MySQL root password (can be anything), type it and press enter
+ # Retype the MySQL root password and press enter
- # Secure your installation.
+ # Secure your installation
sudo mysql_secure_installation
# Login to MySQL
mysql -u root -p
- # Type the database root password
+ # Type the MySQL root password
# Create a user for GitLab
# do not type the 'mysql>', this is part of the prompt
# change $password in the command below to a real password you pick
mysql> CREATE USER 'git'@'localhost' IDENTIFIED BY '$password';
- # Ensure you can use the InnoDB engine which is necessary to support long indexes.
+ # Ensure you can use the InnoDB engine which is necessary to support long indexes
# If this fails, check your MySQL config files (e.g. `/etc/mysql/*.cnf`, `/etc/mysql/conf.d/*`) for the setting "innodb = off"
mysql> SET storage_engine=INNODB;
# Create the GitLab production database
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
- # Grant the GitLab user necessary permissions on the table.
- mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'git'@'localhost';
+ # Grant the GitLab user necessary permissions on the database
+ mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_production`.* TO 'git'@'localhost';
# Quit the database session
mysql> \q
diff --git a/doc/install/installation.md b/doc/install/installation.md
index 44742984ca9..1175aff9dd9 100644
--- a/doc/install/installation.md
+++ b/doc/install/installation.md
@@ -4,11 +4,11 @@
Make sure you view [this installation guide](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md) from the branch (version) of GitLab you would like to install. In most cases this should be the highest numbered stable branch (example shown below).
-![capture](http://i.imgur.com/d2AlIVj.png)
+![Select latest branch](https://i.imgur.com/Lrdxk1k.png)
If the highest number stable branch is unclear please check the [GitLab Blog](https://www.gitlab.com/blog/) for installation guide links by version.
-## Important notes
+## Important Notes
This guide is long because it covers many cases and includes all commands you need, this is [one of the few installation scripts that actually works out of the box](https://twitter.com/robinvdvleuten/status/424163226532986880).
@@ -49,7 +49,7 @@ up-to-date and install it.
Install the required packages (needed to compile Ruby and native extensions to Ruby gems):
- sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils
+ sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake
Make sure you have the right version of Git installed
@@ -76,7 +76,7 @@ Is the system packaged Git too old? Remove it and compile from source.
# Install into /usr/local/bin
sudo make prefix=/usr/local install
- # When editing config/gitlab.yml (Step 5), change the git bin_path to /usr/local/bin/git
+ # When editing config/gitlab.yml (Step 5), change the git -> bin_path to /usr/local/bin/git
**Note:** In order to receive mail notifications, make sure to install a mail server. By default, Debian is shipped with exim4 but this [has problems](https://github.com/gitlabhq/gitlabhq/issues/4866#issuecomment-32726573) while Ubuntu does not ship with one. The recommended mail server is postfix and you can install it with:
@@ -116,7 +116,7 @@ Create a `git` user for GitLab:
We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](database_mysql.md). *Note*: because we need to make use of extensions you need at least pgsql 9.1.
# Install the database packages
- sudo apt-get install -y postgresql-9.1 postgresql-client libpq-dev
+ sudo apt-get install -y postgresql postgresql-client libpq-dev
# Login to PostgreSQL
sudo -u postgres psql -d template1
@@ -141,26 +141,19 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
### Clone the Source
# Clone GitLab repository
- sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-1-stable gitlab
+ sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-2-stable gitlab
- # Go to gitlab dir
- cd /home/git/gitlab
-
-**Note:** You can change `7-1-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server!
+**Note:** You can change `7-2-stable` to `master` if you want the *bleeding edge* version, but never install master on a production server!
-### Configure it
+### Configure It
+ # Go to GitLab installation folder
cd /home/git/gitlab
# Copy the example GitLab config
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
- # Make sure to change "localhost" to the fully-qualified domain name of your
- # host serving GitLab where necessary
- #
- # If you want to use https make sure that you set `https` to `true`. See #using-https for all necessary details.
- #
- # If you installed Git from source, change the git bin_path to /usr/local/bin/git
+ # Update GitLab config file, follow the directions at top of file
sudo -u git -H editor config/gitlab.yml
# Make sure GitLab can write to the log/ and tmp/ directories
@@ -183,8 +176,12 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
# Copy the example Unicorn config
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
+ # Find number of cores
+ nproc
+
# Enable cluster mode if you expect to have a high load instance
# Ex. change amount of workers to 3 for 2GB RAM server
+ # Set the number of workers to at least the number of cores
sudo -u git -H editor config/unicorn.rb
# Copy the example Rack attack config
@@ -198,7 +195,9 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
**Important Note:** Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup.
-### Configure GitLab DB settings
+**Note:** If you want to use HTTPS, see [Using HTTPS](#using-https) for the additional steps.
+
+### Configure GitLab DB Settings
# PostgreSQL only:
sudo -u git cp config/database.yml.postgresql config/database.yml
@@ -222,35 +221,25 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
**Note:** As of bundler 1.5.2, you can invoke `bundle install -jN` (where `N` the number of your processor cores) and enjoy the parallel gems installation with measurable difference in completion time (~60% faster). Check the number of your cores with `nproc`. For more information check this [post](http://robots.thoughtbot.com/parallel-gem-installing-using-bundler). First make sure you have bundler >= 1.5.2 (run `bundle -v`) as it addresses some [issues](https://devcenter.heroku.com/changelog-items/411) that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2.
- cd /home/git/gitlab
-
# For PostgreSQL (note, the option says "without ... mysql")
sudo -u git -H bundle install --deployment --without development test mysql aws
# Or if you use MySQL (note, the option says "without ... postgres")
sudo -u git -H bundle install --deployment --without development test postgres aws
-### Install GitLab shell
+### Install GitLab Shell
GitLab Shell is an SSH access and repository management software developed specially for GitLab.
- # Go to the GitLab installation folder:
- cd /home/git/gitlab
-
# Run the installation task for gitlab-shell (replace `REDIS_URL` if needed):
- sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.6] REDIS_URL=redis://localhost:6379 RAILS_ENV=production
-
- # By default, the gitlab-shell config is generated from your main gitlab config.
- #
- # Note: When using GitLab with HTTPS please change the following:
- # - Provide paths to the certificates under `ca_file` and `ca_path` options.
- # - The `gitlab_url` option must point to the https endpoint of GitLab.
- # - In case you are using self signed certificate set `self_signed_cert` to `true`.
- # See #using-https for all necessary details.
- #
+ sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.7] REDIS_URL=redis://localhost:6379 RAILS_ENV=production
+
+ # By default, the gitlab-shell config is generated from your main GitLab config.
# You can review (and modify) the gitlab-shell config as follows:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
+**Note:** If you want to use HTTPS, see [Using HTTPS](#using-https) for the additional steps.
+
### Initialize Database and Activate Advanced Features
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
@@ -259,9 +248,13 @@ GitLab Shell is an SSH access and repository management software developed speci
# When done you see 'Administrator account created:'
+**Note:** You can set the Administrator password by supplying it in environmental variable `GITLAB_ROOT_PASSWORD`, eg.:
+
+ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=newpassword
+
### Install Init Script
-Download the init script (will be /etc/init.d/gitlab):
+Download the init script (will be `/etc/init.d/gitlab`):
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
@@ -269,13 +262,13 @@ And if you are installing with a non-default folder or user copy and edit the de
sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
-If you installed GitLab in another directory or as a user other than the default you should change these settings in `/etc/default/gitlab`. Do not edit `/etc/init.d/gitlab as it will be changed on upgrade.
+If you installed GitLab in another directory or as a user other than the default you should change these settings in `/etc/default/gitlab`. Do not edit `/etc/init.d/gitlab` as it will be changed on upgrade.
Make GitLab start on boot:
sudo update-rc.d gitlab defaults 21
-### Set up logrotate
+### Setup Logrotate
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
@@ -285,7 +278,7 @@ Check if GitLab and its environment are configured correctly:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
-### Compile assets
+### Compile Assets
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
@@ -300,6 +293,7 @@ Check if GitLab and its environment are configured correctly:
**Note:** Nginx is the officially supported web server for GitLab. If you cannot or do not want to use Nginx as your web server, have a look at the [GitLab recipes](https://gitlab.com/gitlab-org/gitlab-recipes/).
### Installation
+
sudo apt-get install -y nginx
### Site Configuration
@@ -315,7 +309,15 @@ Make sure to edit the config file to match your setup:
# domain name of your host serving GitLab.
sudo editor /etc/nginx/sites-available/gitlab
-**Note:** If you want to use https, replace the `gitlab` nginx config with `gitlab-ssl`. See [Using HTTPS](#using-https) for all necessary details.
+**Note:** If you want to use HTTPS, replace the `gitlab` Nginx config with `gitlab-ssl`. See [Using HTTPS](#using-https) for HTTPS configuration details.
+
+### Test Configuration
+
+Validate your `gitlab` or `gitlab-ssl` Nginx config file with the following command:
+
+ sudo nginx -t
+
+You should receive `syntax is okay` and `test is successful` messages. If you receive errors check your `gitlab` or `gitlab-ssl` Nginx config file for typos, etc. as indiciated in the error message given.
### Restart
@@ -348,13 +350,32 @@ Visit YOUR_SERVER in your web browser for your first GitLab login. The setup has
### Using HTTPS
-To recapitulate what is needed to use GitLab with HTTPS:
+To use GitLab with HTTPS:
+
+1. In `gitlab.yml`:
+ 1. Set the `port` option in section 1 to `443`.
+ 1. Set the `https` option in section 1 to `true`.
+1. In the `config.yml` of gitlab-shell:
+ 1. Set `gitlab_url` option to the HTTPS endpoint of GitLab (e.g. `https://git.example.com`).
+ 1. Set the certificates using either the `ca_file` or `ca_path` option.
+1. Use the `gitlab-ssl` Nginx example config instead of the `gitlab` config.
+ 1. Update `YOUR_SERVER_FQDN`.
+ 1. Update `ssl_certificate` and `ssl_certificate_key`.
+ 1. Review the configuration file and consider applying other security and performance enhancing features.
+
+Using a self-signed certificate is discouraged but if you must use it follow the normal directions then:
-1. In `gitlab.yml` set the `https` option to `true`
-1. In the `config.yml` of gitlab-shell set the relevant options (see the [install GitLab Shell section](#install-gitlab-shell) of this document).
-1. Use the `gitlab-ssl` nginx example config instead of the `gitlab` config.
+1. Generate a self-signed SSL certificate:
-### Additional markup styles
+ ```
+ mkdir -p /etc/nginx/ssl/
+ cd /etc/nginx/ssl/
+ sudo openssl req -newkey rsa:2048 -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key
+ sudo chmod o-r gitlab.key
+ ```
+1. In the `config.yml` of gitlab-shell set `self_signed_cert` to `true`.
+
+### Additional Markup Styles
Apart from the always supported markdown style there are other rich text files that GitLab can display. But you might have to install a dependency to do so. Please see the [github-markup gem readme](https://github.com/gitlabhq/markup#markups) for more information.
@@ -382,44 +403,10 @@ If you are running SSH on a non-standard port, you must change the GitLab user's
You also need to change the corresponding options (e.g. `ssh_user`, `ssh_host`, `admin_uri`) in the `config\gitlab.yml` file.
-### LDAP authentication
+### LDAP Authentication
You can configure LDAP authentication in `config/gitlab.yml`. Please restart GitLab after editing this file.
### Using Custom Omniauth Providers
-GitLab uses [Omniauth](http://www.omniauth.org/) for authentication and already ships with a few providers preinstalled (e.g. LDAP, GitHub, Twitter). But sometimes that is not enough and you need to integrate with other authentication solutions. For these cases you can use the Omniauth provider.
-
-#### Steps
-
-These steps are fairly general and you will need to figure out the exact details from the Omniauth provider's documentation.
-
-- Stop GitLab:
-
- sudo service gitlab stop
-
-- Add the gem to your [Gemfile](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/Gemfile):
-
- gem "omniauth-your-auth-provider"
-
-- If you're using MySQL, install the new Omniauth provider gem by running the following command:
-
- sudo -u git -H bundle install --without development test postgres --path vendor/bundle --no-deployment
-
-- If you're using PostgreSQL, install the new Omniauth provider gem by running the following command:
-
- sudo -u git -H bundle install --without development test mysql --path vendor/bundle --no-deployment
-
- > These are the same commands you used in the [Install Gems section](#install-gems) with `--path vendor/bundle --no-deployment` instead of `--deployment`.
-
-- Start GitLab:
-
- `sudo service gitlab start`
-
-#### Examples
-
-If you have successfully set up a provider that is not shipped with GitLab itself, please let us know.
-
-You can help others by reporting successful configurations and probably share a few insights or provide warnings for common errors or pitfalls by sharing your experience [in the public Wiki](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Custom-omniauth-provider-configurations).
-
-While we can't officially support every possible authentication mechanism out there, we'd like to at least help those with special needs.
+See the [omniauth integration document](doc/integration/omniauth.md)
diff --git a/doc/install/requirements.md b/doc/install/requirements.md
index 938e48ddd74..fd2e29d3c52 100644
--- a/doc/install/requirements.md
+++ b/doc/install/requirements.md
@@ -7,9 +7,9 @@
- Ubuntu
- Debian
- CentOS
-- RedHat Enterprise Linux
-- Scientific Linux
-- Oracle Linux
+- RedHat Enterprise Linux (please use the CentOS packages and instructions)
+- Scientific Linux (please use the CentOS packages and instructions)
+- Oracle Linux (please use the CentOS packages and instructions)
For the installations options please see [the installation page on the GitLab website](https://about.gitlab.com/installation/).
@@ -55,13 +55,13 @@ You will either need to configure 512MB or 1.5GB of swap space.
With 512MB of swap space you must configure only one unicorn worker.
With one unicorn worker only git over ssh access will work because the git over http access requires two running workers (one worker to receive the user request and one worker for the authorization check).
If you use SSD storage and configure 1.5GB of swap space you can use two Unicorn workers, this will allow http access but it will still be slow.
-- 1GB supports up to 100 users (we highly recommend adding al least 1GB of swap space, this is a must if you have individual repositories under 250MB)
-- **2GB** is the **recommended** memory size and supports up to 500 users
-- 4GB supports up to 2,000 users
-- 8GB supports up to 5,000 users
-- 16GB supports up to 10,000 users
-- 32GB supports up to 20,000 users
-- 64GB supports up to 40,000 users
+- 1GB RAM + 1GB swap supports up to 100 users
+- **2GB RAM** is the **recommended** memory size and supports up to 500 users
+- 4GB RAM supports up to 2,000 users
+- 8GB RAM supports up to 5,000 users
+- 16GB RAM supports up to 10,000 users
+- 32GB RAM supports up to 20,000 users
+- 64GB RAM supports up to 40,000 users
Notice: The 25 workers of Sidekiq will show up as separate processes in your process overview (such as top or htop) but they share the same RAM allocation since Sidekiq is a multithreaded application.
diff --git a/doc/install/structure.md b/doc/install/structure.md
index 67ca1895374..5c03f073c18 100644
--- a/doc/install/structure.md
+++ b/doc/install/structure.md
@@ -13,9 +13,9 @@ This is the directory structure you will end up with following the instructions
* `/home/git/.ssh` - contains openssh settings. Specifically the `authorized_keys` file managed by gitlab-shell.
* `/home/git/gitlab` - GitLab core software.
* `/home/git/gitlab-satellites` - checked out repositories for merge requests and file editing from web UI. This can be treated as a temporary files directory.
-* `/home/git/gitlab-shell` - Core add-on component of gitlab. Maintains SSH cloning and other functionality.
+* `/home/git/gitlab-shell` - Core add-on component of GitLab. Maintains SSH cloning and other functionality.
* `/home/git/repositories` - bare repositories for all projects organized by namespace. This is where the git repositories which are pushed/pulled are maintained for all projects. **This area is critical data for projects. [Keep a backup](../raketasks/backup_restore.md)**
-*Note: the default locations for gitlab-satellites and repositories can be configured in `config/gitlab.yml` of gitlab and `config.yml` of gitlab-shell.*
+*Note: the default locations for gitlab-satellites and repositories can be configured in `config/gitlab.yml` of GitLab and `config.yml` of gitlab-shell.*
To see a more in-depth overview see the [GitLab architecture doc](../development/architecture.md).
diff --git a/doc/integration/google.md b/doc/integration/google.md
index 3cf546bd77e..7a78aff8ea4 100644
--- a/doc/integration/google.md
+++ b/doc/integration/google.md
@@ -2,17 +2,21 @@
To enable the Google OAuth2 OmniAuth provider you must register your application with Google. Google will generate a client ID and secret key for you to use.
-1. Sign in to the [Google Developers Console](https://console.developers.google.com/) with the Google account you want to use to register GitLab.
+1. Sign in to the [Google Developers Console](https://console.developers.google.com/) with the Google account you want to use to register GitLab.
1. Select "Create Project".
1. Provide the project information
- - Project name: 'GitLab' works just fine here.
+ - Project name: 'GitLab' works just fine here.
- Project ID: Must be unique to all Google Developer registered applications. Google provides a randomly generated Project ID by default. You can use the randomly generated ID or choose a new one.
1. Refresh the page. You should now see your new project in the list. Click on the project.
1. Select "APIs & auth" in the left menu.
+1. Select "APIs" in the submenu.
+ - Enable `Contacts API`
+ - Enable `Google+ API`
+
1. Select "Credentials" in the submenu.
1. Select "Create New Client ID".
@@ -41,7 +45,7 @@ To enable the Google OAuth2 OmniAuth provider you must register your application
args: { access_type: 'offline', approval_prompt: '' } }
```
-1. Change 'YOUR APP ID' to the client ID from the GitHub application page from step 7.
+1. Change 'YOUR APP ID' to the client ID from the GitHub application page from step 7.
1. Change 'YOUR APP SECRET' to the client secret from the GitHub application page from step 7.
@@ -51,12 +55,12 @@ To enable the Google OAuth2 OmniAuth provider you must register your application
On the sign in page there should now be a Google icon below the regular sign in form. Click the icon to begin the authentication process. Google will ask the user to sign in and authorize the GitLab application. If everything goes well the user will be returned to GitLab and will be signed in.
-## Further Configuration
+## Further Configuration
This further configuration is not required for Google authentication to function but it is strongly recommended. Taking these steps will increase usability for users by providing a little more recognition and branding.
At this point, when users first try to authenticate to your GitLab installation with Google they will see a generic application name on the prompt screen. The prompt informs the user that "Project Default Service Account" would like to access their account. "Project Default Service Account" isn't very recognizable and may confuse or cause users to be concerned. This is easily changeable.
1. Select 'Consent screen' in the left menu. (See steps 1, 4 and 5 above for instructions on how to get here if you closed your window).
-1. Scroll down until you find "Product Name". Change the product name to something more descriptive.
+1. Scroll down until you find "Product Name". Change the product name to something more descriptive.
1. Add any additional information as you wish - homepage, logo, privacy policy, etc. None of this is required, but it may help your users.
diff --git a/doc/integration/omniauth.md b/doc/integration/omniauth.md
index 1b0bf9c5f64..00adae58dfa 100644
--- a/doc/integration/omniauth.md
+++ b/doc/integration/omniauth.md
@@ -50,6 +50,13 @@ Before configuring individual OmniAuth providers there are a few global settings
# - { name: 'github', app_id: 'YOUR APP ID',
# app_secret: 'YOUR APP SECRET',
# args: { scope: 'user:email' } }
+ # - {"name": 'shibboleth',
+ # args: { shib_session_id_field: "HTTP_SHIB_SESSION_ID",
+ # shib_application_id_field: "HTTP_SHIB_APPLICATION_ID",
+ # uid_field: "HTTP_EPPN",
+ # name_field: "HTTP_CN",
+ # info_fields: {"email": "HTTP_MAIL" } } }
+
```
1. Change `enabled` to `true`.
@@ -69,6 +76,7 @@ Before configuring individual OmniAuth providers there are a few global settings
- [GitHub](github.md)
- [Google](google.md)
+- [Shibboleth](shibboleth.md)
- [Twitter](twitter.md)
## Enable OmniAuth for an Existing User
@@ -82,3 +90,41 @@ Existing users can enable OmniAuth for specific providers after the account is c
1. The user will be redirected to the provider. Once the user authorized GitLab they will be redirected back to GitLab.
The chosen OmniAuth provider is now active and can be used to sign in to GitLab from then on.
+
+## Using Custom Omniauth Providers
+
+GitLab uses [Omniauth](http://www.omniauth.org/) for authentication and already ships with a few providers preinstalled (e.g. LDAP, GitHub, Twitter). But sometimes that is not enough and you need to integrate with other authentication solutions. For these cases you can use the Omniauth provider.
+
+### Steps
+
+These steps are fairly general and you will need to figure out the exact details from the Omniauth provider's documentation.
+
+- Stop GitLab:
+
+ sudo service gitlab stop
+
+- Add the gem to your [Gemfile](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/Gemfile):
+
+ gem "omniauth-your-auth-provider"
+
+- If you're using MySQL, install the new Omniauth provider gem by running the following command:
+
+ sudo -u git -H bundle install --without development test postgres --path vendor/bundle --no-deployment
+
+- If you're using PostgreSQL, install the new Omniauth provider gem by running the following command:
+
+ sudo -u git -H bundle install --without development test mysql --path vendor/bundle --no-deployment
+
+ > These are the same commands you used in the [Install Gems section](#install-gems) with `--path vendor/bundle --no-deployment` instead of `--deployment`.
+
+- Start GitLab:
+
+ sudo service gitlab start
+
+### Examples
+
+If you have successfully set up a provider that is not shipped with GitLab itself, please let us know.
+
+You can help others by reporting successful configurations and probably share a few insights or provide warnings for common errors or pitfalls by sharing your experience [in the public Wiki](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Custom-omniauth-provider-configurations).
+
+While we can't officially support every possible authentication mechanism out there, we'd like to at least help those with specific needs.
diff --git a/doc/integration/shibboleth.md b/doc/integration/shibboleth.md
new file mode 100644
index 00000000000..78317a5c0f2
--- /dev/null
+++ b/doc/integration/shibboleth.md
@@ -0,0 +1,78 @@
+# Shibboleth OmniAuth Provider
+
+This documentation is for enabling shibboleth with gitlab-omnibus package.
+
+In order to enable Shibboleth support in gitlab we need to use Apache instead of Nginx (It may be possible to use Nginx, however I did not found way to easily configure nginx that is bundled in gitlab-omnibus package). Apache uses mod_shib2 module for shibboleth authentication and can pass attributes as headers to omniauth-shibboleth provider.
+
+
+To enable the Shibboleth OmniAuth provider you must:
+
+1. Configure Apache shibboleth module. Installation and configuration of module it self is out of scope of this document.
+Check https://wiki.shibboleth.net/ for more info.
+
+1. You can find Apache config in gitlab-reciepes (https://github.com/gitlabhq/gitlab-recipes/blob/master/web-server/apache/gitlab-ssl.conf)
+
+Following changes are needed to enable shibboleth:
+
+protect omniauth-shibboleth callback url:
+```
+ <Location /users/auth/shibboleth/callback>
+ AuthType shibboleth
+ ShibRequestSetting requireSession 1
+ ShibUseHeaders On
+ require valid-user
+ </Location>
+
+ Alias /shibboleth-sp /usr/share/shibboleth
+ <Location /shibboleth-sp>
+ Satisfy any
+ </Location>
+
+ <Location /Shibboleth.sso>
+ SetHandler shib
+ </Location>
+```
+exclude shibboleth urls from rewriting, add "RewriteCond %{REQUEST_URI} !/Shibboleth.sso" and "RewriteCond %{REQUEST_URI} !/shibboleth-sp", config should look like this:
+```
+ #apache equivalent of nginx try files
+ RewriteEngine on
+ RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_URI} !/Shibboleth.sso
+ RewriteCond %{REQUEST_URI} !/shibboleth-sp
+ RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]
+ RequestHeader set X_FORWARDED_PROTO 'https'
+```
+
+1. Edit /etc/gitlab/gitlab.rb configuration file, your shibboleth attributes should be in form of "HTTP_ATTRIBUTE" and you should addjust them to your need and environment. Add any other configuration you need.
+
+File it should look like this:
+```
+external_url 'https://gitlab.example.com'
+gitlab_rails['internal_api_url'] = 'https://gitlab.example.com'
+
+# disable nginx
+nginx['enable'] = false
+
+gitlab_rails['omniauth_allow_single_sign_on'] = true
+gitlab_rails['omniauth_block_auto_created_users'] = false
+gitlab_rails['omniauth_enabled'] = true
+gitlab_rails['omniauth_providers'] = [
+ {
+ "name" => 'shibboleth',
+ "args" => {
+ "shib_session_id_field" => "HTTP_SHIB_SESSION_ID",
+ "shib_application_id_field" => "HTTP_SHIB_APPLICATION_ID",
+ "uid_field" => 'HTTP_EPPN',
+ "name_field" => 'HTTP_CN',
+ "info_fields" => { "email" => 'HTTP_MAIL'}
+ }
+ }
+]
+
+```
+1. Save changes and reconfigure gitlab:
+```
+sudo gitlab-ctl reconfigure
+```
+
+On the sign in page there should now be a "Sign in with: Shibboleth" icon below the regular sign in form. Click the icon to begin the authentication process. You will be redirected to IdP server (Depends on your Shibboleth module configuration). If everything goes well the user will be returned to GitLab and will be signed in.
diff --git a/doc/raketasks/maintenance.md b/doc/raketasks/maintenance.md
index a0901cc4070..f6bd7565799 100644
--- a/doc/raketasks/maintenance.md
+++ b/doc/raketasks/maintenance.md
@@ -115,8 +115,10 @@ Checking GitLab ... Finished
This will create satellite repositories for all your projects.
-If necessary, remove the `tmp/repo_satellites` directory and rerun the command below.
+If necessary, remove the `repo_satellites` directory and rerun the commands below.
```
-bundle exec rake gitlab:satellites:create RAILS_ENV=production
+sudo -u git -H mkdir -p /home/git/gitlab-satellites
+sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production
+sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
```
diff --git a/doc/raketasks/web_hooks.md b/doc/raketasks/web_hooks.md
index ac32c01289d..e1a58835d88 100644
--- a/doc/raketasks/web_hooks.md
+++ b/doc/raketasks/web_hooks.md
@@ -5,41 +5,41 @@
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:add URL="http://example.com/hook"
# source installations or cookbook
- RAILS_ENV=production bundle exec rake gitlab:web_hook:add URL="http://example.com/hook"
+ bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" RAILS_ENV=production
## Add a web hook for projects in a given **NAMESPACE**:
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=acme
# source installations or cookbook
- RAILS_ENV=production bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=acme
+ bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=acme RAILS_ENV=production
## Remove a web hook from **ALL** projects using:
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:rm URL="http://example.com/hook"
# source installations or cookbook
- RAILS_ENV=production bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook"
+ bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook" RAILS_ENV=production
## Remove a web hook from projects in a given **NAMESPACE**:
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:rm URL="http://example.com/hook" NAMESPACE=acme
# source installations or cookbook
- RAILS_ENV=production bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook" NAMESPACE=acme
+ bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook" NAMESPACE=acme RAILS_ENV=production
## List **ALL** web hooks:
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:list
# source installations or cookbook
- RAILS_ENV=production bundle exec rake gitlab:web_hook:list
+ bundle exec rake gitlab:web_hook:list RAILS_ENV=production
## List the web hooks from projects in a given **NAMESPACE**:
# omnibus-gitlab
sudo gitlab-rake gitlab:web_hook:list NAMESPACE=/
# source installations or cookbook
- RAILS_ENV=production bundle exec rake gitlab:web_hook:list NAMESPACE=/
+ bundle exec rake gitlab:web_hook:list NAMESPACE=/ RAILS_ENV=production
> Note: `/` is the global namespace.
diff --git a/doc/release/monthly.md b/doc/release/monthly.md
index 09bdde81dcc..2c26a90589d 100644
--- a/doc/release/monthly.md
+++ b/doc/release/monthly.md
@@ -107,11 +107,13 @@ List any major changes here, so the user is aware of them before starting to upg
Check if any of these changed since last release:
- <https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/nginx/gitlab>
+- <https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/nginx/gitlab-ssl>
- <https://gitlab.com/gitlab-org/gitlab-shell/commits/master/config.yml.example>
- <https://gitlab.com/gitlab-org/gitlab-ce/commits/master/config/gitlab.yml.example>
- <https://gitlab.com/gitlab-org/gitlab-ce/commits/master/config/unicorn.rb.example>
- <https://gitlab.com/gitlab-org/gitlab-ce/commits/master/config/database.yml.mysql>
- <https://gitlab.com/gitlab-org/gitlab-ce/commits/master/config/database.yml.postgresql>
+- <https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/initializers/rack_attack.rb.example>
#### 8. Need to update init script?
@@ -153,6 +155,7 @@ git tag -a vx.x.0.rc1 -m 'Version x.x.0.rc1'
Merge the RC1 EE code into GitLab.com.
Once the build is green, create a package.
+If there are big database migrations consider testing them with the production db on a VM.
Try to deploy in the morning.
It is important to do this as soon as possible, so we can catch any errors before we release the full version.
@@ -210,9 +213,16 @@ For GitLab EE, append `-ee` to the branches and tags.
`v.x.x.0-ee`
-Merge CE into EE if needed.
+Note: Merge CE into EE if needed.
-### **1. Create x-x-stable branch and push to the repositories**
+### **1. Set VERSION to x.x.x and push**
+
+- Change the GITLAB_SHELL_VERSION file in `master` of the CE repository if the version changed.
+- Change the GITLAB_SHELL_VERSION file in `master` of the EE repository if the version changed.
+- Change the VERSION file in `master` branch of the CE repository and commit and push.
+- Change the VERSION file in `master` branch of the EE repository and commit and push.
+
+### **2. Create x-x-stable branch and push to the repositories**
```
git checkout master
@@ -221,22 +231,7 @@ git checkout -b x-x-stable
git push <remote> x-x-stable
```
-### **2. Build the Omnibus packages**
-
-Follow the [release doc in the Omnibus repository](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md).
-This can happen before tagging because Omnibus uses tags in its own repo and SHA1's to refer to the GitLab codebase.
-
-### **3. Set VERSION to x.x.x and push**
-
-Change the GITLAB_SHELL_VERSION file in `master` of the CE repository if the version changed.
-
-Change the GITLAB_SHELL_VERSION file in `master` of the EE repository if the version changed.
-
-Change the VERSION file in `master` branch of the CE repository and commit. Cherry-pick into the `x-x-stable` branch of CE.
-
-Change the VERSION file in `master` branch of the EE repository and commit. Cherry-pick into the `x-x-stable-ee` branch of EE.
-
-### **4. Create annotated tag vx.x.x**
+### **3. Create annotated tag vx.x.x**
In `x-x-stable` branch check for the SHA-1 of the commit with VERSION file changed. Tag that commit,
@@ -246,12 +241,17 @@ git tag -a vx.x.0 -m 'Version x.x.0' xxxxx
where `xxxxx` is SHA-1.
-### **5. Push the tag**
+### **4. Push the tag**
```
git push origin vx.x.0
```
+### **5. Build the Omnibus packages**
+
+Follow the [release doc in the Omnibus repository](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md).
+This can happen before tagging because Omnibus uses tags in its own repo and SHA1's to refer to the GitLab codebase.
+
### **6. Push to remotes**
For GitLab CE, push to dev, GitLab.com and GitHub.
@@ -260,8 +260,6 @@ For GitLab EE, push to the subscribers repo.
Make sure the branch is marked 'protected' on each of the remotes you pushed to.
-NOTE: You might not have the rights to push to master on dev. Ask Dmitriy.
-
### **7. Publish blog for new release**
Merge the [blog merge request](#1-prepare-the-blog-post) in `www-gitlab-com` repository.
@@ -282,6 +280,10 @@ Include a link to the blog post and keep it short.
Proposed email text:
"We have released a new version of GitLab. See our blog post(<link>) for more information."
+### **10. Update installation.md**
+
+Update [installation.md](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md) to the newest version in master and cherry-pick that commit into the stable branch.
+
# **23rd - Optional Patch Release**
# **24th - Update GitLab.com**
diff --git a/doc/system_hooks/system_hooks.md b/doc/system_hooks/system_hooks.md
index 47f17c1a080..54e6e3a9e3f 100644
--- a/doc/system_hooks/system_hooks.md
+++ b/doc/system_hooks/system_hooks.md
@@ -1,6 +1,6 @@
# System hooks
-Your GitLab instance can perform HTTP POST requests on the following events: `create_project`, `delete_project`, `create_user`, `delete_user` and `change_team_member`.
+Your GitLab instance can perform HTTP POST requests on the following events: `project_create`, `project_destroy`, `user_add_to_team`, `user_remove_from_team`, `user_create`, `user_destroy`, `key_create` and `key_destroy`.
System hooks can be used, e.g. for logging or changing information in a LDAP server.
@@ -93,3 +93,27 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
"user_id": 41
}
```
+
+**Key added**
+
+```json
+{
+ "event_name": "key_create",
+ "created_at": "2014-08-18 18:45:16 UTC",
+ "username": "root",
+ "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC58FwqHUbebw2SdT7SP4FxZ0w+lAO/erhy2ylhlcW/tZ3GY3mBu9VeeiSGoGz8hCx80Zrz+aQv28xfFfKlC8XQFpCWwsnWnQqO2Lv9bS8V1fIHgMxOHIt5Vs+9CAWGCCvUOAurjsUDoE2ALIXLDMKnJxcxD13XjWdK54j6ZXDB4syLF0C2PnAQSVY9X7MfCYwtuFmhQhKaBussAXpaVMRHltie3UYSBUUuZaB3J4cg/7TxlmxcNd+ppPRIpSZAB0NI6aOnqoBCpimscO/VpQRJMVLr3XiSYeT6HBiDXWHnIVPfQc03OGcaFqOit6p8lYKMaP/iUQLm+pgpZqrXZ9vB john@localhost",
+ "id": 4
+}
+```
+
+**Key removed**
+
+```json
+{
+ "event_name": "key_destroy",
+ "created_at": "2014-08-18 18:45:16 UTC",
+ "username": "root",
+ "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC58FwqHUbebw2SdT7SP4FxZ0w+lAO/erhy2ylhlcW/tZ3GY3mBu9VeeiSGoGz8hCx80Zrz+aQv28xfFfKlC8XQFpCWwsnWnQqO2Lv9bS8V1fIHgMxOHIt5Vs+9CAWGCCvUOAurjsUDoE2ALIXLDMKnJxcxD13XjWdK54j6ZXDB4syLF0C2PnAQSVY9X7MfCYwtuFmhQhKaBussAXpaVMRHltie3UYSBUUuZaB3J4cg/7TxlmxcNd+ppPRIpSZAB0NI6aOnqoBCpimscO/VpQRJMVLr3XiSYeT6HBiDXWHnIVPfQc03OGcaFqOit6p8lYKMaP/iUQLm+pgpZqrXZ9vB john@localhost",
+ "id": 4
+}
+```
diff --git a/doc/update/4.2-to-5.0.md b/doc/update/4.2-to-5.0.md
index 6ec153f6245..897cd0b91fa 100644
--- a/doc/update/4.2-to-5.0.md
+++ b/doc/update/4.2-to-5.0.md
@@ -10,7 +10,7 @@ GitLab 5.0 is affected by critical security vulnerability CVE-2013-4490.
- Self signed SSL certificates are not supported until GitLab 5.1
- **requires ruby1.9.3**
-## 0. Stop gitlab
+## 0. Stop GitLab
sudo service gitlab stop
@@ -41,7 +41,7 @@ git checkout v1.1.0
# copy config
cp config.yml.example config.yml
-# change url to gitlab instance
+# change url to GitLab instance
# ! make sure url end with '/' like 'https://gitlab.example/'
vim config.yml
@@ -49,14 +49,14 @@ vim config.yml
./support/rewrite-hooks.sh
# check ruby version for git user ( 1.9 required!! )
-# gitlab shell requires system ruby 1.9
+# GitLab shell requires system ruby 1.9
ruby -v
# exit from git user
exit
```
-## 4. Copy gitlab instance to git user
+## 4. Copy GitLab instance to git user
```bash
sudo cp -R /home/gitlab/gitlab /home/git/gitlab
@@ -162,8 +162,43 @@ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
```
-**P.S. If everything works as expected you can remove gitlab user from system**
+## 9. Cleanup
+
+**If everything works as expected you can cleanup some old things**
+Recommend you wait a bit and do a backup before completing the following.
```bash
+# remove GitLab user from system
sudo userdel -r gitlab
+
+cd /home/git
+
+# cleanup .profile
+## remove text from .profile added during gitolite installation:
+## PATH=\$PATH:/home/git/bin
+## export PATH
+## to see what a clean .profile for new users on your system would look like see /etc/skel/.profile
+sudo -u git -H vim .profile
+
+# remove gitolite
+sudo rm -R bin
+sudo rm -Rf gitolite
+sudo rm -R .gitolite
+sudo rm .gitolite.rc
+sudo rm -f gitlab.pub
+sudo rm projects.list
+
+# reset tmp folders
+sudo service gitlab stop
+cd /home/git/gitlab
+sudo rm -R tmp
+sudo -u git -H mkdir tmp
+sudo chmod -R u+rwX tmp/
+
+# reboot system
+sudo reboot
+
+# login, check that GitLab is running fine
+cd /home/git/gitlab
+sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
```
diff --git a/doc/update/5.1-to-5.2.md b/doc/update/5.1-to-5.2.md
index c37f20ce55e..6ef559ac9f9 100644
--- a/doc/update/5.1-to-5.2.md
+++ b/doc/update/5.1-to-5.2.md
@@ -93,7 +93,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.0 to 5.1](5.0-to-5.1.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup
diff --git a/doc/update/5.1-to-5.4.md b/doc/update/5.1-to-5.4.md
index 53dbfd00ad4..8ec56b266ca 100644
--- a/doc/update/5.1-to-5.4.md
+++ b/doc/update/5.1-to-5.4.md
@@ -89,7 +89,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.2 to 5.3`](5.2-to-5.3.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.2 to 5.3](5.2-to-5.3.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/5.1-to-6.0.md b/doc/update/5.1-to-6.0.md
index 123b3326ead..a76b371e6d6 100644
--- a/doc/update/5.1-to-6.0.md
+++ b/doc/update/5.1-to-6.0.md
@@ -28,7 +28,7 @@ Any changes to group members will immediately be reflected in the project permis
You can even have multiple owners for a group, greatly simplifying administration.
-## 0. Backup
+## 0. Backup & prepare for update
It's useful to make a backup just in case things go south:
(With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version)
@@ -38,6 +38,72 @@ cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
```
+The migrations in this update are very sensitive to incomplete or inconsistent data. If you have a long-running GitLab installation and some of the previous upgrades did not work out 100% correct this may bite you now. The following can help you have a more smooth upgrade.
+
+### Find projets with invalid project names
+
+#### MySQL
+Login to MySQL:
+
+ mysql -u root -p
+
+Find projects with invalid names:
+
+```bash
+mysql> use gitlabhq_production;
+
+# find projects with invalid first char, projects must start with letter
+mysql> select name from projects where name REGEXP '^[^A-Za-z]';
+
+# find projects with other invalid chars
+## names must only contain alphanumeric chars, underscores, spaces, periods, and dashes
+mysql> select name from projects where name REGEXP '[^a-zA-Z0-9_ .-]+';
+```
+
+If any projects have invalid names try correcting them from the web interface before starting the upgrade.
+If correcting them from the web interface fails you can correct them using MySQL:
+
+```bash
+# e.g. replace invalid / with allowed _
+mysql> update projects set name = REPLACE(name,'/','_');
+# repeat for all invalid chars found in project names
+```
+
+#### PostgreSQL
+Make sure all project names start with a letter and only contain alphanumeric chars, underscores, spaces, periods, and dashes (a-zA-Z0-9_ .-).
+
+### Find other common errors
+
+```
+cd /home/git/gitlab
+# Start rails console
+sudo -u git -H bin/rails console production
+
+# Make sure none of the following rails commands return results
+
+# All project owners should have an owner:
+Project.all.select { |project| project.owner.blank? }
+
+# Every user should have a namespace:
+User.all.select { |u| u.namespace.blank? }
+
+# Projects in the global namespace should not conflict with projects in the owner namespace:
+Project.where(namespace_id: nil).select { |p| Project.where(path: p.path, namespace_id: p.owner.try(:namespace).try(:id)).present? }
+```
+
+If any of the above rails commands returned results other than `=> []` try correcting the issue from the web interface.
+
+If you find projects without an owner (first rails command above), correct it. For MySQL setups:
+
+```bash
+# get your user id
+mysql> select id, name from users order by name;
+
+# set yourself as owner of project
+# replace your_user_id with your user id and bad_project_id with the project id from the rails command
+mysql> update projects set creator_id=your_user_id where id=bad_project_id;
+```
+
## 1. Stop server
sudo service gitlab stop
@@ -89,6 +155,9 @@ sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production
# Clear and precompile assets
sudo -u git -H bundle exec rake assets:clean RAILS_ENV=production
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
+
+#Add dealing with newlines for editor
+sudo -u git -H git config --global core.autocrlf input
```
## 6. Update config files
@@ -136,7 +205,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.0 to 5.1](5.0-to-5.1.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
@@ -144,31 +213,3 @@ Follow the [`upgrade guide from 5.0 to 5.1`](5.0-to-5.1.md), except for the data
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
```
-
-## Troubleshooting
-
-The migrations in this update are very sensitive to incomplete or inconsistent data. If you have a long-running GitLab installation and some of the previous upgrades did not work out 100% correct this may bite you now. The following commands can be run in the rails console to look for 'bad' data.
-
-Start rails console:
-
-```
-sudo -u git -H rails console production
-```
-
-All project owners should have an owner:
-
-```
-Project.all.select { |project| project.owner.blank? }
-```
-
-Every user should have a namespace:
-
-```
-User.all.select { |u| u.namespace.blank? }
-```
-
-Projects in the global namespace should not conflict with projects in the owner namespace:
-
-```
-Project.where(namespace_id: nil).select { |p| Project.where(path: p.path, namespace_id: p.owner.try(:namespace).try(:id)).present? }
-```
diff --git a/doc/update/5.2-to-5.3.md b/doc/update/5.2-to-5.3.md
index 9851f7b2730..61ddf135641 100644
--- a/doc/update/5.2-to-5.3.md
+++ b/doc/update/5.2-to-5.3.md
@@ -75,7 +75,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.1 to 5.2`](5.1-to-5.2.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.1 to 5.2](5.1-to-5.2.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/5.3-to-5.4.md b/doc/update/5.3-to-5.4.md
index b130f4c65bb..8a0d43e3e64 100644
--- a/doc/update/5.3-to-5.4.md
+++ b/doc/update/5.3-to-5.4.md
@@ -79,7 +79,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.2 to 5.3`](5.2-to-5.3.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.2 to 5.3](5.2-to-5.3.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/6.0-to-6.1.md b/doc/update/6.0-to-6.1.md
index 36c7f04f635..9d67a3bcb96 100644
--- a/doc/update/6.0-to-6.1.md
+++ b/doc/update/6.0-to-6.1.md
@@ -73,7 +73,6 @@ sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production
```bash
sudo rm /etc/init.d/gitlab
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-sudo chmod +x /etc/init.d/gitlab
```
## 7. Start application
@@ -98,7 +97,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.4 to 6.0`](5.4-to-6.0.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.4 to 6.0](5.4-to-6.0.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/6.0-to-7.1.md b/doc/update/6.0-to-7.2.md
index e328114a673..8dfcbcdd056 100644
--- a/doc/update/6.0-to-7.1.md
+++ b/doc/update/6.0-to-7.2.md
@@ -1,13 +1,16 @@
-# From 6.0 to 7.1
-
-## Deprecations
-
-The 'Wall' feature has been removed in GitLab 7.1. Existing wall comments will remain stored in the database after the upgrade.
+# From 6.0 to 7.2
## Global issue numbers
As of 6.1 issue numbers are project specific. This means all issues are renumbered and get a new number in their URL. If you use an old issue number URL and the issue number does not exist yet you are redirected to the new one. This conversion does not trigger if the old number already exists for this project, this is unlikely but will happen with old issues and large projects.
+## Editable labels
+
+In GitLab 7.2 we replace Issue and Merge Request tags with labels, making it
+possible to edit the label text and color. The characters '?', '&' and ',' are
+no longer allowed however so those will be removed from your tags during the
+database migrations for GitLab 7.2.
+
## 0. Backup
It's useful to make a backup just in case things go south:
@@ -22,7 +25,39 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
sudo service gitlab stop
-## 2. Get latest code
+## 2. Update Ruby
+
+If you are still using Ruby 1.9.3 or below, you will need to update Ruby.
+You can check which version you are running with `ruby -v`.
+
+If you are you running Ruby 2.0.x, you do not need to upgrade ruby, but can consider doing so for performance reasons.
+
+If you are running Ruby 2.1.1 consider upgrading to 2.1.2, because of the high memory usage of Ruby 2.1.1.
+
+Install, update dependencies:
+
+```bash
+sudo apt-get install build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl
+```
+
+Download and compile Ruby:
+
+```bash
+mkdir /tmp/ruby && cd /tmp/ruby
+curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | tar xz
+cd ruby-2.1.2
+./configure --disable-install-rdoc
+make
+sudo make install
+```
+
+Install Bundler:
+
+```bash
+sudo gem install bundler --no-ri --no-rdoc
+```
+
+## 3. Get latest code
```bash
cd /home/git/gitlab
@@ -32,7 +67,7 @@ sudo -u git -H git fetch --all
For GitLab Community Edition:
```bash
-sudo -u git -H git checkout 7-1-stable
+sudo -u git -H git checkout 7-2-stable
```
OR
@@ -40,26 +75,29 @@ OR
For GitLab Enterprise Edition:
```bash
-sudo -u git -H git checkout 7-1-stable-ee
+sudo -u git -H git checkout 7-2-stable-ee
```
-## 3. Install additional packages
+## 4. Install additional packages
```bash
# Add support for lograte for better log file handling
sudo apt-get install logrotate
+
+# Install pkg-config and cmake, which is needed for the latest versions of rugged
+sudo apt-get install pkg-config cmake
```
-## 4. Update gitlab-shell
+## 5. Update gitlab-shell
```bash
cd /home/git/gitlab-shell
sudo -u git -H git fetch
-sudo -u git -H git checkout v1.9.6 # Addresses multiple critical security vulnerabilities
+sudo -u git -H git checkout v1.9.7
```
-## 5. Install libs, migrations, etc.
+## 6. Install libs, migrations, etc.
```bash
cd /home/git/gitlab
@@ -70,7 +108,6 @@ sudo -u git -H bundle install --without development test postgres --deployment
# PostgreSQL installations (note: the line below states '--without ... mysql')
sudo -u git -H bundle install --without development test mysql --deployment
-
# Run database migrations
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
@@ -82,19 +119,24 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS
# Close access to gitlab-satellites for others
sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites
+
+# Update init.d script
+sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
```
-## 6. Update config files
+## 7. Update config files
-TIP: to see what changed in gitlab.yml.example in this release use next command:
+TIP: to see what changed in gitlab.yml.example in this release use next command:
```
-git diff 6-0-stable:config/gitlab.yml.example 7-1-stable:config/gitlab.yml.example
+git diff 6-0-stable:config/gitlab.yml.example 7-2-stable:config/gitlab.yml.example
```
-* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-1-stable/config/gitlab.yml.example but with your settings.
-* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-1-stable/config/unicorn.rb.example but with your settings.
-* Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-1-stable/lib/support/nginx/gitlab but with your settings.
+* Make `/home/git/gitlab/config/gitlab.yml` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-2-stable/config/gitlab.yml.example but with your settings.
+* Make `/home/git/gitlab/config/unicorn.rb` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-2-stable/config/unicorn.rb.example but with your settings.
+* Make `/home/git/gitlab-shell/config.yml` the same as https://gitlab.com/gitlab-org/gitlab-shell/blob/v1.9.7/config.yml.example but with your settings.
+* HTTP setups: Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-2-stable/lib/support/nginx/gitlab but with your settings.
+* HTTPS setups: Make `/etc/nginx/sites-available/nginx-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-2-stable/lib/support/nginx/gitlab-ssl but with your settings.
* Copy rack attack middleware config
```bash
@@ -107,12 +149,6 @@ sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
```
-## 7. Update Init script
-
-```bash
-sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-```
-
## 8. Start application
sudo service gitlab start
@@ -131,11 +167,17 @@ To make sure you didn't miss anything run a more thorough check with:
If all items are green, then congratulations upgrade complete!
+## 10. Update OmniAuth configuration
+
+When using Google omniauth login, changes of the Google account required.
+Ensure that `Contacts API` and the `Google+ API` are enabled in the [Google Developers Console](https://console.developers.google.com/).
+More details can be found at the [integration documentation](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/integration/google.md).
+
## Things went south? Revert to previous version (6.0)
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 5.4 to 6.0`](5.4-to-6.0.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 5.4 to 6.0](5.4-to-6.0.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
@@ -146,4 +188,4 @@ sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
## Login issues after upgrade?
-If running in HTTPS mode, be sure to read [Can't Verify CSRF token authenticity](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#cant-verify-csrf-token-authenticitycant-get-past-login-pageredirected-to-login-page)
+If running in HTTPS mode, be sure to read [Can't Verify CSRF token authenticity](https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#cant-verify-csrf-token-authenticitycant-get-past-login-pageredirected-to-login-page)
diff --git a/doc/update/6.1-to-6.2.md b/doc/update/6.1-to-6.2.md
index 9ab53aae24b..efa6e43124c 100644
--- a/doc/update/6.1-to-6.2.md
+++ b/doc/update/6.1-to-6.2.md
@@ -88,7 +88,6 @@ sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
```bash
sudo rm /etc/init.d/gitlab
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-sudo chmod +x /etc/init.d/gitlab
```
## 8. Start application
@@ -112,7 +111,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.0 to 6.1`](6.0-to-6.1.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 6.0 to 6.1](6.0-to-6.1.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/6.2-to-6.3.md b/doc/update/6.2-to-6.3.md
index 345480c4d32..e9b3bdd2f54 100644
--- a/doc/update/6.2-to-6.3.md
+++ b/doc/update/6.2-to-6.3.md
@@ -74,7 +74,6 @@ sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers
```bash
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-sudo chmod +x /etc/init.d/gitlab
```
## 7. Start application
@@ -98,7 +97,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.1 to 6.2`](6.1-to-6.2.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 6.1 to 6.2](6.1-to-6.2.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/6.3-to-6.4.md b/doc/update/6.3-to-6.4.md
index 18dce9b5f93..96c2895981d 100644
--- a/doc/update/6.3-to-6.4.md
+++ b/doc/update/6.3-to-6.4.md
@@ -79,7 +79,7 @@ If all items are green, then congratulations upgrade complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.2 to 6.3`](6.2-to-6.3.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 6.2 to 6.3](6.2-to-6.3.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup:
diff --git a/doc/update/6.4-to-6.5.md b/doc/update/6.4-to-6.5.md
index 1a95a98b6f2..1624296fc3f 100644
--- a/doc/update/6.4-to-6.5.md
+++ b/doc/update/6.4-to-6.5.md
@@ -83,7 +83,7 @@ If all items are green, then congratulations upgrade is complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.3 to 6.4`](6.3-to-6.4.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 6.3 to 6.4](6.3-to-6.4.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup
diff --git a/doc/update/6.5-to-6.6.md b/doc/update/6.5-to-6.6.md
index ee6a5a9bdf2..544eee17fec 100644
--- a/doc/update/6.5-to-6.6.md
+++ b/doc/update/6.5-to-6.6.md
@@ -83,7 +83,7 @@ If all items are green, then congratulations upgrade is complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.4 to 6.5`](6.4-to-6.5.md), except for the database migration
+Follow the [upgrade guide from 6.4 to 6.5](6.4-to-6.5.md), except for the database migration
(The backup is already migrated to the previous version)
### 2. Restore from the backup:
diff --git a/doc/update/6.6-to-6.7.md b/doc/update/6.6-to-6.7.md
index c3a749b9a92..77ac4d0bfa6 100644
--- a/doc/update/6.6-to-6.7.md
+++ b/doc/update/6.6-to-6.7.md
@@ -93,7 +93,7 @@ If all items are green, then congratulations upgrade is complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.5 to 6.6`](6.5-to-6.6.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 6.5 to 6.6](6.5-to-6.6.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup
diff --git a/doc/update/6.7-to-6.8.md b/doc/update/6.7-to-6.8.md
index 3c98896a9b2..16f3439c998 100644
--- a/doc/update/6.7-to-6.8.md
+++ b/doc/update/6.7-to-6.8.md
@@ -62,7 +62,6 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS
# Update init.d script
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-sudo chmod +x /etc/init.d/gitlab
# Close access to gitlab-satellites for others
sudo chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
@@ -111,7 +110,7 @@ If all items are green, then congratulations upgrade is complete!
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.6 to 6.7`](6.6-to-6.7.md), except for the database migration (the backup is already migrated to the previous version).
+Follow the [upgrade guide from 6.6 to 6.7](6.6-to-6.7.md), except for the database migration (the backup is already migrated to the previous version).
### 2. Restore from the backup
diff --git a/doc/update/6.8-to-6.9.md b/doc/update/6.8-to-6.9.md
index b7305d082a5..9efb384ff59 100644
--- a/doc/update/6.8-to-6.9.md
+++ b/doc/update/6.8-to-6.9.md
@@ -90,7 +90,7 @@ If all items are green, then congratulations upgrade is complete!
## Things went south? Revert to previous version (6.8)
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.7 to 6.8`](6.7-to-6.8.md), except for the database migration
+Follow the [upgrade guide from 6.7 to 6.8](6.7-to-6.8.md), except for the database migration
(The backup is already migrated to the previous version)
### 2. Restore from the backup:
diff --git a/doc/update/6.9-to-7.0.md b/doc/update/6.9-to-7.0.md
index 99ec441e275..1f3421a799b 100644
--- a/doc/update/6.9-to-7.0.md
+++ b/doc/update/6.9-to-7.0.md
@@ -93,7 +93,6 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS
# Update init.d script
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-sudo chmod +x /etc/init.d/gitlab
```
### 6. Update config files
@@ -106,6 +105,9 @@ There are new configuration options available for gitlab.yml. View them with the
git diff origin/6-9-stable:config/gitlab.yml.example origin/7-0-stable:config/gitlab.yml.example
```
+* HTTP setups: Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab but with your settings.
+* HTTPS setups: Make `/etc/nginx/sites-available/nginx-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab-ssl but with your setting
+
### 7. Start application
sudo service gitlab start
@@ -126,7 +128,7 @@ If all items are green, then congratulations upgrade is complete!
## Things went south? Revert to previous version (6.9)
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.8 to 6.9`](6.8-to-6.9.md), except for the database migration
+Follow the [upgrade guide from 6.8 to 6.9](6.8-to-6.9.md), except for the database migration
(The backup is already migrated to the previous version)
### 2. Restore from the backup:
diff --git a/doc/update/7.0-to-7.1.md b/doc/update/7.0-to-7.1.md
index 569f9160eb3..82bb5708734 100644
--- a/doc/update/7.0-to-7.1.md
+++ b/doc/update/7.0-to-7.1.md
@@ -93,7 +93,6 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS
# Update init.d script
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
-sudo chmod +x /etc/init.d/gitlab
```
### 6. Update config files
@@ -126,7 +125,7 @@ If all items are green, then congratulations upgrade is complete!
## Things went south? Revert to previous version (7.0)
### 1. Revert the code to the previous version
-Follow the [`upgrade guide from 6.9 to 7.0`](6.9-to-7.0.md), except for the database migration
+Follow the [upgrade guide from 6.9 to 7.0](6.9-to-7.0.md), except for the database migration
(The backup is already migrated to the previous version)
### 2. Restore from the backup:
diff --git a/doc/update/7.1-to-7.2.md b/doc/update/7.1-to-7.2.md
new file mode 100644
index 00000000000..ff5574114a8
--- /dev/null
+++ b/doc/update/7.1-to-7.2.md
@@ -0,0 +1,136 @@
+# From 7.1 to 7.2
+
+## Editable labels
+
+In GitLab 7.2 we replace Issue and Merge Request tags with labels, making it
+possible to edit the label text and color. The characters '?', '&' and ',' are
+no longer allowed however so those will be removed from your tags during the
+database migrations for GitLab 7.2.
+
+### 0. Backup
+
+```bash
+cd /home/git/gitlab
+sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
+```
+
+### 1. Stop server
+
+```bash
+sudo service gitlab stop
+```
+
+### 2. Get latest code
+
+```bash
+cd /home/git/gitlab
+sudo -u git -H git fetch --all
+```
+
+For GitLab Community Edition:
+
+```bash
+sudo -u git -H git checkout 7-2-stable
+```
+
+OR
+
+For GitLab Enterprise Edition:
+
+```bash
+sudo -u git -H git checkout 7-2-stable-ee
+```
+
+### 3. Update gitlab-shell
+
+```bash
+cd /home/git/gitlab-shell
+sudo -u git -H git fetch
+sudo -u git -H git checkout v1.9.7
+```
+
+### 4. Install new system dependencies
+
+The latest version of the 'rugged' gem requires `pkg-config` and `cmake` to
+build its native extensions.
+
+```bash
+sudo apt-get install pkg-config cmake
+```
+
+### 5. Install libs, migrations, etc.
+
+```bash
+cd /home/git/gitlab
+
+# MySQL installations (note: the line below states '--without ... postgres')
+sudo -u git -H bundle install --without development test postgres --deployment
+
+# PostgreSQL installations (note: the line below states '--without ... mysql')
+sudo -u git -H bundle install --without development test mysql --deployment
+
+# Run database migrations
+sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
+
+# Clean up assets and cache
+sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
+
+# Update init.d script
+sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
+```
+
+### 6. Update config files
+
+#### New configuration options for gitlab.yml
+
+There are new configuration options available for gitlab.yml. View them with the command below and apply them to your current gitlab.yml.
+
+```
+git diff 7-1-stable:config/gitlab.yml.example 7-2-stable:config/gitlab.yml.example
+```
+
+* HTTP setups: Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab but with your settings.
+* HTTPS setups: Make `/etc/nginx/sites-available/nginx-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab-ssl but with your setting
+
+Update rack attack middleware config
+
+```
+sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
+```
+
+### 7. Start application
+
+ sudo service gitlab start
+ sudo service nginx restart
+
+### 8. Check application status
+
+Check if GitLab and its environment are configured correctly:
+
+ 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:
+
+ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
+
+If all items are green, then congratulations upgrade is complete!
+
+### 9. Update OmniAuth configuration
+
+When using Google omniauth login, changes of the Google account required.
+Ensure that `Contacts API` and the `Google+ API` are enabled in the [Google Developers Console](https://console.developers.google.com/).
+More details can be found at the [integration documentation](../integration/google.md).
+
+## Things went south? Revert to previous version (7.1)
+
+### 1. Revert the code to the previous version
+Follow the [upgrade guide from 7.0 to 7.1](7.0-to-7.1.md), except for the database migration
+(The backup is already migrated to the previous version)
+
+### 2. Restore from the backup:
+
+```bash
+cd /home/git/gitlab
+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.
diff --git a/doc/update/7.2-to-7.3.md b/doc/update/7.2-to-7.3.md
new file mode 100644
index 00000000000..7cc8f8e2ede
--- /dev/null
+++ b/doc/update/7.2-to-7.3.md
@@ -0,0 +1,10 @@
+# From 7.2 to 7.3
+
+# GitLab 7.3 has not been released yet!
+
+This document currently just serves as a place to keep track of updates that will be needed for the 7.3 update.
+
+### Update config files
+
+* HTTP setups: Make `/etc/nginx/sites-available/nginx` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab but with your settings.
+* HTTPS setups: Make `/etc/nginx/sites-available/nginx-ssl` the same as https://gitlab.com/gitlab-org/gitlab-ce/blob/7-0-stable/lib/support/nginx/gitlab-ssl but with your setting \ No newline at end of file
diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md
index 91689890640..695c083d361 100644
--- a/doc/update/mysql_to_postgresql.md
+++ b/doc/update/mysql_to_postgresql.md
@@ -15,10 +15,15 @@ git clone https://github.com/gitlabhq/mysql-postgresql-converter.git
cd mysql-postgresql-converter
mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root gitlabhq_production
python db_converter.py databasename.mysql databasename.psql
-psql -f databasename.psql -d gitlabhq_production
+
+# Import the database dump as the application database user
+sudo -u git psql -f databasename.psql -d gitlabhq_production
# Rebuild indexes (see below)
+# Install gems for PostgreSQL (note: the line below states '--without ... mysql')
+sudo -u git -H bundle install --without development test mysql --deployment
+
sudo service gitlab start
```
@@ -68,6 +73,7 @@ test -e /opt/gitlab/embedded/service/gitlab-rails/db/schema.rb.bundled || sudo /
```
## Converting a GitLab backup file from MySQL to Postgres
+**Note:** Please make sure to have Python 2.7.x (or higher) installed.
GitLab backup files (<timestamp>_gitlab_backup.tar) contain a SQL dump. Using the lanyrd database converter we can replace a MySQL database dump inside the tar file with a Postgres database dump. This can be useful if you are moving to another server.
diff --git a/doc/update/upgrader.md b/doc/update/upgrader.md
index 00dc87e2f99..e8379fcc318 100644
--- a/doc/update/upgrader.md
+++ b/doc/update/upgrader.md
@@ -21,6 +21,8 @@ If you have local changes to your GitLab repository the script will stash them a
## 2. Run GitLab upgrade tool
+Note: GitLab 7.2 adds `pkg-config` and `cmake` as dependency. Please check the dependencies in the [installation guide.](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#1-packages-dependencies)
+
# Starting with GitLab version 7.0 upgrader script has been moved to bin directory
cd /home/git/gitlab
if [ -f bin/upgrade.rb ]; then sudo -u git -H ruby bin/upgrade.rb; else sudo -u git -H ruby script/upgrade.rb; fi
diff --git a/doc/web_hooks/web_hooks.md b/doc/web_hooks/web_hooks.md
index ada21d23ac3..13c4de4301e 100644
--- a/doc/web_hooks/web_hooks.md
+++ b/doc/web_hooks/web_hooks.md
@@ -76,7 +76,9 @@ Triggered when a new issue is created or an existing issue was updated/closed/re
"description": "Create new API for manipulations with repository",
"milestone_id": null,
"state": "opened",
- "iid": 23
+ "iid": 23,
+ "url": "http://example.com/diaspora/issues/23",
+ "action": "open"
}
}
```
diff --git a/doc/workflow/README.md b/doc/workflow/README.md
index 00d4bed1cc7..b18f62a1fa6 100644
--- a/doc/workflow/README.md
+++ b/doc/workflow/README.md
@@ -2,3 +2,4 @@
- [Project Features](project_features.md)
- [Authorization for merge requests](authorization_for_merge_requests.md)
- [Groups](groups.md)
+- [Labels](labels.md)
diff --git a/doc/workflow/labels.md b/doc/workflow/labels.md
new file mode 100644
index 00000000000..085b7baf5ce
--- /dev/null
+++ b/doc/workflow/labels.md
@@ -0,0 +1,16 @@
+# Labels
+
+In GitLab, you can easily tag issues and merge requests. If you have permission level `Developer` or higher, you can manage labels. To create, edit or delete a label, go to a project and then to `Issues` and then `Labels`.
+
+Here you can create a new label.
+
+![new label](labels/label1.png)
+
+You can choose to set a color.
+
+![label color](labels/label2.png)
+
+If you want to change an existing label, press edit next to the listed label.
+You will be presented with the same form as when creating a new label.
+
+![edit label](labels/label3.png)
diff --git a/doc/workflow/labels/label1.png b/doc/workflow/labels/label1.png
new file mode 100644
index 00000000000..cac661a34c8
--- /dev/null
+++ b/doc/workflow/labels/label1.png
Binary files differ
diff --git a/doc/workflow/labels/label2.png b/doc/workflow/labels/label2.png
new file mode 100644
index 00000000000..44d9fef86d4
--- /dev/null
+++ b/doc/workflow/labels/label2.png
Binary files differ
diff --git a/doc/workflow/labels/label3.png b/doc/workflow/labels/label3.png
new file mode 100644
index 00000000000..e2fce11b7a4
--- /dev/null
+++ b/doc/workflow/labels/label3.png
Binary files differ
diff --git a/features/dashboard/search.feature b/features/dashboard/search.feature
deleted file mode 100644
index 24c45028697..00000000000
--- a/features/dashboard/search.feature
+++ /dev/null
@@ -1,10 +0,0 @@
-@dashboard
-Feature: Dashboard Search
- Background:
- Given I sign in as a user
- And I own project "Shop"
- And I visit dashboard search page
-
- Scenario: I should see project I am looking for
- Given I search for "Sho"
- Then I should see "Shop" project link
diff --git a/features/dashboard/shortcuts.feature b/features/dashboard/shortcuts.feature
new file mode 100644
index 00000000000..7c25b3926c9
--- /dev/null
+++ b/features/dashboard/shortcuts.feature
@@ -0,0 +1,21 @@
+@dashboard
+Feature: Dashboard shortcuts
+ Background:
+ Given I sign in as a user
+ And I visit dashboard page
+
+ @javascript
+ Scenario: Navigate to projects tab
+ Given I press "g" and "p"
+ Then the active main tab should be Projects
+
+ @javascript
+ Scenario: Navigate to issue tab
+ Given I press "g" and "i"
+ Then the active main tab should be Issues
+
+ @javascript
+ Scenario: Navigate to merge requests tab
+ Given I press "g" and "m"
+ Then the active main tab should be Merge Requests
+
diff --git a/features/project/commits/branches.feature b/features/project/commits/branches.feature
index abebef04fcd..d124cb7eecd 100644
--- a/features/project/commits/branches.feature
+++ b/features/project/commits/branches.feature
@@ -15,5 +15,29 @@ Feature: Project Browse branches
Scenario: I create a branch
Given I visit project branches page
And I click new branch link
- When I submit new branch form
+ And I submit new branch form
Then I should see new branch created
+
+ @javascript
+ Scenario: I delete a branch
+ Given I visit project branches page
+ And I click branch 'improve/awesome' delete link
+ Then I should not see branch 'improve/awesome'
+
+ Scenario: I create a branch with invalid name
+ Given I visit project branches page
+ And I click new branch link
+ And I submit new branch form with invalid name
+ Then I should see new an error that branch is invalid
+
+ Scenario: I create a branch with invalid reference
+ Given I visit project branches page
+ And I click new branch link
+ And I submit new branch form with invalid reference
+ Then I should see new an error that ref is invalid
+
+ Scenario: I create a branch that already exists
+ Given I visit project branches page
+ And I click new branch link
+ And I submit new branch form with branch that already exists
+ Then I should see new an error that branch already exists
diff --git a/features/project/commits/tags.feature b/features/project/commits/tags.feature
index 1ac0f8bfa45..bea463cb786 100644
--- a/features/project/commits/tags.feature
+++ b/features/project/commits/tags.feature
@@ -7,5 +7,35 @@ Feature: Project Browse tags
Scenario: I can see all git tags
Then I should see "Shop" all tags list
+ Scenario: I create a tag
+ And I click new tag link
+ And I submit new tag form
+ Then I should see new tag created
+
+ Scenario: I create a tag with invalid name
+ And I click new tag link
+ And I submit new tag form with invalid name
+ Then I should see new an error that tag is invalid
+
+ Scenario: I create a tag with invalid reference
+ And I click new tag link
+ And I submit new tag form with invalid reference
+ Then I should see new an error that tag ref is invalid
+
+ Scenario: I create a tag that already exists
+ And I click new tag link
+ And I submit new tag form with tag that already exists
+ Then I should see new an error that tag already exists
+
+ @javascript
+ Scenario: I delete a tag
+ Given I delete tag 'v1.1.0'
+ Then I should not see tag 'v1.1.0'
+
+ @javascript
+ Scenario: I delete all tags and see info message
+ Given I delete all tags
+ Then I should see tags info message
+
# @wip
# Scenario: I can download project by tag
diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature
index b2e6f1f9324..ae6a03ce865 100644
--- a/features/project/issues/issues.feature
+++ b/features/project/issues/issues.feature
@@ -63,6 +63,36 @@ Feature: Project Issues
Then I should see "Release 0.3" in issues
And I should not see "Release 0.4" in issues
+ @javascript
+ Scenario: Search issues when search string exactly matches issue description
+ Given project 'Shop' has issue 'Bugfix1' with description: 'Description for issue1'
+ And I fill in issue search with 'Description for issue1'
+ Then I should see 'Bugfix1' in issues
+ And I should not see "Release 0.4" in issues
+ And I should not see "Release 0.3" in issues
+ And I should not see "Tweet control" in issues
+
+ @javascript
+ Scenario: Search issues when search string partially matches issue description
+ Given project 'Shop' has issue 'Bugfix1' with description: 'Description for issue1'
+ And project 'Shop' has issue 'Feature1' with description: 'Feature submitted for issue1'
+ And I fill in issue search with 'issue1'
+ Then I should see 'Feature1' in issues
+ Then I should see 'Bugfix1' in issues
+ And I should not see "Release 0.4" in issues
+ And I should not see "Release 0.3" in issues
+ And I should not see "Tweet control" in issues
+
+ @javascript
+ Scenario: Search issues when search string matches no issue description
+ Given project 'Shop' has issue 'Bugfix1' with description: 'Description for issue1'
+ And I fill in issue search with 'Rock and roll'
+ Then I should not see 'Bugfix1' in issues
+ And I should not see "Release 0.4" in issues
+ And I should not see "Release 0.3" in issues
+ And I should not see "Tweet control" in issues
+
+
# Markdown
Scenario: Headers inside the description should have ids generated for them.
@@ -89,3 +119,10 @@ Feature: Project Issues
Given I click link "New Issue"
And I submit new issue "500 error on profile"
Then I should see issue "500 error on profile"
+
+ Scenario: Clickable labels
+ Given issue 'Release 0.4' has label 'bug'
+ And I visit project "Shop" issues page
+ When I click label 'bug'
+ And I should see "Release 0.4" in issues
+ And I should not see "Tweet control" in issues
diff --git a/features/project/issues/labels.feature b/features/project/issues/labels.feature
index 29cf5307271..a9fe1595fc5 100644
--- a/features/project/issues/labels.feature
+++ b/features/project/issues/labels.feature
@@ -6,8 +6,8 @@ Feature: Project Labels
Given I visit project "Shop" labels page
Scenario: I should see labels list
- Then I should see label "bug"
- And I should see label "feature"
+ Then I should see label 'bug'
+ And I should see label 'feature'
Scenario: I create new label
Given I visit project "Shop" new label page
@@ -24,6 +24,11 @@ Feature: Project Labels
When I remove label 'bug'
Then I should not see label 'bug'
+ @javascript
+ Scenario: I remove all labels
+ When I delete all labels
+ Then I should see labels help message
+
Scenario: I create a label with invalid color
Given I visit project "Shop" new label page
When I submit new label with invalid color
@@ -40,4 +45,3 @@ Feature: Project Labels
And I visit project "Forum" new label page
When I submit new label 'bug'
Then I should see label 'bug'
-
diff --git a/features/project/shortcuts.feature b/features/project/shortcuts.feature
new file mode 100644
index 00000000000..e5f9c103fb1
--- /dev/null
+++ b/features/project/shortcuts.feature
@@ -0,0 +1,52 @@
+@dashboard
+Feature: Project shortcuts
+ Background:
+ Given I sign in as a user
+ And I own a project
+ And I visit my project's home page
+
+ @javascript
+ Scenario: Navigate to files tab
+ Given I press "g" and "f"
+ Then the active main tab should be Files
+
+ @javascript
+ Scenario: Navigate to commits tab
+ Given I press "g" and "c"
+ Then the active main tab should be Commits
+
+ @javascript
+ Scenario: Navigate to network tab
+ Given I press "g" and "n"
+ Then the active main tab should be Network
+
+ @javascript
+ Scenario: Navigate to graphs tab
+ Given I press "g" and "g"
+ Then the active main tab should be Graphs
+
+ @javascript
+ Scenario: Navigate to issues tab
+ Given I press "g" and "i"
+ Then the active main tab should be Issues
+
+ @javascript
+ Scenario: Navigate to merge requests tab
+ Given I press "g" and "m"
+ Then the active main tab should be Merge Requests
+
+ @javascript
+ Scenario: Navigate to snippets tab
+ Given I press "g" and "s"
+ Then the active main tab should be Snippets
+
+ @javascript
+ Scenario: Navigate to wiki tab
+ Given I press "g" and "w"
+ Then the active main tab should be Wiki
+
+ @javascript
+ Scenario: Navigate to project feed
+ Given I visit my project's files page
+ Given I press "g" and "p"
+ Then the active main tab should be Home
diff --git a/features/project/source/browse_files.feature b/features/project/source/browse_files.feature
index f8934da8de5..a674800ccb8 100644
--- a/features/project/source/browse_files.feature
+++ b/features/project/source/browse_files.feature
@@ -51,3 +51,15 @@ Feature: Project Browse files
Scenario: I can browse code with Browse Code
Given I click on history link
Then I see Browse code link
+
+ # Permalink
+
+ Scenario: I click on the permalink link from a branch ref
+ Given I click on ".gitignore" file in repo
+ And I click on permalink
+ Then I am redirected to the permalink URL
+
+ Scenario: I don't see the permalink link from a SHA ref
+ Given I visit project source page for "6d394385cf567f80a8fd85055db1ab4c5295806f"
+ And I click on ".gitignore" file in repo
+ Then I don't see the permalink link
diff --git a/features/search.feature b/features/search.feature
new file mode 100644
index 00000000000..54708c17575
--- /dev/null
+++ b/features/search.feature
@@ -0,0 +1,46 @@
+@dashboard
+Feature: Search
+ Background:
+ Given I sign in as a user
+ And I own project "Shop"
+ And I visit dashboard search page
+
+ Scenario: I should see project I am looking for
+ Given I search for "Sho"
+ Then I should see "Shop" project link
+
+ Scenario: I should see issues I am looking for
+ And project has issues
+ When I search for "Foo"
+ And I click "Issues" link
+ Then I should see "Foo" link
+ And I should not see "Bar" link
+
+ Scenario: I should see merge requests I am looking for
+ And project has merge requests
+ When I search for "Foo"
+ When I click "Merge requests" link
+ Then I should see "Foo" link
+ And I should not see "Bar" link
+
+ Scenario: I should see project code I am looking for
+ When I click project "Shop" link
+ And I search for "rspec"
+ Then I should see code results for project "Shop"
+
+ Scenario: I should see project issues
+ And project has issues
+ When I click project "Shop" link
+ And I search for "Foo"
+ And I click "Issues" link
+ Then I should see "Foo" link
+ And I should not see "Bar" link
+
+ Scenario: I should see project merge requests
+ And project has merge requests
+ When I click project "Shop" link
+ And I search for "Foo"
+ And I click "Merge requests" link
+ Then I should see "Foo" link
+ And I should not see "Bar" link
+
diff --git a/features/snippet_search.feature b/features/snippet_search.feature
new file mode 100644
index 00000000000..834bd3b2376
--- /dev/null
+++ b/features/snippet_search.feature
@@ -0,0 +1,20 @@
+@dashboard
+Feature: Snippet Search
+ Background:
+ Given I sign in as a user
+ And I have public "Personal snippet one" snippet
+ And I have private "Personal snippet private" snippet
+ And I have a public many lined snippet
+
+ Scenario: I should see my public and private snippets
+ When I search for "snippet" in snippet titles
+ Then I should see "Personal snippet one" in results
+ And I should see "Personal snippet private" in results
+
+ Scenario: I should see three surrounding lines on either side of a matching snippet line
+ When I search for "line seven" in snippet contents
+ Then I should see "line four" in results
+ And I should see "line seven" in results
+ And I should see "line ten" in results
+ And I should not see "line three" in results
+ And I should not see "line eleven" in results
diff --git a/features/steps/dashboard/active_tab.rb b/features/steps/dashboard/active_tab.rb
index 68d32ed971a..d5db3339df2 100644
--- a/features/steps/dashboard/active_tab.rb
+++ b/features/steps/dashboard/active_tab.rb
@@ -3,19 +3,7 @@ class DashboardActiveTab < Spinach::FeatureSteps
include SharedPaths
include SharedActiveTab
- Then 'the active main tab should be Home' do
- ensure_active_main_tab('Activity')
- end
-
- Then 'the active main tab should be Issues' do
- ensure_active_main_tab('Issues')
- end
-
- Then 'the active main tab should be Merge Requests' do
- ensure_active_main_tab('Merge Requests')
- end
-
- Then 'the active main tab should be Help' do
+ step 'the active main tab should be Help' do
ensure_active_main_tab('Help')
end
end
diff --git a/features/steps/dashboard/search.rb b/features/steps/dashboard/search.rb
deleted file mode 100644
index 32966a8617a..00000000000
--- a/features/steps/dashboard/search.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-class DashboardSearch < Spinach::FeatureSteps
- include SharedAuthentication
- include SharedPaths
- include SharedProject
-
- Given 'I search for "Sho"' do
- fill_in "dashboard_search", with: "Sho"
- click_button "Search"
- end
-
- Then 'I should see "Shop" project link' do
- page.should have_link "Shop"
- end
-
- Given 'I search for "Contibuting"' do
- fill_in "dashboard_search", with: "Contibuting"
- click_button "Search"
- end
-end
diff --git a/features/steps/dashboard/shortcuts.rb b/features/steps/dashboard/shortcuts.rb
new file mode 100644
index 00000000000..d4484e7a20f
--- /dev/null
+++ b/features/steps/dashboard/shortcuts.rb
@@ -0,0 +1,6 @@
+class DashboardShortcuts < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedPaths
+ include SharedProject
+ include SharedActiveTab
+end
diff --git a/features/steps/explore/projects.rb b/features/steps/explore/projects.rb
index dfd51060738..f31d32a4a2d 100644
--- a/features/steps/explore/projects.rb
+++ b/features/steps/explore/projects.rb
@@ -35,13 +35,13 @@ class Spinach::Features::ExploreProjectsFeature < Spinach::FeatureSteps
end
step 'I should see project "Community" home page' do
- within '.project-home-title' do
+ within '.navbar-gitlab .title' do
page.should have_content 'Community'
end
end
step 'I should see project "Internal" home page' do
- within '.project-home-title' do
+ within '.navbar-gitlab .title' do
page.should have_content 'Internal'
end
end
diff --git a/features/steps/group/group.rb b/features/steps/group/group.rb
index 288524f92b2..c3ee42f1127 100644
--- a/features/steps/group/group.rb
+++ b/features/steps/group/group.rb
@@ -189,7 +189,7 @@ class Groups < Spinach::FeatureSteps
step 'I should see group milestone with descriptions and expiry date' do
page.should have_content('Lorem Ipsum is simply dummy text of the printing and typesetting industry')
- page.should have_content('expires at Aug 20, 2014')
+ page.should have_content('expires at Aug 20, 2114')
end
step 'I should see group milestone with all issues and MRs assigned to that milestone' do
@@ -238,7 +238,7 @@ class Groups < Spinach::FeatureSteps
milestone2_project3 = create :milestone,
title: "GL-113",
project: @project3,
- due_date: '2014-08-20',
+ due_date: '2114-08-20',
description: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry'
@issue1 = create :issue,
project: @project1,
diff --git a/features/steps/project/active_tab.rb b/features/steps/project/active_tab.rb
index dfafbc6fc0e..2862256e03b 100644
--- a/features/steps/project/active_tab.rb
+++ b/features/steps/project/active_tab.rb
@@ -3,44 +3,7 @@ class ProjectActiveTab < Spinach::FeatureSteps
include SharedPaths
include SharedProject
include SharedActiveTab
-
- # Main Tabs
-
- Then 'the active main tab should be Home' do
- ensure_active_main_tab('Activity')
- end
-
- Then 'the active main tab should be Settings' do
- ensure_active_main_tab('Settings')
- end
-
- Then 'the active main tab should be Files' do
- ensure_active_main_tab('Files')
- end
-
- Then 'the active main tab should be Commits' do
- ensure_active_main_tab('Commits')
- end
-
- Then 'the active main tab should be Network' do
- ensure_active_main_tab('Network')
- end
-
- Then 'the active main tab should be Issues' do
- ensure_active_main_tab('Issues')
- end
-
- Then 'the active main tab should be Merge Requests' do
- ensure_active_main_tab('Merge Requests')
- end
-
- Then 'the active main tab should be Wall' do
- ensure_active_main_tab('Wall')
- end
-
- Then 'the active main tab should be Wiki' do
- ensure_active_main_tab('Wiki')
- end
+ include SharedProjectTab
# Sub Tabs: Home
diff --git a/features/steps/project/browse_branches.rb b/features/steps/project/browse_branches.rb
index 7a0625952de..cfc88bdad22 100644
--- a/features/steps/project/browse_branches.rb
+++ b/features/steps/project/browse_branches.rb
@@ -38,9 +38,48 @@ class ProjectBrowseBranches < Spinach::FeatureSteps
click_button 'Create branch'
end
+ step 'I submit new branch form with invalid name' do
+ fill_in 'branch_name', with: '1.0 stable'
+ fill_in 'ref', with: 'master'
+ click_button 'Create branch'
+ end
+
+ step 'I submit new branch form with invalid reference' do
+ fill_in 'branch_name', with: 'foo'
+ fill_in 'ref', with: 'foo'
+ click_button 'Create branch'
+ end
+
+ step 'I submit new branch form with branch that already exists' do
+ fill_in 'branch_name', with: 'master'
+ fill_in 'ref', with: 'master'
+ click_button 'Create branch'
+ end
+
step 'I should see new branch created' do
- within '.tree-ref-holder' do
- page.should have_content 'deploy_keys'
+ page.should have_content 'deploy_keys'
+ end
+
+ step 'I should see new an error that branch is invalid' do
+ page.should have_content 'Branch name invalid'
+ end
+
+ step 'I should see new an error that ref is invalid' do
+ page.should have_content 'Invalid reference name'
+ end
+
+ step 'I should see new an error that branch already exists' do
+ page.should have_content 'Branch already exists'
+ end
+
+ step "I click branch 'improve/awesome' delete link" do
+ within '.js-branch-improve\/awesome' do
+ find('.btn-remove').click
+ sleep 0.05
end
end
+
+ step "I should not see branch 'improve/awesome'" do
+ page.all(visible: true).should_not have_content 'improve/awesome'
+ end
end
diff --git a/features/steps/project/browse_files.rb b/features/steps/project/browse_files.rb
index 6fd0c2c2ded..bd395a0d26e 100644
--- a/features/steps/project/browse_files.rb
+++ b/features/steps/project/browse_files.rb
@@ -90,4 +90,17 @@ class ProjectBrowseFiles < Spinach::FeatureSteps
page.should_not have_link 'Browse File »'
page.should_not have_link 'Browse Dir »'
end
+
+ step 'I click on permalink' do
+ click_link 'permalink'
+ end
+
+ step 'I am redirected to the permalink URL' do
+ expect(current_path).to eq(project_blob_path(
+ @project, @project.repository.commit.sha + '/.gitignore'))
+ end
+
+ step "I don't see the permalink link" do
+ expect(page).not_to have_link('permalink')
+ end
end
diff --git a/features/steps/project/browse_tags.rb b/features/steps/project/browse_tags.rb
index 7c679911e00..6ccf5a87927 100644
--- a/features/steps/project/browse_tags.rb
+++ b/features/steps/project/browse_tags.rb
@@ -3,8 +3,80 @@ class ProjectBrowseTags < Spinach::FeatureSteps
include SharedProject
include SharedPaths
- Then 'I should see "Shop" all tags list' do
+ step 'I should see "Shop" all tags list' do
page.should have_content "Tags"
page.should have_content "v1.0.0"
end
+
+ step 'I click new tag link' do
+ click_link 'New tag'
+ end
+
+ step 'I submit new tag form' do
+ fill_in 'tag_name', with: 'v7.0'
+ fill_in 'ref', with: 'master'
+ click_button 'Create tag'
+ end
+
+ step 'I submit new tag form with invalid name' do
+ fill_in 'tag_name', with: 'v 1.0'
+ fill_in 'ref', with: 'master'
+ click_button 'Create tag'
+ end
+
+ step 'I submit new tag form with invalid reference' do
+ fill_in 'tag_name', with: 'foo'
+ fill_in 'ref', with: 'foo'
+ click_button 'Create tag'
+ end
+
+ step 'I submit new tag form with tag that already exists' do
+ fill_in 'tag_name', with: 'v1.0.0'
+ fill_in 'ref', with: 'master'
+ click_button 'Create tag'
+ end
+
+ step 'I should see new tag created' do
+ page.should have_content 'v7.0'
+ end
+
+ step 'I should see new an error that tag is invalid' do
+ page.should have_content 'Tag name invalid'
+ end
+
+ step 'I should see new an error that tag ref is invalid' do
+ page.should have_content 'Invalid reference name'
+ end
+
+ step 'I should see new an error that tag already exists' do
+ page.should have_content 'Tag already exists'
+ end
+
+ step "I delete tag 'v1.1.0'" do
+ within '.tags' do
+ first('.btn-remove').click
+ sleep 0.05
+ end
+ end
+
+ step "I should not see tag 'v1.1.0'" do
+ within '.tags' do
+ page.all(visible: true).should_not have_content 'v1.1.0'
+ end
+ end
+
+ step 'I delete all tags' do
+ within '.tags' do
+ all('.btn-remove').each do |remove|
+ remove.click
+ sleep 0.05
+ end
+ end
+ end
+
+ step 'I should see tags info message' do
+ within '.tags' do
+ page.should have_content 'Repository has no tags yet.'
+ end
+ end
end
diff --git a/features/steps/project/issues.rb b/features/steps/project/issues.rb
index 557ea2fdca8..65c243a7297 100644
--- a/features/steps/project/issues.rb
+++ b/features/steps/project/issues.rb
@@ -74,34 +74,34 @@ class ProjectIssues < Spinach::FeatureSteps
end
Given 'I fill in issue search with "Re"' do
- fill_in 'issue_search', with: "Re"
+ filter_issue "Re"
end
Given 'I fill in issue search with "Bu"' do
- fill_in 'issue_search', with: "Bu"
+ filter_issue "Bu"
end
And 'I fill in issue search with ".3"' do
- fill_in 'issue_search', with: ".3"
+ filter_issue ".3"
end
And 'I fill in issue search with "Something"' do
- fill_in 'issue_search', with: "Something"
+ filter_issue "Something"
end
And 'I fill in issue search with ""' do
- fill_in 'issue_search', with: ""
+ filter_issue ""
end
Given 'project "Shop" has milestone "v2.2"' do
- project = Project.find_by(name: "Shop")
+
milestone = create(:milestone, title: "v2.2", project: project)
3.times { create(:issue, project: project, milestone: milestone) }
end
And 'project "Shop" has milestone "v3.0"' do
- project = Project.find_by(name: "Shop")
+
milestone = create(:milestone, title: "v3.0", project: project)
3.times { create(:issue, project: project, milestone: milestone) }
@@ -117,20 +117,20 @@ class ProjectIssues < Spinach::FeatureSteps
end
When 'I select first assignee from "Shop" project' do
- project = Project.find_by(name: "Shop")
+
first_assignee = project.users.first
select first_assignee.name, from: "assignee_id"
end
Then 'I should see first assignee from "Shop" as selected assignee' do
issues_assignee_selector = "#issue_assignee_id_chzn > a"
- project = Project.find_by(name: "Shop")
+
assignee_name = project.users.first.name
page.find(issues_assignee_selector).should have_content(assignee_name)
end
And 'project "Shop" have "Release 0.4" open issue' do
- project = Project.find_by(name: "Shop")
+
create(:issue,
title: "Release 0.4",
project: project,
@@ -140,7 +140,6 @@ class ProjectIssues < Spinach::FeatureSteps
end
And 'project "Shop" have "Tweet control" open issue' do
- project = Project.find_by(name: "Shop")
create(:issue,
title: "Tweet control",
project: project,
@@ -148,7 +147,6 @@ class ProjectIssues < Spinach::FeatureSteps
end
And 'project "Shop" have "Release 0.3" closed issue' do
- project = Project.find_by(name: "Shop")
create(:closed_issue,
title: "Release 0.3",
project: project,
@@ -187,4 +185,59 @@ class ProjectIssues < Spinach::FeatureSteps
step 'The code block should be unchanged' do
page.should have_content("```\nCommand [1]: /usr/local/bin/git , see [text](doc/text)\n```")
end
+
+ step 'project \'Shop\' has issue \'Bugfix1\' with description: \'Description for issue1\'' do
+ issue = create(:issue, title: 'Bugfix1', description: 'Description for issue1', project: project)
+ end
+
+ step 'project \'Shop\' has issue \'Feature1\' with description: \'Feature submitted for issue1\'' do
+ issue = create(:issue, title: 'Feature1', description: 'Feature submitted for issue1', project: project)
+ end
+
+ step 'I fill in issue search with \'Description for issue1\'' do
+ filter_issue 'Description for issue'
+ end
+
+ step 'I fill in issue search with \'issue1\'' do
+ filter_issue 'issue1'
+ end
+
+ step 'I fill in issue search with \'Rock and roll\'' do
+ filter_issue 'Description for issue'
+ end
+
+ step 'I should see \'Bugfix1\' in issues' do
+ page.should have_content 'Bugfix1'
+ end
+
+ step 'I should see \'Feature1\' in issues' do
+ page.should have_content 'Feature1'
+ end
+
+ step 'I should not see \'Bugfix1\' in issues' do
+ page.should_not have_content 'Bugfix1'
+ end
+
+ step 'issue \'Release 0.4\' has label \'bug\'' do
+ label = project.labels.create!(name: 'bug', color: '#990000')
+ issue = Issue.find_by!(title: 'Release 0.4')
+ issue.labels << label
+ end
+
+ step 'I click label \'bug\'' do
+ within ".issues-list" do
+ click_link 'bug'
+ end
+ end
+
+ def filter_issue(text)
+ fill_in 'issue_search', with: text
+
+ # make sure AJAX request finished
+ URI.parse(current_url).request_uri == project_issues_path(project, issue_search: text)
+ end
+
+ def project
+ @project ||= Project.find_by(name: 'Shop')
+ end
end
diff --git a/features/steps/project/labels.rb b/features/steps/project/labels.rb
index 8320405e096..62c1d74c718 100644
--- a/features/steps/project/labels.rb
+++ b/features/steps/project/labels.rb
@@ -3,18 +3,6 @@ class ProjectLabels < Spinach::FeatureSteps
include SharedProject
include SharedPaths
- step 'I should see label "bug"' do
- within ".manage-labels-list" do
- page.should have_content "bug"
- end
- end
-
- step 'I should see label "feature"' do
- within ".manage-labels-list" do
- page.should have_content "feature"
- end
- end
-
step 'I visit \'bug\' label edit page' do
visit edit_project_label_path(project, bug_label)
end
@@ -25,6 +13,22 @@ class ProjectLabels < Spinach::FeatureSteps
end
end
+ step 'I delete all labels' do
+ within '.labels' do
+ all('.btn-remove').each do |remove|
+ remove.click
+ sleep 0.05
+ end
+ end
+ end
+
+ step 'I should see labels help message' do
+ within '.labels' do
+ page.should have_content 'Create first label or generate default set of '\
+ 'labels'
+ end
+ end
+
step 'I submit new label \'support\'' do
fill_in 'Title', with: 'support'
fill_in 'Background Color', with: '#F95610'
@@ -55,6 +59,12 @@ class ProjectLabels < Spinach::FeatureSteps
end
end
+ step 'I should see label \'feature\'' do
+ within '.manage-labels-list' do
+ page.should have_content 'feature'
+ end
+ end
+
step 'I should see label \'bug\'' do
within '.manage-labels-list' do
page.should have_content 'bug'
diff --git a/features/steps/project/project_shortcuts.rb b/features/steps/project/project_shortcuts.rb
new file mode 100644
index 00000000000..ce6e21a4258
--- /dev/null
+++ b/features/steps/project/project_shortcuts.rb
@@ -0,0 +1,36 @@
+class ProjectShortcuts < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedPaths
+ include SharedProject
+ include SharedProjectTab
+
+ step 'I press "g" and "f"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('f')
+ end
+
+ step 'I press "g" and "c"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('c')
+ end
+
+ step 'I press "g" and "n"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('n')
+ end
+
+ step 'I press "g" and "g"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('g')
+ end
+
+ step 'I press "g" and "s"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('s')
+ end
+
+ step 'I press "g" and "w"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('w')
+ end
+end
diff --git a/features/steps/project/redirects.rb b/features/steps/project/redirects.rb
index 7e01735af95..39d39c8aeca 100644
--- a/features/steps/project/redirects.rb
+++ b/features/steps/project/redirects.rb
@@ -18,7 +18,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step 'I should see project "Community" home page' do
Gitlab.config.gitlab.stub(:host).and_return("www.example.com")
- within '.project-home-title' do
+ within '.navbar-gitlab .title' do
page.should have_content 'Community'
end
end
@@ -34,9 +34,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
end
step 'I click on "Sign In"' do
- within '.pull-right' do
- click_link "Sign in"
- end
+ first(:link, "Sign in").click
end
step 'Authenticate' do
diff --git a/features/steps/project/search_code.rb b/features/steps/project/search_code.rb
index affa7d3b43b..55218b6e745 100644
--- a/features/steps/project/search_code.rb
+++ b/features/steps/project/search_code.rb
@@ -6,7 +6,6 @@ class ProjectSearchCode < Spinach::FeatureSteps
step 'I search for term "coffee"' do
fill_in "search", with: "coffee"
click_button "Go"
- click_link 'Repository Code'
end
step 'I should see files from repository containing "coffee"' do
@@ -15,6 +14,6 @@ class ProjectSearchCode < Spinach::FeatureSteps
end
step 'I should see empty result' do
- page.should have_content "We couldn't find any matching code"
+ page.should have_content "We couldn't find any matching"
end
end
diff --git a/features/steps/search.rb b/features/steps/search.rb
new file mode 100644
index 00000000000..b1058989d0b
--- /dev/null
+++ b/features/steps/search.rb
@@ -0,0 +1,73 @@
+class Spinach::Features::Search < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedPaths
+ include SharedProject
+
+ step 'I search for "Sho"' do
+ fill_in "dashboard_search", with: "Sho"
+ click_button "Search"
+ end
+
+ step 'I search for "Foo"' do
+ fill_in "dashboard_search", with: "Foo"
+ click_button "Search"
+ end
+
+ step 'I search for "rspec"' do
+ fill_in "dashboard_search", with: "rspec"
+ click_button "Search"
+ end
+
+ step 'I click "Issues" link' do
+ within '.search-filter' do
+ click_link 'Issues'
+ end
+ end
+
+ step 'I click project "Shop" link' do
+ within '.project-filter' do
+ click_link project.name_with_namespace
+ end
+ end
+
+ step 'I click "Merge requests" link' do
+ within '.search-filter' do
+ click_link 'Merge requests'
+ end
+ end
+
+ step 'I should see "Shop" project link' do
+ page.should have_link "Shop"
+ end
+
+ step 'I should see code results for project "Shop"' do
+ page.should have_content 'Update capybara, rspec-rails, poltergeist to recent versions'
+ end
+
+ step 'I search for "Contibuting"' do
+ fill_in "dashboard_search", with: "Contibuting"
+ click_button "Search"
+ end
+
+ step 'project has issues' do
+ create(:issue, title: "Foo", project: project)
+ create(:issue, title: "Bar", project: project)
+ end
+
+ step 'project has merge requests' do
+ create(:merge_request, title: "Foo", source_project: project, target_project: project)
+ create(:merge_request, :simple, title: "Bar", source_project: project, target_project: project)
+ end
+
+ step 'I should see "Foo" link' do
+ page.should have_link "Foo"
+ end
+
+ step 'I should not see "Bar" link' do
+ page.should_not have_link "Bar"
+ end
+
+ def project
+ @project ||= Project.find_by(name: "Shop")
+ end
+end
diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb
index e3cd5fcfe85..c776af14e04 100644
--- a/features/steps/shared/active_tab.rb
+++ b/features/steps/shared/active_tab.rb
@@ -24,4 +24,24 @@ module SharedActiveTab
And 'no other sub navs should be active' do
page.should have_selector('div.content ul.nav-stacked-menu li.active', count: 1)
end
+
+ step 'the active main tab should be Home' do
+ ensure_active_main_tab('Activity')
+ end
+
+ step 'the active main tab should be Projects' do
+ ensure_active_main_tab('Projects')
+ end
+
+ step 'the active main tab should be Issues' do
+ ensure_active_main_tab('Issues')
+ end
+
+ step 'the active main tab should be Merge Requests' do
+ ensure_active_main_tab('Merge Requests')
+ end
+
+ step 'the active main tab should be Help' do
+ ensure_active_main_tab('Help')
+ end
end
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index 0d06383509f..276947dc060 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -269,6 +269,12 @@ module SharedPaths
visit project_tree_path(@project, "6d39438")
end
+ step 'I visit project source page for' \
+ ' "6d394385cf567f80a8fd85055db1ab4c5295806f"' do
+ visit project_tree_path(@project,
+ '6d394385cf567f80a8fd85055db1ab4c5295806f')
+ end
+
step 'I visit project tags page' do
visit project_tags_path(@project)
end
diff --git a/features/steps/shared/project_tab.rb b/features/steps/shared/project_tab.rb
new file mode 100644
index 00000000000..6aa4f1b20df
--- /dev/null
+++ b/features/steps/shared/project_tab.rb
@@ -0,0 +1,46 @@
+require_relative 'active_tab'
+
+module SharedProjectTab
+ include Spinach::DSL
+ include SharedActiveTab
+
+ step 'the active main tab should be Home' do
+ ensure_active_main_tab('Project')
+ end
+
+ step 'the active main tab should be Files' do
+ ensure_active_main_tab('Files')
+ end
+
+ step 'the active main tab should be Commits' do
+ ensure_active_main_tab('Commits')
+ end
+
+ step 'the active main tab should be Network' do
+ ensure_active_main_tab('Network')
+ end
+
+ step 'the active main tab should be Graphs' do
+ ensure_active_main_tab('Graphs')
+ end
+
+ step 'the active main tab should be Issues' do
+ ensure_active_main_tab('Issues')
+ end
+
+ step 'the active main tab should be Merge Requests' do
+ ensure_active_main_tab('Merge Requests')
+ end
+
+ step 'the active main tab should be Snippets' do
+ ensure_active_main_tab('Snippets')
+ end
+
+ step 'the active main tab should be Wiki' do
+ ensure_active_main_tab('Wiki')
+ end
+
+ step 'the active main tab should be Settings' do
+ ensure_active_main_tab('Settings')
+ end
+end
diff --git a/features/steps/shared/search.rb b/features/steps/shared/search.rb
new file mode 100644
index 00000000000..6c3d601763d
--- /dev/null
+++ b/features/steps/shared/search.rb
@@ -0,0 +1,11 @@
+module SharedSearch
+ include Spinach::DSL
+
+ def search_snippet_contents(query)
+ visit "/search?search=#{URI::encode(query)}&snippets=true&scope=snippet_blobs"
+ end
+
+ def search_snippet_titles(query)
+ visit "/search?search=#{URI::encode(query)}&snippets=true&scope=snippet_titles"
+ end
+end
diff --git a/features/steps/shared/shortcuts.rb b/features/steps/shared/shortcuts.rb
new file mode 100644
index 00000000000..bbb7afec0ad
--- /dev/null
+++ b/features/steps/shared/shortcuts.rb
@@ -0,0 +1,18 @@
+module SharedActiveTab
+ include Spinach::DSL
+
+ step 'I press "g" and "p"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('p')
+ end
+
+ step 'I press "g" and "i"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('i')
+ end
+
+ step 'I press "g" and "m"' do
+ find('body').native.send_key('g')
+ find('body').native.send_key('m')
+ end
+end
diff --git a/features/steps/shared/snippet.rb b/features/steps/shared/snippet.rb
index 543e43196a5..c64299ae6f3 100644
--- a/features/steps/shared/snippet.rb
+++ b/features/steps/shared/snippet.rb
@@ -18,4 +18,27 @@ module SharedSnippet
private: true,
author: current_user)
end
+ And 'I have a public many lined snippet' do
+ create(:personal_snippet,
+ title: 'Many lined snippet',
+ content: <<-END.gsub(/^\s+\|/, ''),
+ |line one
+ |line two
+ |line three
+ |line four
+ |line five
+ |line six
+ |line seven
+ |line eight
+ |line nine
+ |line ten
+ |line eleven
+ |line twelve
+ |line thirteen
+ |line fourteen
+ END
+ file_name: 'many_lined_snippet.rb',
+ private: true,
+ author: current_user)
+ end
end
diff --git a/features/steps/snippet_search.rb b/features/steps/snippet_search.rb
new file mode 100644
index 00000000000..fe03b847c56
--- /dev/null
+++ b/features/steps/snippet_search.rb
@@ -0,0 +1,56 @@
+class Spinach::Features::SnippetSearch < Spinach::FeatureSteps
+ include SharedAuthentication
+ include SharedPaths
+ include SharedSnippet
+ include SharedUser
+ include SharedSearch
+
+ step 'I search for "snippet" in snippet titles' do
+ search_snippet_titles 'snippet'
+ end
+
+ step 'I search for "snippet private" in snippet titles' do
+ search_snippet_titles 'snippet private'
+ end
+
+ step 'I search for "line seven" in snippet contents' do
+ search_snippet_contents 'line seven'
+ end
+
+ step 'I should see "line seven" in results' do
+ page.should have_content 'line seven'
+ end
+
+ step 'I should see "line four" in results' do
+ page.should have_content 'line four'
+ end
+
+ step 'I should see "line ten" in results' do
+ page.should have_content 'line ten'
+ end
+
+ step 'I should not see "line eleven" in results' do
+ page.should_not have_content 'line eleven'
+ end
+
+ step 'I should not see "line three" in results' do
+ page.should_not have_content 'line three'
+ end
+
+ Then 'I should see "Personal snippet one" in results' do
+ page.should have_content 'Personal snippet one'
+ end
+
+ And 'I should see "Personal snippet private" in results' do
+ page.should have_content 'Personal snippet private'
+ end
+
+ Then 'I should not see "Personal snippet one" in results' do
+ page.should_not have_content 'Personal snippet one'
+ end
+
+ And 'I should not see "Personal snippet private" in results' do
+ page.should_not have_content 'Personal snippet private'
+ end
+
+end
diff --git a/lib/api/branches.rb b/lib/api/branches.rb
index b32a4aa7bc2..4db5f61dd28 100644
--- a/lib/api/branches.rb
+++ b/lib/api/branches.rb
@@ -80,9 +80,17 @@ module API
# POST /projects/:id/repository/branches
post ":id/repository/branches" do
authorize_push_project
- @branch = CreateBranchService.new.execute(user_project, params[:branch_name], params[:ref], current_user)
-
- present @branch, with: Entities::RepoObject, project: user_project
+ result = CreateBranchService.new.execute(user_project,
+ params[:branch_name],
+ params[:ref],
+ current_user)
+ if result[:status] == :success
+ present result[:branch],
+ with: Entities::RepoObject,
+ project: user_project
+ else
+ render_api_error!(result[:message], 400)
+ end
end
# Delete branch
@@ -99,7 +107,7 @@ module API
if result[:state] == :success
true
else
- render_api_error!(result[:message], 405)
+ render_api_error!(result[:message], result[:return_code])
end
end
end
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index d36b29a00b1..6af0f6d1b25 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -114,17 +114,21 @@ module API
# Helper method for validating all labels against its names
def validate_label_params(params)
+ errors = {}
+
if params[:labels].present?
params[:labels].split(',').each do |label_name|
label = user_project.labels.create_with(
color: Label::DEFAULT_COLOR).find_or_initialize_by(
title: label_name.strip)
+
if label.invalid?
- return true
+ errors[label.title] = label.errors
end
end
end
- false
+
+ errors
end
# error helpers
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 5850892df07..5f484f63418 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -12,7 +12,9 @@ module API
# ref - branch name
# forced_push - forced_push
#
- get "/allowed" do
+ post "/allowed" do
+ status 200
+
# Check for *.wiki repositories.
# Strip out the .wiki from the pathname before finding the
# project. This applies the correct project permissions to
@@ -34,10 +36,7 @@ module API
actor,
params[:action],
project,
- params[:ref],
- params[:oldrev],
- params[:newrev],
- params[:forced_push]
+ params[:changes]
)
end
diff --git a/lib/api/issues.rb b/lib/api/issues.rb
index 055529ccbd8..5369149cdfc 100644
--- a/lib/api/issues.rb
+++ b/lib/api/issues.rb
@@ -3,13 +3,41 @@ module API
class Issues < Grape::API
before { authenticate! }
+ helpers do
+ def filter_issues_state(issues, state = nil)
+ case state
+ when 'opened' then issues.opened
+ when 'closed' then issues.closed
+ else issues
+ end
+ end
+
+ def filter_issues_labels(issues, labels)
+ issues.includes(:labels).where("labels.title" => labels.split(','))
+ end
+ end
+
resource :issues do
# Get currently authenticated user's issues
#
- # Example Request:
+ # Parameters:
+ # state (optional) - Return "opened" or "closed" issues
+ # labels (optional) - Comma-separated list of label names
+
+ # Example Requests:
# GET /issues
+ # GET /issues?state=opened
+ # GET /issues?state=closed
+ # GET /issues?labels=foo
+ # GET /issues?labels=foo,bar
+ # GET /issues?labels=foo,bar&state=opened
get do
- present paginate(current_user.issues), with: Entities::Issue
+ issues = current_user.issues
+ issues = filter_issues_state(issues, params[:state]) unless params[:state].nil?
+ issues = filter_issues_labels(issues, params[:labels]) unless params[:labels].nil?
+ issues = issues.order('issues.id DESC')
+
+ present paginate(issues), with: Entities::Issue
end
end
@@ -18,10 +46,24 @@ module API
#
# Parameters:
# id (required) - The ID of a project
- # Example Request:
+ # state (optional) - Return "opened" or "closed" issues
+ # labels (optional) - Comma-separated list of label names
+ #
+ # Example Requests:
# GET /projects/:id/issues
+ # GET /projects/:id/issues?state=opened
+ # GET /projects/:id/issues?state=closed
+ # GET /projects/:id/issues
+ # GET /projects/:id/issues?labels=foo
+ # GET /projects/:id/issues?labels=foo,bar
+ # GET /projects/:id/issues?labels=foo,bar&state=opened
get ":id/issues" do
- present paginate(user_project.issues), with: Entities::Issue
+ issues = user_project.issues
+ issues = filter_issues_state(issues, params[:state]) unless params[:state].nil?
+ issues = filter_issues_labels(issues, params[:labels]) unless params[:labels].nil?
+ issues = issues.order('issues.id DESC')
+
+ present paginate(issues), with: Entities::Issue
end
# Get a single project issue
@@ -52,8 +94,8 @@ module API
attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id]
# Validate label names in advance
- if validate_label_params(params)
- return render_api_error!('Label names invalid', 405)
+ if (errors = validate_label_params(params)).any?
+ render_api_error!({ labels: errors }, 400)
end
issue = ::Issues::CreateService.new(user_project, current_user, attrs).execute
@@ -90,8 +132,8 @@ module API
attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id, :state_event]
# Validate label names in advance
- if validate_label_params(params)
- return render_api_error!('Label names invalid', 405)
+ if (errors = validate_label_params(params)).any?
+ render_api_error!({ labels: errors }, 400)
end
issue = ::Issues::UpdateService.new(user_project, current_user, attrs).execute(issue)
@@ -99,7 +141,8 @@ module API
if issue.valid?
# Find or create labels and attach to issue. Labels are valid because
# we already checked its name, so there can't be an error here
- if params[:labels].present?
+ unless params[:labels].nil?
+ issue.remove_labels
# Create and add labels to the new created issue
issue.add_labels_by_names(params[:labels].split(','))
end
diff --git a/lib/api/labels.rb b/lib/api/labels.rb
index d1684b2293c..2fdf53ffec2 100644
--- a/lib/api/labels.rb
+++ b/lib/api/labels.rb
@@ -39,7 +39,7 @@ module API
if label.valid?
present label, with: Entities::Label
else
- render_api_error!(label.errors.full_messages.join(', '), 405)
+ render_api_error!(label.errors.full_messages.join(', '), 400)
end
end
@@ -95,7 +95,7 @@ module API
if label.update(attrs)
present label, with: Entities::Label
else
- render_api_error!(label.errors.full_messages.join(', '), 405)
+ render_api_error!(label.errors.full_messages.join(', '), 400)
end
end
end
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index 0d765f9280e..8726379bf3c 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -78,8 +78,8 @@ module API
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id, :description]
# Validate label names in advance
- if validate_label_params(params)
- return render_api_error!('Label names invalid', 405)
+ if (errors = validate_label_params(params)).any?
+ render_api_error!({ labels: errors }, 400)
end
merge_request = ::MergeRequests::CreateService.new(user_project, current_user, attrs).execute
@@ -117,15 +117,16 @@ module API
authorize! :modify_merge_request, merge_request
# Validate label names in advance
- if validate_label_params(params)
- return render_api_error!('Label names invalid', 405)
+ if (errors = validate_label_params(params)).any?
+ render_api_error!({ labels: errors }, 400)
end
merge_request = ::MergeRequests::UpdateService.new(user_project, current_user, attrs).execute(merge_request)
if merge_request.valid?
# Find or create labels and attach to issue
- if params[:labels].present?
+ unless params[:labels].nil?
+ merge_request.remove_labels
merge_request.add_labels_by_names(params[:labels].split(","))
end
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb
index 42068bb343d..07c29aa7b4c 100644
--- a/lib/api/repositories.rb
+++ b/lib/api/repositories.rb
@@ -32,14 +32,23 @@ module API
# id (required) - The ID of a project
# tag_name (required) - The name of the tag
# ref (required) - Create tag from commit sha or branch
+ # message (optional) - Specifying a message creates an annotated tag.
# Example Request:
# POST /projects/:id/repository/tags
post ':id/repository/tags' do
authorize_push_project
- @tag = CreateTagService.new.execute(user_project, params[:tag_name],
- params[:ref], current_user)
-
- present @tag, with: Entities::RepoObject, project: user_project
+ message = params[:message] || nil
+ result = CreateTagService.new.execute(user_project, params[:tag_name],
+ params[:ref], message,
+ current_user)
+
+ if result[:status] == :success
+ present result[:tag],
+ with: Entities::RepoObject,
+ project: user_project
+ else
+ render_api_error!(result[:message], 400)
+ end
end
# Get a project repository tree
diff --git a/lib/backup/repository.rb b/lib/backup/repository.rb
index 6f7c4f7c909..ea05fa2c261 100644
--- a/lib/backup/repository.rb
+++ b/lib/backup/repository.rb
@@ -69,7 +69,7 @@ module Backup
end
print 'Put GitLab hooks in repositories dirs'.yellow
- if system("#{Gitlab.config.gitlab_shell.path}/support/rewrite-hooks.sh", Gitlab.config.gitlab_shell.repos_path)
+ if system("#{Gitlab.config.gitlab_shell.path}/bin/create-hooks")
puts " [DONE]".green
else
puts " [FAILED]".red
diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb
index 53bff3037e5..907373ab991 100644
--- a/lib/gitlab/backend/shell.rb
+++ b/lib/gitlab/backend/shell.rb
@@ -107,12 +107,17 @@ module Gitlab
# path - project path with namespace
# tag_name - new tag name
# ref - HEAD for new tag
+ # message - optional message for tag (annotated tag)
#
# Ex.
# add_tag("gitlab/gitlab-ci", "v4.0", "master")
+ # add_tag("gitlab/gitlab-ci", "v4.0", "master", "message")
#
- def add_tag(path, tag_name, ref)
- system "#{gitlab_shell_path}/bin/gitlab-projects", "create-tag", "#{path}.git", tag_name, ref
+ def add_tag(path, tag_name, ref, message = nil)
+ cmd = %W(#{gitlab_shell_path}/bin/gitlab-projects create-tag #{path}.git
+ #{tag_name} #{ref})
+ cmd << message unless message.nil? || message.empty?
+ system *cmd
end
# Remove repository tag
diff --git a/lib/gitlab/blacklist.rb b/lib/gitlab/blacklist.rb
index 6bc2c3b487c..43145e0ee1b 100644
--- a/lib/gitlab/blacklist.rb
+++ b/lib/gitlab/blacklist.rb
@@ -3,7 +3,32 @@ module Gitlab
extend self
def path
- %w(admin dashboard files groups help profile projects search public assets u s teams merge_requests issues users snippets services repository hooks notes)
+ %w(
+ admin
+ dashboard
+ files
+ groups
+ help
+ profile
+ projects
+ search
+ public
+ assets
+ u
+ s
+ teams
+ merge_requests
+ issues
+ users
+ snippets
+ services
+ repository
+ hooks
+ notes
+ unsubscribes
+ all
+ ci
+ )
end
end
end
diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb
new file mode 100644
index 00000000000..19a1198c68c
--- /dev/null
+++ b/lib/gitlab/diff/file.rb
@@ -0,0 +1,49 @@
+module Gitlab
+ module Diff
+ class File
+ attr_reader :diff
+
+ delegate :new_file, :deleted_file, :renamed_file,
+ :old_path, :new_path, to: :diff, prefix: false
+
+ def initialize(diff)
+ @diff = diff
+ end
+
+ # Array of Gitlab::DIff::Line objects
+ def diff_lines
+ @lines ||= parser.parse(raw_diff.lines)
+ end
+
+ def mode_changed?
+ !!(diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode)
+ end
+
+ def parser
+ Gitlab::Diff::Parser.new
+ end
+
+ def raw_diff
+ diff.diff
+ end
+
+ def next_line(index)
+ diff_lines[index + 1]
+ end
+
+ def prev_line(index)
+ if index > 0
+ diff_lines[index - 1]
+ end
+ end
+
+ def file_path
+ if diff.new_path.present?
+ diff.new_path
+ elsif diff.old_path.present?
+ diff.old_path
+ end
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/diff/line.rb b/lib/gitlab/diff/line.rb
new file mode 100644
index 00000000000..8ac1b15e88a
--- /dev/null
+++ b/lib/gitlab/diff/line.rb
@@ -0,0 +1,12 @@
+module Gitlab
+ module Diff
+ class Line
+ attr_reader :type, :text, :index, :old_pos, :new_pos
+
+ def initialize(text, type, index, old_pos, new_pos)
+ @text, @type, @index = text, type, index
+ @old_pos, @new_pos = old_pos, new_pos
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/diff/line_code.rb b/lib/gitlab/diff/line_code.rb
new file mode 100644
index 00000000000..f3578ab3d35
--- /dev/null
+++ b/lib/gitlab/diff/line_code.rb
@@ -0,0 +1,9 @@
+module Gitlab
+ module Diff
+ class LineCode
+ def self.generate(file_path, new_line_position, old_line_position)
+ "#{Digest::SHA1.hexdigest(file_path)}_#{old_line_position}_#{new_line_position}"
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/diff/parser.rb b/lib/gitlab/diff/parser.rb
new file mode 100644
index 00000000000..9d6309954a4
--- /dev/null
+++ b/lib/gitlab/diff/parser.rb
@@ -0,0 +1,81 @@
+module Gitlab
+ module Diff
+ class Parser
+ include Enumerable
+
+ def parse(lines)
+ @lines = lines,
+ lines_obj = []
+ line_obj_index = 0
+ line_old = 1
+ line_new = 1
+ type = nil
+
+ lines_arr = ::Gitlab::InlineDiff.processing lines
+
+ lines_arr.each do |line|
+ raw_line = line.dup
+
+ next if filename?(line)
+
+ full_line = html_escape(line.gsub(/\n/, ''))
+ full_line = ::Gitlab::InlineDiff.replace_markers full_line
+
+ if line.match(/^@@ -/)
+ type = "match"
+
+ line_old = line.match(/\-[0-9]*/)[0].to_i.abs rescue 0
+ line_new = line.match(/\+[0-9]*/)[0].to_i.abs rescue 0
+
+ next if line_old == 1 && line_new == 1 #top of file
+ lines_obj << Gitlab::Diff::Line.new(full_line, type, line_obj_index, line_old, line_new)
+ line_obj_index += 1
+ next
+ else
+ type = identification_type(line)
+ lines_obj << Gitlab::Diff::Line.new(full_line, type, line_obj_index, line_old, line_new)
+ line_obj_index += 1
+ end
+
+
+ if line[0] == "+"
+ line_new += 1
+ elsif line[0] == "-"
+ line_old += 1
+ else
+ line_new += 1
+ line_old += 1
+ end
+ end
+
+ lines_obj
+ end
+
+ def empty?
+ @lines.empty?
+ end
+
+ private
+
+ def filename?(line)
+ line.start_with?('--- /dev/null', '+++ /dev/null', '--- a', '+++ b',
+ '--- /tmp/diffy', '+++ /tmp/diffy')
+ end
+
+ def identification_type(line)
+ if line[0] == "+"
+ "new"
+ elsif line[0] == "-"
+ "old"
+ else
+ nil
+ end
+ end
+
+ def html_escape str
+ replacements = { '&' => '&amp;', '>' => '&gt;', '<' => '&lt;', '"' => '&quot;', "'" => '&#39;' }
+ str.gsub(/[&"'><]/, replacements)
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/diff_parser.rb b/lib/gitlab/diff_parser.rb
deleted file mode 100644
index b244295027e..00000000000
--- a/lib/gitlab/diff_parser.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-module Gitlab
- class DiffParser
- include Enumerable
-
- attr_reader :lines, :new_path
-
- def initialize(lines, new_path = '')
- @lines = lines
- @new_path = new_path
- end
-
- def each
- line_old = 1
- line_new = 1
- type = nil
-
- lines_arr = ::Gitlab::InlineDiff.processing lines
- lines_arr.each do |line|
- raw_line = line.dup
-
- next if filename?(line)
-
- full_line = html_escape(line.gsub(/\n/, ''))
- full_line = ::Gitlab::InlineDiff.replace_markers full_line
-
- if line.match(/^@@ -/)
- type = "match"
-
- line_old = line.match(/\-[0-9]*/)[0].to_i.abs rescue 0
- line_new = line.match(/\+[0-9]*/)[0].to_i.abs rescue 0
-
- next if line_old == 1 && line_new == 1 #top of file
- yield(full_line, type, nil, line_new, line_old)
- next
- else
- type = identification_type(line)
- line_code = generate_line_code(new_path, line_new, line_old)
- yield(full_line, type, line_code, line_new, line_old, raw_line)
- end
-
-
- if line[0] == "+"
- line_new += 1
- elsif line[0] == "-"
- line_old += 1
- else
- line_new += 1
- line_old += 1
- end
- end
- end
-
- def empty?
- @lines.empty?
- end
-
- private
-
- def filename?(line)
- line.start_with?('--- /dev/null', '+++ /dev/null', '--- a', '+++ b',
- '--- /tmp/diffy', '+++ /tmp/diffy')
- end
-
- def identification_type(line)
- if line[0] == "+"
- "new"
- elsif line[0] == "-"
- "old"
- else
- nil
- end
- end
-
- def generate_line_code(path, line_new, line_old)
- "#{Digest::SHA1.hexdigest(path)}_#{line_old}_#{line_new}"
- end
-
- def html_escape str
- replacements = { '&' => '&amp;', '>' => '&gt;', '<' => '&lt;', '"' => '&quot;', "'" => '&#39;' }
- str.gsub(/[&"'><]/, replacements)
- end
- end
-end
diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb
index 38b3d82e2f4..e75a5a1d62e 100644
--- a/lib/gitlab/git_access.rb
+++ b/lib/gitlab/git_access.rb
@@ -5,7 +5,7 @@ module Gitlab
attr_reader :params, :project, :git_cmd, :user
- def allowed?(actor, cmd, project, ref = nil, oldrev = nil, newrev = nil, forced_push = false)
+ def allowed?(actor, cmd, project, changes = nil)
case cmd
when *DOWNLOAD_COMMANDS
if actor.is_a? User
@@ -19,12 +19,12 @@ module Gitlab
end
when *PUSH_COMMANDS
if actor.is_a? User
- push_allowed?(actor, project, ref, oldrev, newrev, forced_push)
+ push_allowed?(actor, project, changes)
elsif actor.is_a? DeployKey
# Deploy key not allowed to push
return false
elsif actor.is_a? Key
- push_allowed?(actor.user, project, ref, oldrev, newrev, forced_push)
+ push_allowed?(actor.user, project, changes)
else
raise 'Wrong actor'
end
@@ -41,13 +41,21 @@ module Gitlab
end
end
- def push_allowed?(user, project, ref, oldrev, newrev, forced_push)
- if user && user_allowed?(user)
+ def push_allowed?(user, project, changes)
+ return false unless user && user_allowed?(user)
+ return true if changes.blank?
+
+ changes = changes.lines if changes.kind_of?(String)
+
+ # Iterate over all changes to find if user allowed all of them to be applied
+ changes.each do |change|
+ oldrev, newrev, ref = changes.split('')
+
action = if project.protected_branch?(ref)
# we dont allow force push to protected branch
- if forced_push.to_s == 'true'
+ if forced_push?(oldrev, newrev)
:force_push_code_to_protected_branches
- # and we dont allow remove of protected branch
+ # and we dont allow remove of protected branch
elsif newrev =~ /0000000/
:remove_protected_branches
else
@@ -59,7 +67,22 @@ module Gitlab
else
:push_code
end
- user.can?(action, project)
+ unless user.can?(action, project)
+ # If user does not have access to make at least one change - cancel all push
+ return false
+ end
+ end
+
+ # If user has access to make all changes
+ true
+ end
+
+ def forced_push?(oldrev, newrev)
+ return false if project.empty_repo?
+
+ if oldrev !~ /00000000/ && newrev !~ /00000000/
+ missed_refs = IO.popen(%W(git --git-dir=#{project.repository.path_to_repo} rev-list #{oldrev} ^#{newrev})).read
+ missed_refs.split("\n").size > 0
else
false
end
diff --git a/lib/gitlab/git_ref_validator.rb b/lib/gitlab/git_ref_validator.rb
new file mode 100644
index 00000000000..13cb08948bb
--- /dev/null
+++ b/lib/gitlab/git_ref_validator.rb
@@ -0,0 +1,11 @@
+module Gitlab
+ module GitRefValidator
+ extend self
+ # Validates a given name against the git reference specification
+ #
+ # Returns true for a valid reference name, false otherwise
+ def validate(ref_name)
+ system *%W(git check-ref-format refs/#{ref_name})
+ end
+ end
+end
diff --git a/lib/gitlab/ldap/access.rb b/lib/gitlab/ldap/access.rb
index 62709a12942..c054b6f5865 100644
--- a/lib/gitlab/ldap/access.rb
+++ b/lib/gitlab/ldap/access.rb
@@ -28,7 +28,7 @@ module Gitlab
def allowed?(user)
if Gitlab::LDAP::Person.find_by_dn(user.extern_uid, adapter)
- !Gitlab::LDAP::Person.active_directory_disabled?(user.extern_uid, adapter)
+ !Gitlab::LDAP::Person.disabled_via_active_directory?(user.extern_uid, adapter)
else
false
end
diff --git a/lib/gitlab/ldap/adapter.rb b/lib/gitlab/ldap/adapter.rb
index ca239bea884..68ac1b22909 100644
--- a/lib/gitlab/ldap/adapter.rb
+++ b/lib/gitlab/ldap/adapter.rb
@@ -86,7 +86,8 @@ module Gitlab
end
def dn_matches_filter?(dn, filter)
- ldap_search(base: dn, filter: filter, scope: Net::LDAP::SearchScope_BaseObject, attributes: %w{dn}).any?
+ ldap_search(base: dn, filter: filter,
+ scope: Net::LDAP::SearchScope_BaseObject, attributes: %w{dn}).any?
end
def ldap_search(*args)
diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb
index 9ad6618bd46..87c3d711db4 100644
--- a/lib/gitlab/ldap/person.rb
+++ b/lib/gitlab/ldap/person.rb
@@ -16,7 +16,7 @@ module Gitlab
adapter.user('dn', dn)
end
- def self.active_directory_disabled?(dn, adapter=nil)
+ def self.disabled_via_active_directory?(dn, adapter=nil)
adapter ||= Gitlab::LDAP::Adapter.new
adapter.dn_matches_filter?(dn, AD_USER_DISABLED)
end
diff --git a/lib/gitlab/ldap/user.rb b/lib/gitlab/ldap/user.rb
index be3fcc4f035..25b5a702f9a 100644
--- a/lib/gitlab/ldap/user.rb
+++ b/lib/gitlab/ldap/user.rb
@@ -10,52 +10,20 @@ module Gitlab
module LDAP
class User < Gitlab::OAuth::User
class << self
- def find_or_create(auth)
- @auth = auth
-
- if uid.blank? || email.blank? || username.blank?
- raise_error("Account must provide a dn, uid and email address")
- end
-
- user = find(auth)
-
- unless user
- # Look for user with same emails
- #
- # Possible cases:
- # * When user already has account and need to link their LDAP account.
- # * LDAP uid changed for user with same email and we need to update their uid
- #
- user = find_user(email)
-
- if user
- user.update_attributes(extern_uid: uid, provider: provider)
- log.info("(LDAP) Updating legacy LDAP user #{email} with extern_uid => #{uid}")
- else
- # Create a new user inside GitLab database
- # based on LDAP credentials
- #
- #
- user = create(auth)
- end
- end
-
- user
+ def find_or_create(auth_hash)
+ self.auth_hash = auth_hash
+ find(auth_hash) || find_and_connect_by_email(auth_hash) || create(auth_hash)
end
- def find_user(email)
- user = model.find_by(email: email)
+ def find_and_connect_by_email(auth_hash)
+ self.auth_hash = auth_hash
+ user = model.find_by(email: self.auth_hash.email)
- # If no user found and allow_username_or_email_login is true
- # we look for user by extracting part of their email
- if !user && email && ldap_conf['allow_username_or_email_login']
- uname = email.partition('@').first
- # Strip apostrophes since they are disallowed as part of username
- username = uname.gsub("'", "")
- user = model.find_by(username: username)
+ if user
+ user.update_attributes(extern_uid: auth_hash.uid, provider: auth_hash.provider)
+ Gitlab::AppLogger.info("(LDAP) Updating legacy LDAP user #{self.auth_hash.email} with extern_uid => #{auth_hash.uid}")
+ return user
end
-
- user
end
def authenticate(login, password)
@@ -63,17 +31,8 @@ module Gitlab
# Only check with valid login and password to prevent anonymous bind results
return nil unless ldap_conf.enabled && login.present? && password.present?
- ldap = OmniAuth::LDAP::Adaptor.new(ldap_conf)
- filter = Net::LDAP::Filter.eq(ldap.uid, login)
-
- # Apply LDAP user filter if present
- if ldap_conf['user_filter'].present?
- user_filter = Net::LDAP::Filter.construct(ldap_conf['user_filter'])
- filter = Net::LDAP::Filter.join(filter, user_filter)
- end
-
- ldap_user = ldap.bind_as(
- filter: filter,
+ ldap_user = adapter.bind_as(
+ filter: user_filter(login),
size: 1,
password: password
)
@@ -81,10 +40,14 @@ module Gitlab
find_by_uid(ldap_user.dn) if ldap_user
end
- private
+ def adapter
+ @adapter ||= OmniAuth::LDAP::Adaptor.new(ldap_conf)
+ end
+
+ protected
def find_by_uid_and_provider
- find_by_uid(uid)
+ find_by_uid(auth_hash.uid)
end
def find_by_uid(uid)
@@ -92,10 +55,6 @@ module Gitlab
model.where("provider = ? and lower(extern_uid) = ?", provider, uid.downcase).last
end
- def username
- auth.info.nickname.to_s.force_encoding("utf-8")
- end
-
def provider
'ldap'
end
@@ -107,6 +66,20 @@ module Gitlab
def ldap_conf
Gitlab.config.ldap
end
+
+ def user_filter(login)
+ filter = Net::LDAP::Filter.eq(adapter.uid, login)
+ # Apply LDAP user filter if present
+ if ldap_conf['user_filter'].present?
+ user_filter = Net::LDAP::Filter.construct(ldap_conf['user_filter'])
+ filter = Net::LDAP::Filter.join(filter, user_filter)
+ end
+ filter
+ end
+ end
+
+ def needs_blocking?
+ false
end
end
end
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb
index b248d8f9436..6017a4c86c1 100644
--- a/lib/gitlab/markdown.rb
+++ b/lib/gitlab/markdown.rb
@@ -192,8 +192,12 @@ module Gitlab
link_to("##{identifier}", url, options)
end
- elsif project.issues_tracker == 'jira'
- reference_jira_issue(identifier, project)
+ else
+ config = Gitlab.config
+ external_issue_tracker = config.issues_tracker[project.issues_tracker]
+ if external_issue_tracker.present?
+ reference_external_issue(identifier, external_issue_tracker, project)
+ end
end
end
@@ -229,15 +233,15 @@ module Gitlab
end
end
- def reference_jira_issue(identifier, project = @project)
- url = url_for_issue(identifier)
- title = Gitlab.config.issues_tracker[project.issues_tracker]["title"]
+ def reference_external_issue(identifier, issue_tracker, project = @project)
+ url = url_for_issue(identifier, project)
+ title = issue_tracker['title']
options = html_options.merge(
title: "Issue in #{title}",
class: "gfm gfm-issue #{html_options[:class]}"
)
- link_to("#{identifier}", url, options)
+ link_to("##{identifier}", url, options)
end
end
end
diff --git a/lib/gitlab/oauth/auth_hash.rb b/lib/gitlab/oauth/auth_hash.rb
new file mode 100644
index 00000000000..0198f61f427
--- /dev/null
+++ b/lib/gitlab/oauth/auth_hash.rb
@@ -0,0 +1,54 @@
+# Class to parse and transform the info provided by omniauth
+#
+module Gitlab
+ module OAuth
+ class AuthHash
+ attr_reader :auth_hash
+ def initialize(auth_hash)
+ @auth_hash = auth_hash
+ end
+
+ def uid
+ auth_hash.uid.to_s
+ end
+
+ def provider
+ auth_hash.provider
+ end
+
+ def info
+ auth_hash.info
+ end
+
+ def name
+ (info.name || full_name).to_s.force_encoding('utf-8')
+ end
+
+ def full_name
+ "#{info.first_name} #{info.last_name}"
+ end
+
+ def username
+ (info.try(:nickname) || generate_username).to_s.force_encoding('utf-8')
+ end
+
+ def email
+ (info.try(:email) || generate_temporarily_email).downcase
+ end
+
+ def password
+ @password ||= Devise.friendly_token[0, 8].downcase
+ end
+
+ # Get the first part of the email address (before @)
+ # In addtion in removes illegal characters
+ def generate_username
+ email.match(/^[^@]*/)[0].parameterize
+ end
+
+ def generate_temporarily_email
+ "temp-email-for-oauth-#{username}@gitlab.localhost"
+ end
+ end
+ end
+end
diff --git a/lib/gitlab/oauth/user.rb b/lib/gitlab/oauth/user.rb
index 0056eb3a28b..b768eda185f 100644
--- a/lib/gitlab/oauth/user.rb
+++ b/lib/gitlab/oauth/user.rb
@@ -7,106 +7,78 @@ module Gitlab
module OAuth
class User
class << self
- attr_reader :auth
+ attr_reader :auth_hash
- def find(auth)
- @auth = auth
+ def find(auth_hash)
+ self.auth_hash = auth_hash
find_by_uid_and_provider
end
- def create(auth)
- @auth = auth
- password = Devise.friendly_token[0, 8].downcase
- opts = {
- extern_uid: uid,
- provider: provider,
- name: name,
- username: username,
- email: email,
- password: password,
- password_confirmation: password,
- }
-
- user = model.build_user(opts)
- user.skip_confirmation!
-
- # Services like twitter and github does not return email via oauth
- # In this case we generate temporary email and force user to fill it later
- if user.email.blank?
- user.generate_tmp_oauth_email
- elsif provider != "ldap"
- # Google oauth returns email but dont return nickname
- # So we use part of email as username for new user
- # For LDAP, username is already set to the user's
- # uid/userid/sAMAccountName.
- email_username = email.match(/^[^@]*/)[0]
- # Strip apostrophes since they are disallowed as part of username
- user.username = email_username.gsub("'", "")
- end
-
- begin
- user.save!
- rescue ActiveRecord::RecordInvalid => e
- log.info "(OAuth) Email #{e.record.errors[:email]}. Username #{e.record.errors[:username]}"
- return nil, e.record.errors
- end
-
- log.info "(OAuth) Creating user #{email} from login with extern_uid => #{uid}"
-
- if Gitlab.config.omniauth['block_auto_created_users'] && !ldap?
- user.block
- end
+ def create(auth_hash)
+ user = new(auth_hash)
+ user.save_and_trigger_callbacks
+ end
- user
+ def model
+ ::User
end
- private
+ def auth_hash=(auth_hash)
+ @auth_hash = AuthHash.new(auth_hash)
+ end
+ protected
def find_by_uid_and_provider
- model.where(provider: provider, extern_uid: uid).last
+ model.where(provider: auth_hash.provider, extern_uid: auth_hash.uid).last
end
+ end
- def uid
- uid = auth.info.uid || auth.uid
- uid = uid.to_s unless uid.nil?
- uid
- end
+ # Instance methods
+ attr_accessor :auth_hash, :user
- def email
- auth.info.email.downcase unless auth.info.email.nil?
- end
+ def initialize(auth_hash)
+ self.auth_hash = auth_hash
+ self.user = self.class.model.new(user_attributes)
+ user.skip_confirmation!
+ end
- def name
- if auth.info.name.nil?
- "#{auth.info.first_name} #{auth.info.last_name}".force_encoding('utf-8')
- else
- auth.info.name.to_s.force_encoding('utf-8')
- end
- end
+ def auth_hash=(auth_hash)
+ @auth_hash = AuthHash.new(auth_hash)
+ end
- def username
- auth.info.nickname.to_s.force_encoding("utf-8")
- end
+ def save_and_trigger_callbacks
+ user.save!
+ log.info "(OAuth) Creating user #{auth_hash.email} from login with extern_uid => #{auth_hash.uid}"
+ user.block if needs_blocking?
- def provider
- auth.provider
- end
+ user
+ rescue ActiveRecord::RecordInvalid => e
+ log.info "(OAuth) Email #{e.record.errors[:email]}. Username #{e.record.errors[:username]}"
+ return nil, e.record.errors
+ end
- def log
- Gitlab::AppLogger
- end
+ def user_attributes
+ {
+ extern_uid: auth_hash.uid,
+ provider: auth_hash.provider,
+ name: auth_hash.name,
+ username: auth_hash.username,
+ email: auth_hash.email,
+ password: auth_hash.password,
+ password_confirmation: auth_hash.password,
+ }
+ end
- def model
- ::User
- end
+ def log
+ Gitlab::AppLogger
+ end
- def raise_error(message)
- raise OmniAuth::Error, "(OAuth) " + message
- end
+ def raise_error(message)
+ raise OmniAuth::Error, "(OAuth) " + message
+ end
- def ldap?
- provider == 'ldap'
- end
+ def needs_blocking?
+ Gitlab.config.omniauth['block_auto_created_users']
end
end
end
diff --git a/lib/gitlab/project_search_results.rb b/lib/gitlab/project_search_results.rb
new file mode 100644
index 00000000000..9dc8b34d9c7
--- /dev/null
+++ b/lib/gitlab/project_search_results.rb
@@ -0,0 +1,73 @@
+module Gitlab
+ class ProjectSearchResults < SearchResults
+ attr_reader :project, :repository_ref
+
+ def initialize(project_id, query, repository_ref = nil)
+ @project = Project.find(project_id)
+ @repository_ref = repository_ref
+ @query = Shellwords.shellescape(query) if query.present?
+ end
+
+ def objects(scope, page = nil)
+ case scope
+ when 'notes'
+ notes.page(page).per(per_page)
+ when 'blobs'
+ Kaminari.paginate_array(blobs).page(page).per(per_page)
+ when 'wiki_blobs'
+ Kaminari.paginate_array(wiki_blobs).page(page).per(per_page)
+ else
+ super
+ end
+ end
+
+ def total_count
+ @total_count ||= issues_count + merge_requests_count + blobs_count +
+ notes_count + wiki_blobs_count
+ end
+
+ def blobs_count
+ @blobs_count ||= blobs.count
+ end
+
+ def notes_count
+ @notes_count ||= notes.count
+ end
+
+ def wiki_blobs_count
+ @wiki_blobs_count ||= wiki_blobs.count
+ end
+
+ private
+
+ def blobs
+ if project.empty_repo?
+ []
+ else
+ project.repository.search_files(query, repository_ref)
+ end
+ end
+
+ def wiki_blobs
+ if project.wiki_enabled?
+ wiki_repo = Repository.new(ProjectWiki.new(project).path_with_namespace)
+
+ if wiki_repo.exists?
+ wiki_repo.search_files(query)
+ else
+ []
+ end
+ else
+ []
+ end
+ end
+
+ def notes
+ Note.where(project_id: limit_project_ids).search(query).order('updated_at DESC')
+ end
+
+ def limit_project_ids
+ [project.id]
+ end
+ end
+end
diff --git a/lib/gitlab/satellite/satellite.rb b/lib/gitlab/satellite/satellite.rb
index 7c058b58c4c..f34d661c9fc 100644
--- a/lib/gitlab/satellite/satellite.rb
+++ b/lib/gitlab/satellite/satellite.rb
@@ -121,6 +121,7 @@ module Gitlab
#
# Note: this will only update remote branches (i.e. origin/*)
def update_from_source!
+ repo.git.remote(default_options, 'set-url', :origin, project.repository.path_to_repo)
repo.git.fetch(default_options, :origin)
end
diff --git a/lib/gitlab/search_results.rb b/lib/gitlab/search_results.rb
new file mode 100644
index 00000000000..75a3dfe37c3
--- /dev/null
+++ b/lib/gitlab/search_results.rb
@@ -0,0 +1,69 @@
+module Gitlab
+ class SearchResults
+ attr_reader :query
+
+ # Limit search results by passed project ids
+ # It allows us to search only for projects user has access to
+ attr_reader :limit_project_ids
+
+ def initialize(limit_project_ids, query)
+ @limit_project_ids = limit_project_ids || Project.all
+ @query = Shellwords.shellescape(query) if query.present?
+ end
+
+ def objects(scope, page = nil)
+ case scope
+ when 'projects'
+ projects.page(page).per(per_page)
+ when 'issues'
+ issues.page(page).per(per_page)
+ when 'merge_requests'
+ merge_requests.page(page).per(per_page)
+ else
+ Kaminari.paginate_array([]).page(page).per(per_page)
+ end
+ end
+
+ def total_count
+ @total_count ||= projects_count + issues_count + merge_requests_count
+ end
+
+ def projects_count
+ @projects_count ||= projects.count
+ end
+
+ def issues_count
+ @issues_count ||= issues.count
+ end
+
+ def merge_requests_count
+ @merge_requests_count ||= merge_requests.count
+ end
+
+ def empty?
+ total_count.zero?
+ end
+
+ private
+
+ def projects
+ Project.where(id: limit_project_ids).search(query)
+ end
+
+ def issues
+ Issue.where(project_id: limit_project_ids).full_search(query).order('updated_at DESC')
+ end
+
+ def merge_requests
+ MergeRequest.in_projects(limit_project_ids).full_search(query).order('updated_at DESC')
+ end
+
+ def default_scope
+ 'projects'
+ end
+
+ def per_page
+ 20
+ end
+ end
+end
diff --git a/lib/gitlab/snippet_search_results.rb b/lib/gitlab/snippet_search_results.rb
new file mode 100644
index 00000000000..938219efdb2
--- /dev/null
+++ b/lib/gitlab/snippet_search_results.rb
@@ -0,0 +1,131 @@
+module Gitlab
+ class SnippetSearchResults < SearchResults
+ attr_reader :limit_snippet_ids
+
+ def initialize(limit_snippet_ids, query)
+ @limit_snippet_ids = limit_snippet_ids
+ @query = query
+ end
+
+ def objects(scope, page = nil)
+ case scope
+ when 'snippet_titles'
+ Kaminari.paginate_array(snippet_titles).page(page).per(per_page)
+ when 'snippet_blobs'
+ Kaminari.paginate_array(snippet_blobs).page(page).per(per_page)
+ else
+ super
+ end
+ end
+
+ def total_count
+ @total_count ||= snippet_titles_count + snippet_blobs_count
+ end
+
+ def snippet_titles_count
+ @snippet_titles_count ||= snippet_titles.count
+ end
+
+ def snippet_blobs_count
+ @snippet_blobs_count ||= snippet_blobs.count
+ end
+
+ private
+
+ def snippet_titles
+ Snippet.where(id: limit_snippet_ids).search(query).order('updated_at DESC')
+ end
+
+ def snippet_blobs
+ search = Snippet.where(id: limit_snippet_ids).search_code(query)
+ search = search.order('updated_at DESC').to_a
+ snippets = []
+ search.each { |e| snippets << chunk_snippet(e) }
+ snippets
+ end
+
+ def default_scope
+ 'snippet_blobs'
+ end
+
+ # Get an array of line numbers surrounding a matching
+ # line, bounded by min/max.
+ #
+ # @returns Array of line numbers
+ def bounded_line_numbers(line, min, max)
+ lower = line - surrounding_lines > min ? line - surrounding_lines : min
+ upper = line + surrounding_lines < max ? line + surrounding_lines : max
+ (lower..upper).to_a
+ end
+
+ # Returns a sorted set of lines to be included in a snippet preview.
+ # This ensures matching adjacent lines do not display duplicated
+ # surrounding code.
+ #
+ # @returns Array, unique and sorted.
+ def matching_lines(lined_content)
+ used_lines = []
+ lined_content.each_with_index do |line, line_number|
+ used_lines.concat bounded_line_numbers(
+ line_number,
+ 0,
+ lined_content.size
+ ) if line.include?(query)
+ end
+
+ used_lines.uniq.sort
+ end
+
+ # 'Chunkify' entire snippet. Splits the snippet data into matching lines +
+ # surrounding_lines() worth of unmatching lines.
+ #
+ # @returns a hash with {snippet_object, snippet_chunks:{data,start_line}}
+ def chunk_snippet(snippet)
+ lined_content = snippet.content.split("\n")
+ used_lines = matching_lines(lined_content)
+
+ snippet_chunk = []
+ snippet_chunks = []
+ snippet_start_line = 0
+ last_line = -1
+
+ # Go through each used line, and add consecutive lines as a single chunk
+ # to the snippet chunk array.
+ used_lines.each do |line_number|
+ if last_line < 0
+ # Start a new chunk.
+ snippet_start_line = line_number
+ snippet_chunk << lined_content[line_number]
+ elsif last_line == line_number - 1
+ # Consecutive line, continue chunk.
+ snippet_chunk << lined_content[line_number]
+ else
+ # Non-consecutive line, add chunk to chunk array.
+ snippet_chunks << {
+ data: snippet_chunk.join("\n"),
+ start_line: snippet_start_line + 1
+ }
+
+ # Start a new chunk.
+ snippet_chunk = [lined_content[line_number]]
+ snippet_start_line = line_number
+ end
+ last_line = line_number
+ end
+ # Add final chunk to chunk array
+ snippet_chunks << {
+ data: snippet_chunk.join("\n"),
+ start_line: snippet_start_line + 1
+ }
+
+ # Return snippet with chunk array
+ { snippet_object: snippet, snippet_chunks: snippet_chunks }
+ end
+
+ # Defines how many unmatching lines should be
+ # included around the matching lines in a snippet
+ def surrounding_lines
+ 3
+ end
+ end
+end
diff --git a/lib/gitlab/upgrader.rb b/lib/gitlab/upgrader.rb
index 0846359f9b1..74b049b5143 100644
--- a/lib/gitlab/upgrader.rb
+++ b/lib/gitlab/upgrader.rb
@@ -43,7 +43,7 @@ module Gitlab
end
def latest_version_raw
- remote_tags, _ = Gitlab::Popen.popen(%W(git ls-remote --tags origin))
+ remote_tags, _ = Gitlab::Popen.popen(%W(git ls-remote --tags https://gitlab.com/gitlab-org/gitlab-ce.git))
git_tags = remote_tags.split("\n").grep(/tags\/v#{current_version.major}/)
git_tags = git_tags.select { |version| version =~ /v\d\.\d\.\d\Z/ }
last_tag = git_tags.last.match(/v\d\.\d\.\d/).to_s
diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb
index ea1319268f8..d0b6cde3c7e 100644
--- a/lib/gitlab/visibility_level.rb
+++ b/lib/gitlab/visibility_level.rb
@@ -23,7 +23,21 @@ module Gitlab
end
def allowed_for?(user, level)
- user.is_admin? || !Gitlab.config.gitlab.restricted_visibility_levels.include?(level)
+ user.is_admin? || allowed_level?(level)
+ end
+
+ # Level can be a string `"public"` or a value `20`, first check if valid,
+ # then check if the corresponding string appears in the config
+ def allowed_level?(level)
+ if options.has_key?(level.to_s)
+ non_restricted_level?(level)
+ elsif options.has_value?(level.to_i)
+ non_restricted_level?(options.key(level.to_i).downcase)
+ end
+ end
+
+ def non_restricted_level?(level)
+ ! Gitlab.config.gitlab.restricted_visibility_levels.include?(level)
end
end
diff --git a/lib/support/nginx/gitlab b/lib/support/nginx/gitlab
index 49306fb63da..49a68c62293 100644
--- a/lib/support/nginx/gitlab
+++ b/lib/support/nginx/gitlab
@@ -1,69 +1,85 @@
-# GITLAB
-# Maintainer: @randx
-
-# CHUNKED TRANSFER
-# It is a known issue that Git-over-HTTP requires chunked transfer encoding [0] which is not
-# supported by Nginx < 1.3.9 [1]. As a result, pushing a large object with Git (i.e. a single large file)
-# can lead to a 411 error. In theory you can get around this by tweaking this configuration file and either
-# - installing an old version of Nginx with the chunkin module [2] compiled in, or
-# - using a newer version of Nginx.
-#
-# At the time of writing we do not know if either of these theoretical solutions works. As a workaround
-# users can use Git over SSH to push large files.
-#
-# [0] https://git.kernel.org/cgit/git/git.git/tree/Documentation/technical/http-protocol.txt#n99
-# [1] https://github.com/agentzh/chunkin-nginx-module#status
-# [2] https://github.com/agentzh/chunkin-nginx-module
+## GitLab
+## Maintainer: @randx
+##
+## Lines starting with two hashes (##) are comments with information.
+## Lines starting with one hash (#) are configuration parameters that can be uncommented.
+##
+##################################
+## CHUNKED TRANSFER ##
+##################################
+##
+## It is a known issue that Git-over-HTTP requires chunked transfer encoding [0]
+## which is not supported by Nginx < 1.3.9 [1]. As a result, pushing a large object
+## with Git (i.e. a single large file) can lead to a 411 error. In theory you can get
+## around this by tweaking this configuration file and either:
+## - installing an old version of Nginx with the chunkin module [2] compiled in, or
+## - using a newer version of Nginx.
+##
+## At the time of writing we do not know if either of these theoretical solutions works.
+## As a workaround users can use Git over SSH to push large files.
+##
+## [0] https://git.kernel.org/cgit/git/git.git/tree/Documentation/technical/http-protocol.txt#n99
+## [1] https://github.com/agentzh/chunkin-nginx-module#status
+## [2] https://github.com/agentzh/chunkin-nginx-module
+##
+###################################
+## configuration ##
+###################################
+##
upstream gitlab {
- server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
+ server unix:/home/git/gitlab/tmp/sockets/gitlab.socket fail_timeout=0;
}
+## Normal HTTP host
server {
listen *:80 default_server;
server_name YOUR_SERVER_FQDN; ## Replace this with something like gitlab.example.com
server_tokens off; ## Don't show the nginx version number, a security best practice
root /home/git/gitlab/public;
-
- # Increase this if you want to upload large attachments
- # Or if you want to accept large git objects over http
+
+ ## Increase this if you want to upload large attachments
+ ## Or if you want to accept large git objects over http
client_max_body_size 20m;
- # individual nginx logs for this gitlab vhost
+ ## Individual nginx logs for this GitLab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location / {
- # serve static files from defined root folder;.
- # @gitlab is a named location for the upstream fallback, see below
+ ## Serve static files from defined root folder.
+ ## @gitlab is a named location for the upstream fallback, see below.
try_files $uri $uri/index.html $uri.html @gitlab;
}
- # if a file, which is not found in the root folder is requested,
- # then the proxy pass the request to the upsteam (gitlab unicorn)
+ ## If a file, which is not found in the root folder is requested,
+ ## then the proxy passes the request to the upsteam (gitlab unicorn).
location @gitlab {
- # If you use https make sure you disable gzip compression
- # to be safe against BREACH attack
+ ## If you use HTTPS make sure you disable gzip compression
+ ## to be safe against BREACH attack.
# gzip off;
- proxy_read_timeout 300; # Some requests take more than 30 seconds.
- proxy_connect_timeout 300; # Some requests take more than 30 seconds.
- proxy_redirect off;
+ ## https://github.com/gitlabhq/gitlabhq/issues/694
+ ## Some requests take more than 30 seconds.
+ proxy_read_timeout 300;
+ proxy_connect_timeout 300;
+ proxy_redirect off;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_set_header Host $http_host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Frame-Options SAMEORIGIN;
+ proxy_set_header Host $http_host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://gitlab;
}
- # Enable gzip compression as per rails guide: http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
- # WARNING: If you are using relative urls do remove the block below
- # See config/application.rb under "Relative url support" for the list of
- # other files that need to be changed for relative url support
- location ~ ^/(assets)/ {
+ ## Enable gzip compression as per rails guide:
+ ## http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
+ ## WARNING: If you are using relative urls remove the block below
+ ## See config/application.rb under "Relative url support" for the list of
+ ## other files that need to be changed for relative url support
+ location ~ ^/(assets)/ {
root /home/git/gitlab/public;
gzip_static on; # to serve pre-gzipped version
expires max;
diff --git a/lib/support/nginx/gitlab-ssl b/lib/support/nginx/gitlab-ssl
index 54a4a080a9f..19409e41f40 100644
--- a/lib/support/nginx/gitlab-ssl
+++ b/lib/support/nginx/gitlab-ssl
@@ -6,8 +6,7 @@
## Modified from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
##
## Lines starting with two hashes (##) are comments with information.
-## Lines starting with one hash (#) are configuration parameters.
-## The last category can be commented/uncommented to your liking.
+## Lines starting with one hash (#) are configuration parameters that can be uncommented.
##
##################################
## CHUNKED TRANSFER ##
@@ -20,44 +19,36 @@
## - installing an old version of Nginx with the chunkin module [2] compiled in, or
## - using a newer version of Nginx.
##
-## At the time of writing we do not know if either of these theoretical solutions works. As a workaround
-## users can use Git over SSH to push large files.
+## At the time of writing we do not know if either of these theoretical solutions works.
+## As a workaround users can use Git over SSH to push large files.
##
## [0] https://git.kernel.org/cgit/git/git.git/tree/Documentation/technical/http-protocol.txt#n99
## [1] https://github.com/agentzh/chunkin-nginx-module#status
## [2] https://github.com/agentzh/chunkin-nginx-module
##
-###################################
-## SSL file editing ##
-###################################
-##
-## Edit `gitlab-shell/config.yml`:
-## 1) Set "gitlab_url" param in `gitlab-shell/config.yml` to `https://git.example.com`
-## 2) Set "ca_file" to `/etc/nginx/ssl/gitlab.crt`
-## 3) Set "self_signed_cert" to `true`
-## Edit `gitlab/config/gitlab.yml`:
-## 1) Define port for http "port: 443"
-## 2) Enable https "https: true"
-## 3) Update ssl for gravatar "ssl_url: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm"
##
###################################
## SSL configuration ##
###################################
##
+## See installation.md#using-https for additional HTTPS configuration details.
upstream gitlab {
- server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
+ server unix:/home/git/gitlab/tmp/sockets/gitlab.socket fail_timeout=0;
}
-## This is a normal HTTP host which redirects all traffic to the HTTPS host.
+## Normal HTTP host
server {
listen *:80 default_server;
server_name YOUR_SERVER_FQDN; ## Replace this with something like gitlab.example.com
server_tokens off; ## Don't show the nginx version number, a security best practice
+
+ ## Redirects all traffic to the HTTPS host
root /nowhere; ## root doesn't have to be a valid path since we are redirecting
- rewrite ^ https://$server_name$request_uri permanent;
+ rewrite ^ https://$server_name$request_uri? permanent;
}
+## HTTPS host
server {
listen 443 ssl;
server_name YOUR_SERVER_FQDN; ## Replace this with something like gitlab.example.com
@@ -74,7 +65,7 @@ server {
ssl_certificate /etc/nginx/ssl/gitlab.crt;
ssl_certificate_key /etc/nginx/ssl/gitlab.key;
- ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4';
+ ssl_ciphers 'AES256+EECDH:AES256+EDH';
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_cache builtin:1000 shared:SSL:10m;
@@ -82,9 +73,26 @@ server {
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security max-age=63072000;
- add_header X-Frame-Options DENY;
+ add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
+ ## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL.
+ ## Replace with your ssl_trusted_certificate. For more info see:
+ ## - https://medium.com/devops-programming/4445f4862461
+ ## - https://www.ruby-forum.com/topic/4419319
+ ## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
+ # ssl_stapling on;
+ # ssl_stapling_verify on;
+ # ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt;
+ # resolver 208.67.222.222 208.67.222.220 valid=300s; # Can change to your DNS resolver if desired
+ # resolver_timeout 10s;
+
+ ## [Optional] Generate a stronger DHE parameter:
+ ## cd /etc/ssl/certs
+ ## sudo openssl dhparam -out dhparam.pem 4096
+ ##
+ # ssl_dhparam /etc/ssl/certs/dhparam.pem;
+
## Individual nginx logs for this GitLab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
@@ -96,10 +104,9 @@ server {
}
## If a file, which is not found in the root folder is requested,
- ## then the proxy pass the request to the upsteam (gitlab unicorn).
+ ## then the proxy passes the request to the upsteam (gitlab unicorn).
location @gitlab {
-
- ## If you use https make sure you disable gzip compression
+ ## If you use HTTPS make sure you disable gzip compression
## to be safe against BREACH attack.
gzip off;
@@ -121,7 +128,7 @@ server {
## Enable gzip compression as per rails guide:
## http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
- ## WARNING: If you are using relative urls do remove the block below
+ ## WARNING: If you are using relative urls remove the block below
## See config/application.rb under "Relative url support" for the list of
## other files that need to be changed for relative url support
location ~ ^/(assets)/ {
diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake
index 032ed5ee370..9ea5c55abd6 100644
--- a/lib/tasks/gitlab/check.rake
+++ b/lib/tasks/gitlab/check.rake
@@ -322,7 +322,7 @@ namespace :gitlab do
"core.autocrlf" => "input"
}
correct_options = options.map do |name, value|
- run(%W(git config --global --get #{name})).try(:squish) == value
+ run(%W(#{Gitlab.config.git.bin_path} config --global --get #{name})).try(:squish) == value
end
if correct_options.all?
@@ -330,9 +330,9 @@ namespace :gitlab do
else
puts "no".red
try_fixing_it(
- sudo_gitlab("git config --global user.name \"#{options["user.name"]}\""),
- sudo_gitlab("git config --global user.email \"#{options["user.email"]}\""),
- sudo_gitlab("git config --global core.autocrlf \"#{options["core.autocrlf"]}\"")
+ sudo_gitlab("\"#{Gitlab.config.git.bin_path}\" config --global user.name \"#{options["user.name"]}\""),
+ sudo_gitlab("\"#{Gitlab.config.git.bin_path}\" config --global user.email \"#{options["user.email"]}\""),
+ sudo_gitlab("\"#{Gitlab.config.git.bin_path}\" config --global core.autocrlf \"#{options["core.autocrlf"]}\"")
)
for_more_information(
see_installation_guide_section "GitLab"
@@ -541,7 +541,7 @@ namespace :gitlab do
"sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
)
for_more_information(
- "#{gitlab_shell_path}/support/rewrite-hooks.sh"
+ "#{gitlab_shell_path}/bin/create-hooks"
)
fix_and_rerun
next
@@ -556,7 +556,7 @@ namespace :gitlab do
"sudo -u #{gitlab_shell_ssh_user} ln -sf #{gitlab_shell_hook_file} #{project_hook_file}"
)
for_more_information(
- "lib/support/rewrite-hooks.sh"
+ "#{gitlab_shell_path}/bin/create-hooks"
)
fix_and_rerun
end
diff --git a/lib/tasks/gitlab/shell.rake b/lib/tasks/gitlab/shell.rake
index ff27e6a3066..ece3ad58385 100644
--- a/lib/tasks/gitlab/shell.rake
+++ b/lib/tasks/gitlab/shell.rake
@@ -8,7 +8,7 @@ namespace :gitlab do
args.with_defaults(tag: 'v' + default_version, repo: "https://gitlab.com/gitlab-org/gitlab-shell.git")
user = Settings.gitlab.user
- home_dir = Settings.gitlab.user_home
+ home_dir = Rails.env.test? ? Rails.root.join('tmp/tests') : Settings.gitlab.user_home
gitlab_url = Settings.gitlab.url
# gitlab-shell requires a / at the end of the url
gitlab_url += "/" unless gitlab_url.match(/\/$/)
diff --git a/lib/tasks/gitlab/sidekiq.rake b/lib/tasks/gitlab/sidekiq.rake
new file mode 100644
index 00000000000..7e2a6668e59
--- /dev/null
+++ b/lib/tasks/gitlab/sidekiq.rake
@@ -0,0 +1,47 @@
+namespace :gitlab do
+ namespace :sidekiq do
+ QUEUE = 'queue:post_receive'
+
+ desc 'Drop all Sidekiq PostReceive jobs for a given project'
+ task :drop_post_receive , [:project] => :environment do |t, args|
+ unless args.project.present?
+ abort "Please specify the project you want to drop PostReceive jobs for:\n rake gitlab:sidekiq:drop_post_receive[group/project]"
+ end
+ project_path = Project.find_with_namespace(args.project).repository.path_to_repo
+
+ Sidekiq.redis do |redis|
+ unless redis.exists(QUEUE)
+ abort "Queue #{QUEUE} is empty"
+ end
+
+ temp_queue = "#{QUEUE}_#{Time.now.to_i}"
+ redis.rename(QUEUE, temp_queue)
+
+ # At this point, then post_receive queue is empty. It may be receiving
+ # new jobs already. We will repopulate it with the old jobs, skipping the
+ # ones we want to drop.
+ dropped = 0
+ while (job = redis.lpop(temp_queue)) do
+ if repo_path(job) == project_path
+ dropped += 1
+ else
+ redis.rpush(QUEUE, job)
+ end
+ end
+ # The temp_queue will delete itself after we have popped all elements
+ # from it
+
+ puts "Dropped #{dropped} jobs containing #{project_path} from #{QUEUE}"
+ end
+ end
+
+ def repo_path(job)
+ job_args = JSON.parse(job)['args']
+ if job_args
+ job_args.first
+ else
+ nil
+ end
+ end
+ end
+end
diff --git a/spec/factories.rb b/spec/factories.rb
index 03c87fcc6c5..f7f65bffb8b 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -165,7 +165,6 @@ FactoryGirl.define do
factory :service do
type ""
title "GitLab CI"
- token "x56olispAND34ng"
project
end
diff --git a/spec/factories/label_links.rb b/spec/factories/label_links.rb
index d6b6f8581f6..bd304b5db6b 100644
--- a/spec/factories/label_links.rb
+++ b/spec/factories/label_links.rb
@@ -1,3 +1,15 @@
+# == Schema Information
+#
+# Table name: label_links
+#
+# id :integer not null, primary key
+# label_id :integer
+# target_id :integer
+# target_type :string(255)
+# created_at :datetime
+# updated_at :datetime
+#
+
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
diff --git a/spec/factories/labels.rb b/spec/factories/labels.rb
index af9f3efa641..6829387c660 100644
--- a/spec/factories/labels.rb
+++ b/spec/factories/labels.rb
@@ -1,3 +1,15 @@
+# == Schema Information
+#
+# Table name: labels
+#
+# id :integer not null, primary key
+# title :string(255)
+# color :string(255)
+# project_id :integer
+# created_at :datetime
+# updated_at :datetime
+#
+
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
diff --git a/spec/factories/merge_requests.rb b/spec/factories/merge_requests.rb
index 3319262c015..0ae8ea5f878 100644
--- a/spec/factories/merge_requests.rb
+++ b/spec/factories/merge_requests.rb
@@ -1,3 +1,25 @@
+# == Schema Information
+#
+# Table name: merge_requests
+#
+# id :integer not null, primary key
+# target_branch :string(255) not null
+# source_branch :string(255) not null
+# source_project_id :integer not null
+# author_id :integer
+# assignee_id :integer
+# title :string(255)
+# created_at :datetime
+# updated_at :datetime
+# milestone_id :integer
+# state :string(255)
+# merge_status :string(255)
+# target_project_id :integer not null
+# iid :integer
+# description :text
+# position :integer default(0)
+#
+
FactoryGirl.define do
factory :merge_request do
title
diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb
index a55ccf289dd..83d0cc62dbf 100644
--- a/spec/factories/notes.rb
+++ b/spec/factories/notes.rb
@@ -1,3 +1,22 @@
+# == Schema Information
+#
+# Table name: notes
+#
+# id :integer not null, primary key
+# note :text
+# noteable_type :string(255)
+# author_id :integer
+# created_at :datetime
+# updated_at :datetime
+# project_id :integer
+# attachment :string(255)
+# line_code :string(255)
+# commit_id :string(255)
+# noteable_id :integer
+# system :boolean default(FALSE), not null
+# st_diff :text
+#
+
require_relative '../support/repo_helpers'
FactoryGirl.define do
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb
index 353d9d645ef..5324654c48c 100644
--- a/spec/factories/projects.rb
+++ b/spec/factories/projects.rb
@@ -1,3 +1,31 @@
+# == Schema Information
+#
+# Table name: projects
+#
+# id :integer not null, primary key
+# name :string(255)
+# path :string(255)
+# description :text
+# created_at :datetime
+# updated_at :datetime
+# creator_id :integer
+# issues_enabled :boolean default(TRUE), not null
+# wall_enabled :boolean default(TRUE), not null
+# merge_requests_enabled :boolean default(TRUE), not null
+# wiki_enabled :boolean default(TRUE), not null
+# namespace_id :integer
+# issues_tracker :string(255) default("gitlab"), not null
+# issues_tracker_id :string(255)
+# snippets_enabled :boolean default(TRUE), not null
+# last_activity_at :datetime
+# import_url :string(255)
+# visibility_level :integer default(0), not null
+# archived :boolean default(FALSE), not null
+# import_status :string(255)
+# repository_size :float default(0.0)
+# star_count :integer default(0), not null
+#
+
FactoryGirl.define do
factory :empty_project, class: 'Project' do
sequence(:name) { |n| "project#{n}" }
diff --git a/spec/helpers/diff_helper_spec.rb b/spec/helpers/diff_helper_spec.rb
new file mode 100644
index 00000000000..4ab415b4ef3
--- /dev/null
+++ b/spec/helpers/diff_helper_spec.rb
@@ -0,0 +1,98 @@
+require 'spec_helper'
+
+describe DiffHelper do
+ include RepoHelpers
+
+ let(:project) { create(:project) }
+ let(:commit) { project.repository.commit(sample_commit.id) }
+ let(:diff) { commit.diffs.first }
+ let(:diff_file) { Gitlab::Diff::File.new(diff) }
+
+ describe 'diff_hard_limit_enabled?' do
+ it 'should return true if param is provided' do
+ controller.stub(:params).and_return { { :force_show_diff => true } }
+ diff_hard_limit_enabled?.should be_true
+ end
+
+ it 'should return false if param is not provided' do
+ diff_hard_limit_enabled?.should be_false
+ end
+ end
+
+ describe 'allowed_diff_size' do
+ it 'should return hard limit for a diff if force diff is true' do
+ controller.stub(:params).and_return { { :force_show_diff => true } }
+ allowed_diff_size.should eq(1000)
+ end
+
+ it 'should return safe limit for a diff if force diff is false' do
+ allowed_diff_size.should eq(100)
+ end
+ end
+
+ describe 'parallel_diff' do
+ it 'should return an array of arrays containing the parsed diff' do
+ parallel_diff(diff_file, 0).should match_array(parallel_diff_result_array)
+ end
+ end
+
+ describe 'generate_line_code' do
+ it 'should generate correct line code' do
+ generate_line_code(diff_file.file_path, diff_file.diff_lines.first).should == '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6'
+ end
+ end
+
+ describe 'unfold_bottom_class' do
+ it 'should return empty string when bottom line shouldnt be unfolded' do
+ unfold_bottom_class(false).should == ''
+ end
+
+ it 'should return js class when bottom lines should be unfolded' do
+ unfold_bottom_class(true).should == 'js-unfold-bottom'
+ end
+ end
+
+ describe 'diff_line_content' do
+
+ it 'should return non breaking space when line is empty' do
+ diff_line_content(nil).should eq(" &nbsp;")
+ end
+
+ it 'should return the line itself' do
+ diff_line_content(diff_file.diff_lines.first.text).should eq("@@ -6,12 +6,18 @@ module Popen")
+ diff_line_content(diff_file.diff_lines.first.type).should eq("match")
+ diff_line_content(diff_file.diff_lines.first.new_pos).should eq(6)
+ end
+ end
+
+ def parallel_diff_result_array
+ [
+ ["match", 6, "@@ -6,12 +6,18 @@ module Popen", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6", "match", 6, "@@ -6,12 +6,18 @@ module Popen"],
+ [nil, 6, " ", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6", nil, 6, " "],
+ [nil, 7, " def popen(cmd, path=nil)", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7", nil, 7, " def popen(cmd, path=nil)"],
+ [nil, 8, " unless cmd.is_a?(Array)", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_8_8", nil, 8, " unless cmd.is_a?(Array)"],
+ ["old", 9, "- raise <span class='idiff'></span>&quot;System commands must be given as an array of strings&quot;", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_9_9", "new", 9, "+ raise <span class='idiff'>RuntimeError, </span>&quot;System commands must be given as an array of strings&quot;"],
+ [nil, 10, " end", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_10", nil, 10, " end"], [nil, 11, " ", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_11_11", nil, 11, " "],
+ [nil, 12, " path ||= Dir.pwd", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_12_12", nil, 12, " path ||= Dir.pwd"],
+ ["old", 13, "- vars = { &quot;PWD&quot; =&gt; path }", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_13_13", "old", nil, "&nbsp;"],
+ ["old", 14, "- options = { chdir: path }", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_14_13", "new", 13, "+"],
+ [nil, nil, "&nbsp;", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_14", "new", 14, "+ vars = {"],
+ [nil, nil, "&nbsp;", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_15", "new", 15, "+ &quot;PWD&quot; =&gt; path"],
+ [nil, nil, "&nbsp;", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_16", "new", 16, "+ }"],
+ [nil, nil, "&nbsp;", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_17", "new", 17, "+"],
+ [nil, nil, "&nbsp;", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_18", "new", 18, "+ options = {"],
+ [nil, nil, "&nbsp;", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_19", "new", 19, "+ chdir: path"],
+ [nil, nil, "&nbsp;", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_20", "new", 20, "+ }"],
+ [nil, 15, " ", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_21", nil, 21, " "],
+ [nil, 16, " unless File.directory?(path)", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_16_22", nil, 22, " unless File.directory?(path)"],
+ [nil, 17, " FileUtils.mkdir_p(path)", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_17_23", nil, 23, " FileUtils.mkdir_p(path)"],
+ ["match", 19, "@@ -19,6 +25,7 @@ module Popen", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25", "match", 25, "@@ -19,6 +25,7 @@ module Popen"],
+ [nil, 19, " ", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25", nil, 25, " "], [nil, 20, " @cmd_output = &quot;&quot;", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_20_26", nil, 26, " @cmd_output = &quot;&quot;"],
+ [nil, 21, " @cmd_status = 0", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_21_27", nil, 27, " @cmd_status = 0"],
+ [nil, nil, "&nbsp;", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_22_28", "new", 28, "+"],
+ [nil, 22, " Open3.popen3(vars, *cmd, options) do |stdin, stdout, stderr, wait_thr|", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_22_29", nil, 29, " Open3.popen3(vars, *cmd, options) do |stdin, stdout, stderr, wait_thr|"],
+ [nil, 23, " @cmd_output &lt;&lt; stdout.read", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_23_30", nil, 30, " @cmd_output &lt;&lt; stdout.read"],
+ [nil, 24, " @cmd_output &lt;&lt; stderr.read", "2f6fcd96b88b36ce98c38da085c795a27d92a3dd_24_31", nil, 31, " @cmd_output &lt;&lt; stderr.read"]
+ ]
+ end
+end
diff --git a/spec/lib/auth_spec.rb b/spec/lib/auth_spec.rb
deleted file mode 100644
index 073b811c3fb..00000000000
--- a/spec/lib/auth_spec.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-require 'spec_helper'
-
-describe Gitlab::Auth do
- let(:gl_auth) { Gitlab::Auth.new }
-
- describe :find do
- before do
- @user = create(
- :user,
- username: 'john',
- password: '88877711',
- password_confirmation: '88877711'
- )
- end
-
- it "should find user by valid login/password" do
- gl_auth.find('john', '88877711').should == @user
- end
-
- it "should not find user with invalid password" do
- gl_auth.find('john', 'invalid11').should_not == @user
- end
-
- it "should not find user with invalid login and password" do
- gl_auth.find('jon', 'invalid11').should_not == @user
- end
- end
-end
diff --git a/spec/lib/git_ref_validator_spec.rb b/spec/lib/git_ref_validator_spec.rb
new file mode 100644
index 00000000000..b2469c18395
--- /dev/null
+++ b/spec/lib/git_ref_validator_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe Gitlab::GitRefValidator do
+ it { Gitlab::GitRefValidator.validate('feature/new').should be_true }
+ it { Gitlab::GitRefValidator.validate('implement_@all').should be_true }
+ it { Gitlab::GitRefValidator.validate('my_new_feature').should be_true }
+ it { Gitlab::GitRefValidator.validate('#1').should be_true }
+ it { Gitlab::GitRefValidator.validate('feature/~new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/^new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/:new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/?new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/*new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/[new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/new/').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature/new.').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature\@{').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature\new').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature//new').should be_false }
+ it { Gitlab::GitRefValidator.validate('feature new').should be_false }
+end
diff --git a/spec/lib/gitlab/auth_spec.rb b/spec/lib/gitlab/auth_spec.rb
new file mode 100644
index 00000000000..551fb3fb5f6
--- /dev/null
+++ b/spec/lib/gitlab/auth_spec.rb
@@ -0,0 +1,47 @@
+require 'spec_helper'
+
+describe Gitlab::Auth do
+ let(:gl_auth) { Gitlab::Auth.new }
+
+ describe :find do
+ let!(:user) do
+ create(:user,
+ username: username,
+ password: password,
+ password_confirmation: password)
+ end
+ let(:username) { 'john' }
+ let(:password) { 'my-secret' }
+
+ it "should find user by valid login/password" do
+ expect( gl_auth.find(username, password) ).to eql user
+ end
+
+ it "should not find user with invalid password" do
+ password = 'wrong'
+ expect( gl_auth.find(username, password) ).to_not eql user
+ end
+
+ it "should not find user with invalid login" do
+ user = 'wrong'
+ expect( gl_auth.find(username, password) ).to_not eql user
+ end
+
+ context "with ldap enabled" do
+ before { Gitlab.config.ldap['enabled'] = true }
+ after { Gitlab.config.ldap['enabled'] = false }
+
+ it "tries to autheticate with db before ldap" do
+ expect(Gitlab::LDAP::User).not_to receive(:authenticate)
+
+ gl_auth.find(username, password)
+ end
+
+ it "uses ldap as fallback to for authentication" do
+ expect(Gitlab::LDAP::User).to receive(:authenticate)
+
+ gl_auth.find('ldap_user', 'password')
+ end
+ end
+ end
+end
diff --git a/spec/lib/gitlab/diff/file_spec.rb b/spec/lib/gitlab/diff/file_spec.rb
new file mode 100644
index 00000000000..cf0b5c282c1
--- /dev/null
+++ b/spec/lib/gitlab/diff/file_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe Gitlab::Diff::File do
+ include RepoHelpers
+
+ let(:project) { create(:project) }
+ let(:commit) { project.repository.commit(sample_commit.id) }
+ let(:diff) { commit.diffs.first }
+ let(:diff_file) { Gitlab::Diff::File.new(diff) }
+
+ describe :diff_lines do
+ let(:diff_lines) { diff_file.diff_lines }
+
+ it { diff_lines.size.should == 30 }
+ it { diff_lines.first.should be_kind_of(Gitlab::Diff::Line) }
+ end
+
+ describe :mode_changed? do
+ it { diff_file.mode_changed?.should be_false }
+ end
+end
diff --git a/spec/lib/gitlab/diff/parser_spec.rb b/spec/lib/gitlab/diff/parser_spec.rb
new file mode 100644
index 00000000000..35b78260acd
--- /dev/null
+++ b/spec/lib/gitlab/diff/parser_spec.rb
@@ -0,0 +1,93 @@
+require 'spec_helper'
+
+describe Gitlab::Diff::Parser do
+ include RepoHelpers
+
+ let(:project) { create(:project) }
+ let(:commit) { project.repository.commit(sample_commit.id) }
+ let(:diff) { commit.diffs.first }
+ let(:parser) { Gitlab::Diff::Parser.new }
+
+ describe :parse do
+ let(:diff) do
+ <<eos
+--- a/files/ruby/popen.rb
++++ b/files/ruby/popen.rb
+@@ -6,12 +6,18 @@ module Popen
+
+ def popen(cmd, path=nil)
+ unless cmd.is_a?(Array)
+- raise "System commands must be given as an array of strings"
++ raise RuntimeError, "System commands must be given as an array of strings"
+ end
+
+ path ||= Dir.pwd
+- vars = { "PWD" => path }
+- options = { chdir: path }
++
++ vars = {
++ "PWD" => path
++ }
++
++ options = {
++ chdir: path
++ }
+
+ unless File.directory?(path)
+ FileUtils.mkdir_p(path)
+@@ -19,6 +25,7 @@ module Popen
+
+ @cmd_output = ""
+ @cmd_status = 0
++
+ Open3.popen3(vars, *cmd, options) do |stdin, stdout, stderr, wait_thr|
+ @cmd_output << stdout.read
+ @cmd_output << stderr.read
+eos
+ end
+
+ before do
+ @lines = parser.parse(diff.lines)
+ end
+
+ it { @lines.size.should == 30 }
+
+ describe 'lines' do
+ describe 'first line' do
+ let(:line) { @lines.first }
+
+ it { line.type.should == 'match' }
+ it { line.old_pos.should == 6 }
+ it { line.new_pos.should == 6 }
+ it { line.text.should == '@@ -6,12 +6,18 @@ module Popen' }
+ end
+
+ describe 'removal line' do
+ let(:line) { @lines[10] }
+
+ it { line.type.should == 'old' }
+ it { line.old_pos.should == 14 }
+ it { line.new_pos.should == 13 }
+ it { line.text.should == '- options = { chdir: path }' }
+ end
+
+ describe 'addition line' do
+ let(:line) { @lines[16] }
+
+ it { line.type.should == 'new' }
+ it { line.old_pos.should == 15 }
+ it { line.new_pos.should == 18 }
+ it { line.text.should == '+ options = {' }
+ end
+
+ describe 'unchanged line' do
+ let(:line) { @lines.last }
+
+ it { line.type.should == nil }
+ it { line.old_pos.should == 24 }
+ it { line.new_pos.should == 31 }
+ it { line.text.should == ' @cmd_output &lt;&lt; stderr.read' }
+ end
+ end
+ end
+end
diff --git a/spec/lib/gitlab/ldap/ldap_access_spec.rb b/spec/lib/gitlab/ldap/access_spec.rb
index d8c107502ba..2307a03f656 100644
--- a/spec/lib/gitlab/ldap/ldap_access_spec.rb
+++ b/spec/lib/gitlab/ldap/access_spec.rb
@@ -16,14 +16,14 @@ describe Gitlab::LDAP::Access do
context 'when the user is found' do
before { Gitlab::LDAP::Person.stub(find_by_dn: :ldap_user) }
- context 'and the Active Directory disabled flag is set' do
- before { Gitlab::LDAP::Person.stub(active_directory_disabled?: true) }
+ context 'and the user is diabled via active directory' do
+ before { Gitlab::LDAP::Person.stub(disabled_via_active_directory?: true) }
it { should be_false }
end
- context 'and the Active Directory disabled flag is not set' do
- before { Gitlab::LDAP::Person.stub(active_directory_disabled?: false) }
+ context 'and has no disabled flag in active diretory' do
+ before { Gitlab::LDAP::Person.stub(disabled_via_active_directory?: false) }
it { should be_true }
end
diff --git a/spec/lib/gitlab/ldap/ldap_adapter_spec.rb b/spec/lib/gitlab/ldap/adapter_spec.rb
index c3f07334431..c3f07334431 100644
--- a/spec/lib/gitlab/ldap/ldap_adapter_spec.rb
+++ b/spec/lib/gitlab/ldap/adapter_spec.rb
diff --git a/spec/lib/gitlab/ldap/ldap_user_auth_spec.rb b/spec/lib/gitlab/ldap/ldap_user_auth_spec.rb
deleted file mode 100644
index 501642dca79..00000000000
--- a/spec/lib/gitlab/ldap/ldap_user_auth_spec.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-require 'spec_helper'
-
-describe Gitlab::LDAP do
- let(:gl_auth) { Gitlab::LDAP::User }
-
- before do
- Gitlab.config.stub(omniauth: {})
-
- @info = double(
- uid: '12djsak321',
- name: 'John',
- email: 'john@mail.com',
- nickname: 'john'
- )
- end
-
- describe :find_for_ldap_auth do
- before do
- @auth = double(
- uid: '12djsak321',
- info: @info,
- provider: 'ldap'
- )
- end
-
- it "should update credentials by email if missing uid" do
- user = double('User')
- User.stub find_by_extern_uid_and_provider: nil
- User.stub(:find_by).with(hash_including(email: anything())) { user }
- user.should_receive :update_attributes
- gl_auth.find_or_create(@auth)
- end
-
- it "should update credentials by username if missing uid and Gitlab.config.ldap.allow_username_or_email_login is true" do
- user = double('User')
- value = Gitlab.config.ldap.allow_username_or_email_login
- Gitlab.config.ldap['allow_username_or_email_login'] = true
- User.stub find_by_extern_uid_and_provider: nil
- User.stub(:find_by).with(hash_including(email: anything())) { nil }
- User.stub(:find_by).with(hash_including(username: anything())) { user }
- user.should_receive :update_attributes
- gl_auth.find_or_create(@auth)
- Gitlab.config.ldap['allow_username_or_email_login'] = value
- end
-
- it "should not update credentials by username if missing uid and Gitlab.config.ldap.allow_username_or_email_login is false" do
- user = double('User')
- value = Gitlab.config.ldap.allow_username_or_email_login
- Gitlab.config.ldap['allow_username_or_email_login'] = false
- User.stub find_by_extern_uid_and_provider: nil
- User.stub(:find_by).with(hash_including(email: anything())) { nil }
- User.stub(:find_by).with(hash_including(username: anything())) { user }
- user.should_not_receive :update_attributes
- gl_auth.find_or_create(@auth)
- Gitlab.config.ldap['allow_username_or_email_login'] = value
- end
- end
-end
diff --git a/spec/lib/gitlab/ldap/user_spec.rb b/spec/lib/gitlab/ldap/user_spec.rb
new file mode 100644
index 00000000000..d232cb20759
--- /dev/null
+++ b/spec/lib/gitlab/ldap/user_spec.rb
@@ -0,0 +1,54 @@
+require 'spec_helper'
+
+describe Gitlab::LDAP::User do
+ let(:gl_user) { Gitlab::LDAP::User }
+ let(:info) do
+ double(
+ name: 'John',
+ email: 'john@example.com',
+ nickname: 'john'
+ )
+ end
+ before { Gitlab.config.stub(omniauth: {}) }
+
+ describe :find_or_create do
+ let(:auth) do
+ double(info: info, provider: 'ldap', uid: 'my-uid')
+ end
+
+ it "finds the user if already existing" do
+ existing_user = create(:user, extern_uid: 'my-uid', provider: 'ldap')
+
+ expect{ gl_user.find_or_create(auth) }.to_not change{ User.count }
+ end
+
+ it "connects to existing non-ldap user if the email matches" do
+ existing_user = create(:user, email: 'john@example.com')
+ expect{ gl_user.find_or_create(auth) }.to_not change{ User.count }
+
+ existing_user.reload
+ expect(existing_user.extern_uid).to eql 'my-uid'
+ expect(existing_user.provider).to eql 'ldap'
+ end
+
+ it "creates a new user if not found" do
+ expect{ gl_user.find_or_create(auth) }.to change{ User.count }.by(1)
+ end
+ end
+
+ describe "authenticate" do
+ let(:login) { 'john' }
+ let(:password) { 'my-secret' }
+
+ before {
+ Gitlab.config.ldap['enabled'] = true
+ Gitlab.config.ldap['user_filter'] = 'employeeType=developer'
+ }
+ after { Gitlab.config.ldap['enabled'] = false }
+
+ it "send an authentication request to ldap" do
+ expect( Gitlab::LDAP::User.adapter ).to receive(:bind_as)
+ Gitlab::LDAP::User.authenticate(login, password)
+ end
+ end
+end
diff --git a/spec/lib/gitlab/oauth/user_spec.rb b/spec/lib/gitlab/oauth/user_spec.rb
new file mode 100644
index 00000000000..c241e198609
--- /dev/null
+++ b/spec/lib/gitlab/oauth/user_spec.rb
@@ -0,0 +1,83 @@
+require 'spec_helper'
+
+describe Gitlab::OAuth::User do
+ let(:gl_auth) { Gitlab::OAuth::User }
+ let(:info) do
+ double(
+ nickname: 'john',
+ name: 'John',
+ email: 'john@mail.com'
+ )
+ end
+
+ before do
+ Gitlab.config.stub(omniauth: {})
+ end
+
+ describe :find do
+ let!(:existing_user) { create(:user, extern_uid: 'my-uid', provider: 'my-provider') }
+
+ it "finds an existing user based on uid and provider (facebook)" do
+ auth = double(info: double(name: 'John'), uid: 'my-uid', provider: 'my-provider')
+ assert gl_auth.find(auth)
+ end
+
+ it "finds an existing user based on nested uid and provider" do
+ auth = double(info: info, uid: 'my-uid', provider: 'my-provider')
+ assert gl_auth.find(auth)
+ end
+ end
+
+ describe :create do
+ it "should create user from LDAP" do
+ auth = double(info: info, uid: 'my-uid', provider: 'ldap')
+ user = gl_auth.create(auth)
+
+ user.should be_valid
+ user.extern_uid.should == auth.uid
+ user.provider.should == 'ldap'
+ end
+
+ it "should create user from Omniauth" do
+ auth = double(info: info, uid: 'my-uid', provider: 'twitter')
+ user = gl_auth.create(auth)
+
+ user.should be_valid
+ user.extern_uid.should == auth.uid
+ user.provider.should == 'twitter'
+ end
+
+ it "should apply defaults to user" do
+ auth = double(info: info, uid: 'my-uid', provider: 'ldap')
+ user = gl_auth.create(auth)
+
+ user.should be_valid
+ user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
+ user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
+ end
+
+ it "Set a temp email address if not provided (like twitter does)" do
+ info = double(
+ uid: 'my-uid',
+ nickname: 'john',
+ name: 'John'
+ )
+ auth = double(info: info, uid: 'my-uid', provider: 'my-provider')
+
+ user = gl_auth.create(auth)
+ expect(user.email).to_not be_empty
+ end
+
+ it 'generates a username if non provided (google)' do
+ info = double(
+ uid: 'my-uid',
+ name: 'John',
+ email: 'john@example.com'
+ )
+ auth = double(info: info, uid: 'my-uid', provider: 'my-provider')
+
+ user = gl_auth.create(auth)
+ expect(user.username).to eql 'john'
+ end
+ end
+end
diff --git a/spec/lib/oauth_spec.rb b/spec/lib/oauth_spec.rb
deleted file mode 100644
index 2f15b5e0349..00000000000
--- a/spec/lib/oauth_spec.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-require 'spec_helper'
-
-describe Gitlab::OAuth::User do
- let(:gl_auth) { Gitlab::OAuth::User }
-
- before do
- Gitlab.config.stub(omniauth: {})
-
- @info = double(
- uid: '12djsak321',
- nickname: 'john',
- name: 'John',
- email: 'john@mail.com'
- )
- end
-
- describe :create do
- it "should create user from LDAP" do
- @auth = double(info: @info, provider: 'ldap')
- user = gl_auth.create(@auth)
-
- user.should be_valid
- user.extern_uid.should == @info.uid
- user.provider.should == 'ldap'
- end
-
- it "should create user from Omniauth" do
- @auth = double(info: @info, provider: 'twitter')
- user = gl_auth.create(@auth)
-
- user.should be_valid
- user.extern_uid.should == @info.uid
- user.provider.should == 'twitter'
- end
-
- it "should apply defaults to user" do
- @auth = double(info: @info, provider: 'ldap')
- user = gl_auth.create(@auth)
-
- user.should be_valid
- user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit
- user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group
- end
- end
-end
diff --git a/spec/models/assembla_service_spec.rb b/spec/models/assembla_service_spec.rb
index acc08fc4d69..0ef475b87c3 100644
--- a/spec/models/assembla_service_spec.rb
+++ b/spec/models/assembla_service_spec.rb
@@ -5,16 +5,11 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
require 'spec_helper'
diff --git a/spec/models/flowdock_service_spec.rb b/spec/models/flowdock_service_spec.rb
index 25ad133e122..710b8cba502 100644
--- a/spec/models/flowdock_service_spec.rb
+++ b/spec/models/flowdock_service_spec.rb
@@ -5,16 +5,11 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
require 'spec_helper'
diff --git a/spec/models/gemnasium_service_spec.rb b/spec/models/gemnasium_service_spec.rb
index efdf0dc891b..5de645cdf33 100644
--- a/spec/models/gemnasium_service_spec.rb
+++ b/spec/models/gemnasium_service_spec.rb
@@ -5,16 +5,11 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
require 'spec_helper'
diff --git a/spec/models/gitlab_ci_service_spec.rb b/spec/models/gitlab_ci_service_spec.rb
index 439a30869bb..e4cd8bb90c3 100644
--- a/spec/models/gitlab_ci_service_spec.rb
+++ b/spec/models/gitlab_ci_service_spec.rb
@@ -5,16 +5,11 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
require 'spec_helper'
diff --git a/spec/models/label_link_spec.rb b/spec/models/label_link_spec.rb
index 078e61a7d62..0db60432ad3 100644
--- a/spec/models/label_link_spec.rb
+++ b/spec/models/label_link_spec.rb
@@ -1,3 +1,15 @@
+# == Schema Information
+#
+# Table name: label_links
+#
+# id :integer not null, primary key
+# label_id :integer
+# target_id :integer
+# target_type :string(255)
+# created_at :datetime
+# updated_at :datetime
+#
+
require 'spec_helper'
describe LabelLink do
diff --git a/spec/models/label_spec.rb b/spec/models/label_spec.rb
index 5098af84cc3..31634648f04 100644
--- a/spec/models/label_spec.rb
+++ b/spec/models/label_spec.rb
@@ -1,3 +1,15 @@
+# == Schema Information
+#
+# Table name: labels
+#
+# id :integer not null, primary key
+# title :string(255)
+# color :string(255)
+# project_id :integer
+# created_at :datetime
+# updated_at :datetime
+#
+
require 'spec_helper'
describe Label do
@@ -5,4 +17,27 @@ describe Label do
it { label.should be_valid }
it { should belong_to(:project) }
+
+ describe 'Validation' do
+ it 'should validate color code' do
+ build(:label, color: 'G-ITLAB').should_not be_valid
+ build(:label, color: 'AABBCC').should_not be_valid
+ build(:label, color: '#AABBCCEE').should_not be_valid
+ build(:label, color: '#GGHHII').should_not be_valid
+ build(:label, color: '#').should_not be_valid
+ build(:label, color: '').should_not be_valid
+
+ build(:label, color: '#AABBCC').should be_valid
+ end
+
+ it 'should validate title' do
+ build(:label, title: 'G,ITLAB').should_not be_valid
+ build(:label, title: 'G?ITLAB').should_not be_valid
+ build(:label, title: 'G&ITLAB').should_not be_valid
+ build(:label, title: '').should_not be_valid
+
+ build(:label, title: 'GITLAB').should be_valid
+ build(:label, title: 'gitlab').should be_valid
+ end
+ end
end
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index ec6d29de82b..c40f75290ed 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -17,6 +17,7 @@
# target_project_id :integer not null
# iid :integer
# description :text
+# position :integer default(0)
#
require 'spec_helper'
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 82ab97cdd7a..1c11ac39567 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -22,6 +22,8 @@
# visibility_level :integer default(0), not null
# archived :boolean default(FALSE), not null
# import_status :string(255)
+# repository_size :float default(0.0)
+# star_count :integer default(0), not null
#
require 'spec_helper'
diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb
index adeeac115c1..480aeabf67f 100644
--- a/spec/models/service_spec.rb
+++ b/spec/models/service_spec.rb
@@ -5,16 +5,11 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
require 'spec_helper'
diff --git a/spec/models/slack_service_spec.rb b/spec/models/slack_service_spec.rb
index b00eb30569b..4576913b473 100644
--- a/spec/models/slack_service_spec.rb
+++ b/spec/models/slack_service_spec.rb
@@ -5,16 +5,11 @@
# id :integer not null, primary key
# type :string(255)
# title :string(255)
-# token :string(255)
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
# active :boolean default(FALSE), not null
-# project_url :string(255)
-# subdomain :string(255)
-# room :string(255)
-# recipients :text
-# api_key :string(255)
+# properties :text
#
require 'spec_helper'
diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb
index f3d7ca2ed21..e7f91c5e46e 100644
--- a/spec/requests/api/branches_spec.rb
+++ b/spec/requests/api/branches_spec.rb
@@ -94,22 +94,50 @@ describe API::API, api: true do
describe "POST /projects/:id/repository/branches" do
it "should create a new branch" do
post api("/projects/#{project.id}/repository/branches", user),
- branch_name: branch_name,
- ref: branch_sha
+ branch_name: 'feature1',
+ ref: branch_sha
response.status.should == 201
- json_response['name'].should == branch_name
+ json_response['name'].should == 'feature1'
json_response['commit']['id'].should == branch_sha
end
it "should deny for user without push access" do
post api("/projects/#{project.id}/repository/branches", user2),
- branch_name: branch_name,
- ref: branch_sha
-
+ branch_name: branch_name,
+ ref: branch_sha
response.status.should == 403
end
+
+ it 'should return 400 if branch name is invalid' do
+ post api("/projects/#{project.id}/repository/branches", user),
+ branch_name: 'new design',
+ ref: branch_sha
+ response.status.should == 400
+ json_response['message'].should == 'Branch name invalid'
+ end
+
+ it 'should return 400 if branch already exists' do
+ post api("/projects/#{project.id}/repository/branches", user),
+ branch_name: 'new_design1',
+ ref: branch_sha
+ response.status.should == 201
+
+ post api("/projects/#{project.id}/repository/branches", user),
+ branch_name: 'new_design1',
+ ref: branch_sha
+ response.status.should == 400
+ json_response['message'].should == 'Branch already exists'
+ end
+
+ it 'should return 400 if ref name is invalid' do
+ post api("/projects/#{project.id}/repository/branches", user),
+ branch_name: 'new_design3',
+ ref: 'foo'
+ response.status.should == 400
+ json_response['message'].should == 'Invalid reference name'
+ end
end
describe "DELETE /projects/:id/repository/branches/:branch" do
@@ -120,6 +148,11 @@ describe API::API, api: true do
response.status.should == 200
end
+ it 'should return 404 if branch not exists' do
+ delete api("/projects/#{project.id}/repository/branches/foobar", user)
+ response.status.should == 404
+ end
+
it "should remove protected branch" do
project.protected_branches.create(name: branch_name)
delete api("/projects/#{project.id}/repository/branches/#{branch_name}", user)
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb
index dbe8043c633..6df5ef38961 100644
--- a/spec/requests/api/internal_spec.rb
+++ b/spec/requests/api/internal_spec.rb
@@ -155,9 +155,8 @@ describe API::API, api: true do
end
def pull(key, project)
- get(
+ post(
api("/internal/allowed"),
- ref: 'master',
key_id: key.id,
project: project.path_with_namespace,
action: 'git-upload-pack'
@@ -165,9 +164,9 @@ describe API::API, api: true do
end
def push(key, project)
- get(
+ post(
api("/internal/allowed"),
- ref: 'master',
+ changes: 'd14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/master',
key_id: key.id,
project: project.path_with_namespace,
action: 'git-receive-pack'
@@ -175,7 +174,7 @@ describe API::API, api: true do
end
def archive(key, project)
- get(
+ post(
api("/internal/allowed"),
ref: 'master',
key_id: key.id,
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
index d8e8e4f5035..e8eebda95b4 100644
--- a/spec/requests/api/issues_spec.rb
+++ b/spec/requests/api/issues_spec.rb
@@ -4,10 +4,12 @@ describe API::API, api: true do
include ApiHelpers
let(:user) { create(:user) }
let!(:project) { create(:project, namespace: user.namespace ) }
+ let!(:closed_issue) { create(:closed_issue, author: user, assignee: user, project: project, state: :closed) }
let!(:issue) { create(:issue, author: user, assignee: user, project: project) }
let!(:label) do
create(:label, title: 'label', color: '#FFAABB', project: project)
end
+ let!(:label_link) { create(:label_link, label: label, target: issue) }
before { project.team << [user, :reporter] }
@@ -32,6 +34,70 @@ describe API::API, api: true do
response.headers['Link'].should ==
'<http://www.example.com/api/v3/issues?page=1&per_page=3>; rel="first", <http://www.example.com/api/v3/issues?page=1&per_page=3>; rel="last"'
end
+
+ it 'should return an array of closed issues' do
+ get api('/issues?state=closed', user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['id'].should == closed_issue.id
+ end
+
+ it 'should return an array of opened issues' do
+ get api('/issues?state=opened', user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['id'].should == issue.id
+ end
+
+ it 'should return an array of all issues' do
+ get api('/issues?state=all', user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 2
+ json_response.first['id'].should == issue.id
+ json_response.second['id'].should == closed_issue.id
+ end
+
+ it 'should return an array of labeled issues' do
+ get api("/issues?labels=#{label.title}", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['labels'].should == [label.title]
+ end
+
+ it 'should return an array of labeled issues when at least one label matches' do
+ get api("/issues?labels=#{label.title},foo,bar", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['labels'].should == [label.title]
+ end
+
+ it 'should return an empty array if no issue matches labels' do
+ get api('/issues?labels=foo,bar', user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 0
+ end
+
+ it 'should return an array of labeled issues matching given state' do
+ get api("/issues?labels=#{label.title}&state=opened", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['labels'].should == [label.title]
+ json_response.first['state'].should == 'opened'
+ end
+
+ it 'should return an empty array if no issue matches labels and state filters' do
+ get api("/issues?labels=#{label.title}&state=closed", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 0
+ end
end
end
@@ -42,6 +108,29 @@ describe API::API, api: true do
json_response.should be_an Array
json_response.first['title'].should == issue.title
end
+
+ it 'should return an array of labeled project issues' do
+ get api("/projects/#{project.id}/issues?labels=#{label.title}", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['labels'].should == [label.title]
+ end
+
+ it 'should return an array of labeled project issues when at least one label matches' do
+ get api("/projects/#{project.id}/issues?labels=#{label.title},foo,bar", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 1
+ json_response.first['labels'].should == [label.title]
+ end
+
+ it 'should return an empty array if no project issue matches labels' do
+ get api("/projects/#{project.id}/issues?labels=foo,bar", user)
+ response.status.should == 200
+ json_response.should be_an Array
+ json_response.length.should == 0
+ end
end
describe "GET /projects/:id/issues/:issue_id" do
@@ -73,12 +162,12 @@ describe API::API, api: true do
response.status.should == 400
end
- it 'should return 405 on invalid label names' do
+ it 'should return 400 on invalid label names' do
post api("/projects/#{project.id}/issues", user),
title: 'new issue',
labels: 'label, ?'
- response.status.should == 405
- json_response['message'].should == 'Label names invalid'
+ response.status.should == 400
+ json_response['message']['labels']['?']['title'].should == ['is invalid']
end
end
@@ -97,12 +186,56 @@ describe API::API, api: true do
response.status.should == 404
end
- it 'should return 405 on invalid label names' do
+ it 'should return 400 on invalid label names' do
put api("/projects/#{project.id}/issues/#{issue.id}", user),
title: 'updated title',
labels: 'label, ?'
- response.status.should == 405
- json_response['message'].should == 'Label names invalid'
+ response.status.should == 400
+ json_response['message']['labels']['?']['title'].should == ['is invalid']
+ end
+ end
+
+ describe 'PUT /projects/:id/issues/:issue_id to update labels' do
+ let!(:label) { create(:label, title: 'dummy', project: project) }
+ let!(:label_link) { create(:label_link, label: label, target: issue) }
+
+ it 'should not update labels if not present' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ title: 'updated title'
+ response.status.should == 200
+ json_response['labels'].should == [label.title]
+ end
+
+ it 'should remove all labels' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ labels: ''
+ response.status.should == 200
+ json_response['labels'].should == []
+ end
+
+ it 'should update labels' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ labels: 'foo,bar'
+ response.status.should == 200
+ json_response['labels'].should include 'foo'
+ json_response['labels'].should include 'bar'
+ end
+
+ it 'should return 400 on invalid label names' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ labels: 'label, ?'
+ response.status.should == 400
+ json_response['message']['labels']['?']['title'].should == ['is invalid']
+ end
+
+ it 'should allow special label names' do
+ put api("/projects/#{project.id}/issues/#{issue.id}", user),
+ labels: 'label:foo, label-bar,label_bar,label/bar'
+ response.status.should == 200
+ json_response['labels'].should include 'label:foo'
+ json_response['labels'].should include 'label-bar'
+ json_response['labels'].should include 'label_bar'
+ json_response['labels'].should include 'label/bar'
end
end
@@ -112,7 +245,7 @@ describe API::API, api: true do
labels: 'label2', state_event: "close"
response.status.should == 200
- json_response['labels'].should == ['label2']
+ json_response['labels'].should include 'label2'
json_response['state'].should eq "closed"
end
end
diff --git a/spec/requests/api/labels_spec.rb b/spec/requests/api/labels_spec.rb
index b06b353333d..ee9088933a1 100644
--- a/spec/requests/api/labels_spec.rb
+++ b/spec/requests/api/labels_spec.rb
@@ -42,19 +42,27 @@ describe API::API, api: true do
response.status.should == 400
end
- it 'should return 405 for invalid color' do
+ it 'should return 400 for invalid color' do
post api("/projects/#{project.id}/labels", user),
name: 'Foo',
color: '#FFAA'
- response.status.should == 405
+ response.status.should == 400
+ json_response['message'].should == 'Color is invalid'
+ end
+
+ it 'should return 400 for too long color code' do
+ post api("/projects/#{project.id}/labels", user),
+ name: 'Foo',
+ color: '#FFAAFFFF'
+ response.status.should == 400
json_response['message'].should == 'Color is invalid'
end
- it 'should return 405 for invalid name' do
+ it 'should return 400 for invalid name' do
post api("/projects/#{project.id}/labels", user),
name: '?',
color: '#FFAABB'
- response.status.should == 405
+ response.status.should == 400
json_response['message'].should == 'Title is invalid'
end
@@ -131,20 +139,28 @@ describe API::API, api: true do
response.status.should == 400
end
- it 'should return 405 for invalid name' do
+ it 'should return 400 for invalid name' do
put api("/projects/#{project.id}/labels", user),
name: 'label1',
new_name: '?',
color: '#FFFFFF'
- response.status.should == 405
+ response.status.should == 400
json_response['message'].should == 'Title is invalid'
end
- it 'should return 405 for invalid name' do
+ it 'should return 400 for invalid name' do
put api("/projects/#{project.id}/labels", user),
name: 'label1',
color: '#FF'
- response.status.should == 405
+ response.status.should == 400
+ json_response['message'].should == 'Color is invalid'
+ end
+
+ it 'should return 400 for too long color code' do
+ post api("/projects/#{project.id}/labels", user),
+ name: 'Foo',
+ color: '#FFAAFFFF'
+ response.status.should == 400
json_response['message'].should == 'Color is invalid'
end
end
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 58cf7f139dc..06a25c5e3a5 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -112,15 +112,16 @@ describe API::API, api: true do
response.status.should == 400
end
- it 'should return 405 on invalid label names' do
+ it 'should return 400 on invalid label names' do
post api("/projects/#{project.id}/merge_requests", user),
title: 'Test merge_request',
source_branch: 'stable',
target_branch: 'master',
author: user,
labels: 'label, ?'
- response.status.should == 405
- json_response['message'].should == 'Label names invalid'
+ response.status.should == 400
+ json_response['message']['labels']['?']['title'].should ==
+ ['is invalid']
end
end
@@ -252,13 +253,13 @@ describe API::API, api: true do
json_response['target_branch'].should == 'wiki'
end
- it 'should return 405 on invalid label names' do
+ it 'should return 400 on invalid label names' do
put api("/projects/#{project.id}/merge_request/#{merge_request.id}",
user),
title: 'new issue',
labels: 'label, ?'
- response.status.should == 405
- json_response['message'].should == 'Label names invalid'
+ response.status.should == 400
+ json_response['message']['labels']['?']['title'].should == ['is invalid']
end
end
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 12a3a07ff76..058b831e783 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -114,6 +114,7 @@ describe API::API, api: true do
it "should assign attributes to project" do
project = attributes_for(:project, {
+ path: 'camelCasePath',
description: Faker::Lorem.sentence,
issues_enabled: false,
merge_requests_enabled: false,
@@ -123,7 +124,6 @@ describe API::API, api: true do
post api("/projects", user), project
project.each_pair do |k,v|
- next if k == :path
json_response[k.to_s].should == v
end
end
diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb
index f8603e11a04..17173aaeeac 100644
--- a/spec/requests/api/repositories_spec.rb
+++ b/spec/requests/api/repositories_spec.rb
@@ -23,22 +23,67 @@ describe API::API, api: true do
end
describe 'POST /projects/:id/repository/tags' do
- it 'should create a new tag' do
- post api("/projects/#{project.id}/repository/tags", user),
- tag_name: 'v1.0.0',
- ref: 'master'
-
- response.status.should == 201
- json_response['name'].should == 'v1.0.0'
+ context 'lightweight tags' do
+ it 'should create a new tag' do
+ post api("/projects/#{project.id}/repository/tags", user),
+ tag_name: 'v7.0.1',
+ ref: 'master'
+
+ response.status.should == 201
+ json_response['name'].should == 'v7.0.1'
+ end
end
+ # TODO: fix this test for CI
+ #context 'annotated tag' do
+ #it 'should create a new annotated tag' do
+ #post api("/projects/#{project.id}/repository/tags", user),
+ #tag_name: 'v7.1.0',
+ #ref: 'master',
+ #message: 'tag message'
+
+ #response.status.should == 201
+ #json_response['name'].should == 'v7.1.0'
+ # The message is not part of the JSON response.
+ # Additional changes to the gitlab_git gem may be required.
+ # json_response['message'].should == 'tag message'
+ #end
+ #end
+
it 'should deny for user without push access' do
post api("/projects/#{project.id}/repository/tags", user2),
- tag_name: 'v1.0.0',
+ tag_name: 'v1.9.0',
ref: '621491c677087aa243f165eab467bfdfbee00be1'
-
response.status.should == 403
end
+
+ it 'should return 400 if tag name is invalid' do
+ post api("/projects/#{project.id}/repository/tags", user),
+ tag_name: 'v 1.0.0',
+ ref: 'master'
+ response.status.should == 400
+ json_response['message'].should == 'Tag name invalid'
+ end
+
+ it 'should return 400 if tag already exists' do
+ post api("/projects/#{project.id}/repository/tags", user),
+ tag_name: 'v8.0.0',
+ ref: 'master'
+ response.status.should == 201
+ post api("/projects/#{project.id}/repository/tags", user),
+ tag_name: 'v8.0.0',
+ ref: 'master'
+ response.status.should == 400
+ json_response['message'].should == 'Tag already exists'
+ end
+
+ it 'should return 400 if ref name is invalid' do
+ post api("/projects/#{project.id}/repository/tags", user),
+ tag_name: 'mytag',
+ ref: 'foo'
+ response.status.should == 400
+ json_response['message'].should == 'Invalid reference name'
+ end
end
describe "GET /projects/:id/repository/tree" do
diff --git a/spec/services/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb
index b6573095dbd..0edc3a8e807 100644
--- a/spec/services/fork_service_spec.rb
+++ b/spec/services/projects/fork_service_spec.rb
@@ -5,44 +5,40 @@ describe Projects::ForkService do
before do
@from_namespace = create(:namespace)
@from_user = create(:user, namespace: @from_namespace )
- @from_project = create(:project, creator_id: @from_user.id, namespace: @from_namespace)
+ @from_project = create(:project, creator_id: @from_user.id,
+ namespace: @from_namespace, star_count: 107,
+ description: 'wow such project')
@to_namespace = create(:namespace)
@to_user = create(:user, namespace: @to_namespace)
end
context 'fork project' do
+ describe "successfully creates project in the user namespace" do
+ let(:to_project) { fork_project(@from_project, @to_user) }
- it "successfully creates project in the user namespace" do
- @to_project = fork_project(@from_project, @to_user)
-
- @to_project.owner.should == @to_user
- @to_project.namespace.should == @to_user.namespace
+ it { to_project.owner.should == @to_user }
+ it { to_project.namespace.should == @to_user.namespace }
+ it { to_project.star_count.should be_zero }
+ it { to_project.description.should == @from_project.description }
end
end
context 'fork project failure' do
-
it "fails due to transaction failure" do
- # make the mock gitlab-shell fail
@to_project = fork_project(@from_project, @to_user, false)
-
@to_project.errors.should_not be_empty
@to_project.errors[:base].should include("Fork transaction failed.")
end
-
end
context 'project already exists' do
-
it "should fail due to validation, not transaction failure" do
@existing_project = create(:project, creator_id: @to_user.id, name: @from_project.name, namespace: @to_namespace)
@to_project = fork_project(@from_project, @to_user)
-
@existing_project.persisted?.should be_true
@to_project.errors[:base].should include("Invalid fork destination")
@to_project.errors[:base].should_not include("Fork transaction failed.")
end
-
end
end
@@ -53,5 +49,4 @@ describe Projects::ForkService do
context.stub(gitlab_shell: shell)
context.execute
end
-
end
diff --git a/spec/services/projects/update_service_spec.rb b/spec/services/projects/update_service_spec.rb
index 62357787521..5a10174eb36 100644
--- a/spec/services/projects/update_service_spec.rb
+++ b/spec/services/projects/update_service_spec.rb
@@ -48,7 +48,7 @@ describe Projects::UpdateService do
context 'respect configured visibility restrictions setting' do
before(:each) do
@restrictions = double("restrictions")
- @restrictions.stub(:restricted_visibility_levels) { [ Gitlab::VisibilityLevel::PUBLIC ] }
+ @restrictions.stub(:restricted_visibility_levels) { [ "public" ] }
Settings.stub_chain(:gitlab).and_return(@restrictions)
end
diff --git a/spec/services/search_service_spec.rb b/spec/services/search_service_spec.rb
index daffe98a8ed..3217c571e67 100644
--- a/spec/services/search_service_spec.rb
+++ b/spec/services/search_service_spec.rb
@@ -19,7 +19,7 @@ describe 'Search::GlobalService' do
it 'should return public projects only' do
context = Search::GlobalService.new(nil, search: "searchable")
results = context.execute
- results[:projects].should match_array [public_project]
+ results.objects('projects').should match_array [public_project]
end
end
@@ -27,19 +27,19 @@ describe 'Search::GlobalService' do
it 'should return public, internal and private projects' do
context = Search::GlobalService.new(user, search: "searchable")
results = context.execute
- results[:projects].should match_array [public_project, found_project, internal_project]
+ results.objects('projects').should match_array [public_project, found_project, internal_project]
end
it 'should return only public & internal projects' do
context = Search::GlobalService.new(internal_user, search: "searchable")
results = context.execute
- results[:projects].should match_array [internal_project, public_project]
+ results.objects('projects').should match_array [internal_project, public_project]
end
it 'namespace name should be searchable' do
context = Search::GlobalService.new(user, search: found_project.namespace.path)
results = context.execute
- results[:projects].should match_array [found_project]
+ results.objects('projects').should match_array [found_project]
end
end
end
diff --git a/spec/services/system_hooks_service_spec.rb b/spec/services/system_hooks_service_spec.rb
index 3c2eec6cfd9..7497bdb0b3c 100644
--- a/spec/services/system_hooks_service_spec.rb
+++ b/spec/services/system_hooks_service_spec.rb
@@ -4,6 +4,7 @@ describe SystemHooksService do
let (:user) { create :user }
let (:project) { create :project }
let (:users_project) { create :users_project }
+ let (:key) { create(:key, user: user) }
context 'event data' do
it { event_data(user, :create).should include(:event_name, :name, :created_at, :email, :user_id) }
@@ -12,6 +13,8 @@ describe SystemHooksService do
it { event_data(project, :destroy).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) }
it { event_data(users_project, :create).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access, :project_visibility) }
it { event_data(users_project, :destroy).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access, :project_visibility) }
+ it { event_data(key, :create).should include(:username, :key, :id) }
+ it { event_data(key, :destroy).should include(:username, :key, :id) }
end
context 'event names' do
@@ -21,6 +24,8 @@ describe SystemHooksService do
it { event_name(project, :destroy).should eq "project_destroy" }
it { event_name(users_project, :create).should eq "user_add_to_team" }
it { event_name(users_project, :destroy).should eq "user_remove_from_team" }
+ it { event_name(key, :create).should eq 'key_create' }
+ it { event_name(key, :destroy).should eq 'key_destroy' }
end
def event_data(*args)
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb
index e6bf79b853c..4273fd1019a 100644
--- a/spec/workers/post_receive_spec.rb
+++ b/spec/workers/post_receive_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
describe PostReceive do
-
context "as a resque worker" do
it "reponds to #perform" do
PostReceive.new.should respond_to(:perform)
@@ -15,7 +14,7 @@ describe PostReceive do
it "fetches the correct project" do
Project.should_receive(:find_with_namespace).with(project.path_with_namespace).and_return(project)
- PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id)
+ PostReceive.new.perform(pwd(project), key_id, changes)
end
it "does not run if the author is not in the project" do
@@ -23,7 +22,7 @@ describe PostReceive do
project.should_not_receive(:execute_hooks)
- PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id).should be_false
+ PostReceive.new.perform(pwd(project), key_id, changes).should be_false
end
it "asks the project to trigger all hooks" do
@@ -32,11 +31,15 @@ describe PostReceive do
project.should_receive(:execute_services)
project.should_receive(:update_merge_requests)
- PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id)
+ PostReceive.new.perform(pwd(project), key_id, changes)
end
end
def pwd(project)
File.join(Gitlab.config.gitlab_shell.repos_path, project.path_with_namespace)
end
+
+ def changes
+ 'd14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/master'
+ end
end
diff --git a/vendor/assets/javascripts/jquery.sticky.js b/vendor/assets/javascripts/jquery.sticky.js
new file mode 100755
index 00000000000..f7c9cd46ae9
--- /dev/null
+++ b/vendor/assets/javascripts/jquery.sticky.js
@@ -0,0 +1,170 @@
+// Sticky Plugin v1.0.0 for jQuery
+// =============
+// Author: Anthony Garand
+// Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk)
+// Improvements by Leonardo C. Daronco (daronco)
+// Created: 2/14/2011
+// Date: 2/12/2012
+// Website: http://labs.anthonygarand.com/sticky
+// Description: Makes an element on the page stick on the screen as you scroll
+// It will only set the 'top' and 'position' of your element, you
+// might need to adjust the width in some cases.
+
+(function($) {
+ var defaults = {
+ topSpacing: 0,
+ bottomSpacing: 0,
+ className: 'is-sticky',
+ wrapperClassName: 'sticky-wrapper',
+ center: false,
+ getWidthFrom: '',
+ responsiveWidth: false
+ },
+ $window = $(window),
+ $document = $(document),
+ sticked = [],
+ windowHeight = $window.height(),
+ scroller = function() {
+ var scrollTop = $window.scrollTop(),
+ documentHeight = $document.height(),
+ dwh = documentHeight - windowHeight,
+ extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
+
+ for (var i = 0; i < sticked.length; i++) {
+ var s = sticked[i],
+ elementTop = s.stickyWrapper.offset().top,
+ etse = elementTop - s.topSpacing - extra;
+
+ if (scrollTop <= etse) {
+ if (s.currentTop !== null) {
+ s.stickyElement
+ .css('position', '')
+ .css('top', '');
+ s.stickyElement.trigger('sticky-end', [s]).parent().removeClass(s.className);
+ s.currentTop = null;
+ }
+ }
+ else {
+ var newTop = documentHeight - s.stickyElement.outerHeight()
+ - s.topSpacing - s.bottomSpacing - scrollTop - extra;
+ if (newTop < 0) {
+ newTop = newTop + s.topSpacing;
+ } else {
+ newTop = s.topSpacing;
+ }
+ if (s.currentTop != newTop) {
+ s.stickyElement
+ .css('position', 'fixed')
+ .css('top', newTop);
+
+ if (typeof s.getWidthFrom !== 'undefined') {
+ s.stickyElement.css('width', $(s.getWidthFrom).width());
+ }
+
+ s.stickyElement.trigger('sticky-start', [s]).parent().addClass(s.className);
+ s.currentTop = newTop;
+ }
+ }
+ }
+ },
+ resizer = function() {
+ windowHeight = $window.height();
+
+ for (var i = 0; i < sticked.length; i++) {
+ var s = sticked[i];
+ if (typeof s.getWidthFrom !== 'undefined' && s.responsiveWidth === true) {
+ s.stickyElement.css('width', $(s.getWidthFrom).width());
+ }
+ }
+ },
+ methods = {
+ init: function(options) {
+ var o = $.extend({}, defaults, options);
+ return this.each(function() {
+ var stickyElement = $(this);
+
+ var stickyId = stickyElement.attr('id');
+ var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName : defaults.wrapperClassName
+ var wrapper = $('<div></div>')
+ .attr('id', stickyId + '-sticky-wrapper')
+ .addClass(o.wrapperClassName);
+ stickyElement.wrapAll(wrapper);
+
+ if (o.center) {
+ stickyElement.parent().css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"});
+ }
+
+ if (stickyElement.css("float") == "right") {
+ stickyElement.css({"float":"none"}).parent().css({"float":"right"});
+ }
+
+ var stickyWrapper = stickyElement.parent();
+ stickyWrapper.css('height', stickyElement.outerHeight());
+ sticked.push({
+ topSpacing: o.topSpacing,
+ bottomSpacing: o.bottomSpacing,
+ stickyElement: stickyElement,
+ currentTop: null,
+ stickyWrapper: stickyWrapper,
+ className: o.className,
+ getWidthFrom: o.getWidthFrom,
+ responsiveWidth: o.responsiveWidth
+ });
+ });
+ },
+ update: scroller,
+ unstick: function(options) {
+ return this.each(function() {
+ var unstickyElement = $(this);
+
+ var removeIdx = -1;
+ for (var i = 0; i < sticked.length; i++)
+ {
+ if (sticked[i].stickyElement.get(0) == unstickyElement.get(0))
+ {
+ removeIdx = i;
+ }
+ }
+ if(removeIdx != -1)
+ {
+ sticked.splice(removeIdx,1);
+ unstickyElement.unwrap();
+ unstickyElement.removeAttr('style');
+ }
+ });
+ }
+ };
+
+ // should be more efficient than using $window.scroll(scroller) and $window.resize(resizer):
+ if (window.addEventListener) {
+ window.addEventListener('scroll', scroller, false);
+ window.addEventListener('resize', resizer, false);
+ } else if (window.attachEvent) {
+ window.attachEvent('onscroll', scroller);
+ window.attachEvent('onresize', resizer);
+ }
+
+ $.fn.sticky = function(method) {
+ if (methods[method]) {
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
+ } else if (typeof method === 'object' || !method ) {
+ return methods.init.apply( this, arguments );
+ } else {
+ $.error('Method ' + method + ' does not exist on jQuery.sticky');
+ }
+ };
+
+ $.fn.unstick = function(method) {
+ if (methods[method]) {
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
+ } else if (typeof method === 'object' || !method ) {
+ return methods.unstick.apply( this, arguments );
+ } else {
+ $.error('Method ' + method + ' does not exist on jQuery.sticky');
+ }
+
+ };
+ $(function() {
+ setTimeout(scroller, 0);
+ });
+})(jQuery);