summaryrefslogtreecommitdiff
path: root/spec/models
Commit message (Collapse)AuthorAgeFilesLines
* Add a `Blob` model that wraps `Gitlab::Git::Blob`rs-blobRobert Speicher2016-02-181-0/+81
| | | | | | | | | | | This allows us to take advantage of Rails' `to_partial_path` to render the correct partial based on the Blob type, rather than cluttering the view with conditionals. It also allows (and will allow in the future) better encapsulation for Blob-related logic which makes sense for our Rails app but might not make as much sense for the core `gitlab_git` library, such as detecting if the blob is an SVG.
* Merge branch 'autocrlf-lazy' into 'master' Robert Speicher2016-02-181-2/+57
|\ | | | | | | | | | | | | | | Only set autocrlf when creating/updating files Related issue: gitlab-org/gitlab-ce#13457 Details: 5619a6de1dd6fc1dfd4053810c7b11c677b7a495 See merge request !2859
| * Handle raw_repository returning nil in exists?autocrlf-lazyYorick Peterse2016-02-181-0/+6
| | | | | | | | | | | | If path_with_namespace is nil Repository#raw_repository will also return nil. Apparently code out there creates a Repository instance without a namespace path. Right.
| * Added specs for Repository#exists?Yorick Peterse2016-02-181-0/+13
| |
| * Only set autocrlf when creating/updating filesYorick Peterse2016-02-181-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | Setting the "autocrlf" Git option is an overkill since it's rarely actually needed. More importantly, it has quite the impact on performance (see gitlab-org/gitlab-ce#13457 for more information). By setting "autocrlf" when creating or updating files we guarantee the option is always set properly when we actually need it _without_ introducing overhead for requests that have nothing to do with this option. Fixes gitlab-org/gitlab-ce#13457
* | Add specs covering bug in build allowed to fail caseGrzegorz Bizon2016-02-181-0/+29
|/
* Expire caches after forking/importing a repositoryYorick Peterse2016-02-171-0/+11
| | | | | | | | This ensures the caches for Repository#empty? and Repository#has_visible_content? are flushed after a repository has been imported or forked. Fixes gitlab-org/gitlab-ce#13505
* Merge branch 'bugagazavr/gitlab-ce-extend-hooks' into 'master' Douwe Maan2016-02-162-17/+27
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new data to project in push, issue, merge-request and note webhooks data _Originally opened at !2738 by @bugagazavr._ - - - **What does this MR do?** Adds more data to hooks, makes repository data in all hook more dry ( use one hook_attrs method for repository data in all hooks ) **Are there points in the code the reviewer needs to double check?** 1. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/app/models/project.rb#L738 2. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/app/models/concerns/issuable.rb#L132 3. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/lib/gitlab/push_data_builder.rb#L52 4. https://gitlab.com/bugagazavr/gitlab-ce/blob/extend-hooks/lib/gitlab/note_data_builder.rb#L56 **Why was this MR needed?** More information about user for push events, and more data about repositiry ( project ) **What are the relevant issue numbers?** No **Screenshots (if relevant)** No See merge request !2788
| * Add new data to project in push, issue, merge-request and note webhooks databugagazavr/gitlab-ce-extend-hooksKirill Zaitsev2016-02-112-17/+27
| | | | | | | | | | | | | | | | | | | | | | - Add `avatar_url`, `description`, `git_ssh_url`, `git_http_url`, `path_with_namespace` and `default_branch` in `project` in push, issue, merge-request and note webhooks data - Deprecate the `ssh_url` in favor of `git_ssh_url` and `http_url` in favor of `git_http_url` in `project` for push, issue, merge-request and note webhooks data - Deprecate the `repository` key in push, issue, merge-request and note webhooks data, use `project` instead
* | Merge branch 'streamline-email-validation' into 'master' Douwe Maan2016-02-124-30/+38
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | Validate email addresses using Devise.email_regexp Also: - Get rid of legacy `:strict_mode` - Get rid of custom `:email` validator - Add some shared examples to spec emails validation This supersedes !2754 and fixes #3851. See merge request !2771
| * Validate email addresses using Devise.email_regexpRémy Coutable2016-02-094-30/+38
| | | | | | | | | | | | | | Also: - Get rid of legacy :strict_mode - Get rid of custom :email validator - Add some shared examples to spec emails validation
* | Merge branch 'brammeleman/3047-add-assignee-data-to-isuable-hook-data' into ↵Robert Speicher2016-02-101-0/+10
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'master' Add assignee data to Issuables' hook_data Originally opened at !1633 by @brammeleman. Fixes #3047. Fixes #2475. See merge request !2724
| * | Add assignee data to Issuables' hook_databrammeleman/3047-add-assignee-data-to-isuable-hook-dataBram Daams2016-02-101-0/+10
| | |
* | | Merge branch 'cwq1913/gitlab-ce-fix_skip_merge_commits' into 'master' Robert Speicher2016-02-101-0/+6
|\ \ \ | |/ / |/| | | | | | | | | | | | | | Actually use the `skip_merges` option in Repository#commits Originally opened at !2067 by @cwq1913. See merge request !2750
| * | Actually use the `skip_merges` option in Repository#commitscwq1913/gitlab-ce-fix_skip_merge_commitsTony Chu2016-02-081-0/+6
| | |
* | | Merge branch 'smarter-diverging-commit-cache-flushing' into 'master' Douwe Maan2016-02-091-0/+34
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | Smarter flushing of branch statistics caches This basically ensures we only flush caches of branches whenever we really have to. See commit c514f8b850219cd3e5526e73e1d00e6729e2b466 for the details. cc @joshfng @rspeicher See merge request !2769
| * | Smarter flushing of branch statistics cachesYorick Peterse2016-02-091-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of flushing the behind/ahead counts for all branches upon every push we now only flush the cache of branches that actually need to have these statistics recalculated. There are now basically 2 scenarios and their effects: 1. A user pushes a commit to the default branch, this results in the cache being flushed for all branches. 2. A user pushes to a non default branch, this results in _only_ the cache for that branch being flushed. The existing code (Repository#expire_cache) remains backwards compatible with the previous behaviour, the new behaviour is only applied when a branch name is passed as an argument. This ensures that when for example a project is deleted the cache for all branches is flushed.
* | | Merge branch 'fix/max-attachment-size-setting-validation'Douwe Maan2016-02-091-0/+8
|\ \ \ | |/ / |/| |
| * | Validate maximum attachment size in application settingsGrzegorz Bizon2016-02-091-0/+8
| | | | | | | | | | | | | | | | | | | | | `max_attachment_size` in `ApplicationSetting` should be present, only integers greater than zero are valid. Closes #13188
* | | Merge branch 'zj/gitlab-ce-unique-milestone-title-per-project'Douwe Maan2016-02-091-0/+14
|\ \ \ | |/ / |/| |
| * | Validate uniqueness of milestone title per projectZeger-Jan van de Weg2016-02-081-0/+14
| |/ | | | | | | Fixes #3903
* | Cache various Repository Git operationscaching-repository-git-operationsYorick Peterse2016-02-081-3/+84
|/ | | | | | | | | | | | | | This caches the output of the following methods: * Repository#empty? * Repository#has_visible_content? * Repository#root_ref The cache for Repository#has_visible_content? is flushed whenever a commit is pushed to a new branch or an existing branch is removed. The cache for Repository#root_ref is only flushed whenever a user changes the default branch of a project. The cache for Repository#empty? is never explicitly flushed as there's no need for it.
* Merge branch 'disable-remove-source-branch' into 'master' Douwe Maan2016-02-041-1/+7
|\ | | | | | | | | | | | | | | | | | | | | Hide remove source branch button when new commit is added to branch Fixes #3339 This MR hides the 'Remove source branch' button when a new commit is added to the source branch /cc @DouweM See merge request !2701
| * Hide remove source branch button when new commit is added to branchZeger-Jan van de Weg2016-02-041-1/+7
| | | | | | | | | | | | Fixes #3339 This MR hides the 'Remove source branch' button when a new commit is added to the source branch
* | Merge branch 'wipMergeSpacing' into 'master' Douwe Maan2016-02-041-0/+5
|\ \ | |/ |/| | | | | | | | | | | | | | | No space required after WIP identifier Fixes #2426 Currently, the WIP: (or any other variation) prefix of a merge request title must include a trailing space for it to be recognized as a work in progress and prevent merging. To resolve this, I added an or pattern to the regexp to look for any one of the three possible delimiters ':', ']', or ' '. This way the trailing space isn't required but it still won't mark any titles beginning with wip as work in progress (e.g. "Wipwap"). See merge request !1876
| * Removed redundent and incorrect tests on WIPTed Hogan2016-01-061-10/+0
| |
| * Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into wipMergeSpacingTed Hogan2015-12-2975-1088/+1070
| |\
| * | No space required after WIP identifierTed Hogan2015-11-231-0/+15
| | | | | | | | | | | | Modified changelog
* | | Refactor Admin::SpamLogsController to block user before destroyingDouglas Barbosa Alexandre2016-02-021-0/+14
| | |
* | | Fix typo on User modelDouglas Barbosa Alexandre2016-02-021-0/+1
| | |
* | | Add model spec for SpamLogDouglas Barbosa Alexandre2016-02-021-0/+11
| | |
* | | Merge branch 'merge-request-closes-issues-performance' into 'master'Robert Speicher2016-02-011-15/+7
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimize fetching issues closed by a merge request Related issue: #12419 See merge request !2625
| * | | Optimize fetching issues closed by a merge requestmerge-request-closes-issues-performanceYorick Peterse2016-02-011-15/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of running ClosingIssueExtractor for every commit in a merge request we can gather all the commit messages (and the merge request description), concatenate all this together and then run ClosingIssueExtractor only once. The result of this is that MergeRequest#closes_issues is now between 3.5x and 4x faster than the old setup. Using a merge request with 10 commits (each referencing a number of issues to close) this reduced the call duration from around 200 milliseconds to around 50 milliseconds. As a result of these changes the Jira related tests for MergeRequest#closes_issues have been removed. These tests stubbed Commit#closes_issues meaning that the only code that was really tested was the call to Array#uniq to filter out duplicate issues. As this code is no longer used (nor present) the corresponding tests were removed. Related: gitlab-org/gitlab-ce#12419
* | | | Merge remote-tracking branch 'origin/background-delete-process'Dmitriy Zaporozhets2016-01-301-3/+3
|\ \ \ \
| * | | | First pass at deleting projects in the background.Josh Frye2016-01-291-3/+3
| | | | |
* | | | | Fix old version warning when viewing wiki latest version via version_idfix-viewing-wiki-page-lastest-version-via-version-idDouglas Barbosa Alexandre2016-01-291-0/+32
|/ / / /
* | | | Merge branch 'hotfix/ruby-21-broken-update' into 'master' Marin Jankovski2016-01-291-6/+6
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fix syntax error on 2.1 and rubocop on 2.2 Background: Hashes `{:'key': 'value'}` are not valid in 2.1 but are recommended by Rubocop on 2.2. We only use those when we have a key such as `weird-key`, `weird.key`, etc... We could disable Rubocop but it wouldn't warn us about the recommended syntax since `Ruby 1.9`: `{key: 'value'}`, which is valid for `Ruby 1.9+`. Workaround 1 could be disabling `Style/HashSyntax:` in `rubocop.yml`. Workaround 2 (tried in this MR) is to trick Rubocop using `.to_sym` which is effectively the same as adding the `:`. This would allow to keep the warning in place. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/12801 See merge request !2637
| * | | | trick rubocop and temporarily add ruby 2.1 images for any branchJames Lopez2016-01-281-6/+6
| |/ / /
* | | | Merge branch 'master' into mr-merge-basemr-merge-baseDouwe Maan2016-01-282-27/+6
|\ \ \ \ | |/ / /
| * | | Merge branch 'update-ruby-2.2.4' into 'master' Douwe Maan2016-01-271-6/+6
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update Ruby version to 2.2.4 (latest previous stable) and update docs Tests and issues added to https://github.com/gitlabhq/gitlabhq/issues/8696 were all fine after the upgrade. Main issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/3340 See merge request !2534
| | * \ \ Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into update-ruby-2.2.4James Lopez2016-01-273-0/+99
| | |\ \ \
| | * | | | fix rubocop new 2.2 syntax issuesJames Lopez2016-01-251-6/+6
| | | | | |
| * | | | | Merge branch 'events-performance' into 'master' Robert Speicher2016-01-271-21/+0
| |\ \ \ \ \ | | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve performance of retrieving last update times for events See 75195eefcca4cb3961986c90c8e837da02f30134 and https://gitlab.com/gitlab-org/gitlab-ce/issues/12415#note_3387317 for the juicy details. Related issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/12415 See merge request !2613
| | * | | | Use Atom update times of the first eventevents-performanceYorick Peterse2016-01-271-21/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By simply loading the first event from the already sorted set we save ourselves extra (slow) queries just to get the latest update timestamp. This removes the need for Event.latest_update_time and significantly reduces the time needed to build an Atom feed. Fixes gitlab-org/gitlab-ce#12415
* | | | | | Fix specsDouwe Maan2016-01-281-1/+1
|/ / / / /
* | | | | Update ExternalIssue regex for JIRA integrationBlake Hitchcock2016-01-261-0/+15
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pattern in the `::reference_pattern` class method in the ExternalIssue model does not match all valid forms of JIRA project names. I have updated the regex to match JIRA project names with numbers and underscores. More information on valid JIRA project names can be found here: https://confluence.atlassian.com/jira/changing-the-project-key-format-192534.html * The first character must be a letter, * All letters used in the project key must be from the Modern Roman Alphabet and upper case, and * Only letters, numbers or the underscore character can be used.
* | | | Prioritize previewable over plain README filesprioritize-previewable-over-plain-readmesDouglas Barbosa Alexandre2016-01-251-0/+64
| | | |
* | | | Merge branch 'update-gitlab-git' into 'master' Douwe Maan2016-01-251-0/+20
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | Update gitlab_git & use new method for counting branches Corresponding gitlab_git merge request detailing some of the rationale behind this: https://gitlab.com/gitlab-org/gitlab_git/merge_requests/62 Fixes #12418 See merge request !2535
| * | | Use branch_count in Repository#has_visible_content?Yorick Peterse2016-01-211-0/+20
| | | | | | | | | | | | | | | | | | | | Gitlab::Git::Repository#branch_count is a tad faster than the previous setup. See gitlab-org/gitlab_git!62 for more information.
* | | | Merge branch 'ci/recursive-artifacts-entries' into 'master' Robert Speicher2016-01-211-4/+4
|\ \ \ \ | |/ / / |/| | | | | | | | | | | Add method to calculate total size of artifacts in subpath See merge request !2500