summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'better-parallel-diff' into 'master' Robert Speicher2016-07-131-74/+55
|\ | | | | | | | | Actually render old and new sections of parallel diff next to each other See merge request !5173
| * Actually render old and new sections of parallel diff next to each otherbetter-parallel-diffDouwe Maan2016-07-131-74/+55
| |
* | Merge branch 'dropdown-load-fix' into 'master' Douwe Maan2016-07-132-1/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | Dropdown loading time preformance fix ## What does this MR do? Optimizes the performance of the dropdown load time by just sending the required data to load the dropdown instead of the full object This MR aims to fix #17474 See merge request !5113
| * | deletes swn filetiagonbotelho2016-07-131-0/+0
| | |
| * | fixes test according to four-phase test patterntiagonbotelho2016-07-121-0/+0
| | |
| * | removes basicprojectwithaccess and replaces it with basicprojectdetailstiagonbotelho2016-07-123-9/+1
| | |
| * | changes the usage of simpleprojectdetails to already implemented ↵tiagonbotelho2016-07-122-17/+0
| | | | | | | | | | | | basicprojectsdetails and changes the url to a more reader friendly format
| * | adds basic functionality to the new endpoint of the apitiagonbotelho2016-07-123-19/+17
| | |
| * | implements filter_paramstiagonbotelho2016-07-122-0/+19
| | |
| * | changes string to symbol in paramtiagonbotelho2016-07-121-1/+1
| | |
| * | adds test to check json fields on simple request and changes the url request ↵tiagonbotelho2016-07-121-1/+1
| | | | | | | | | | | | format
| * | fixes missing field on basicprojectdetailstiagonbotelho2016-07-121-0/+1
| | |
| * | changes the usage of simpleprojectdetails to already implemented ↵tiagonbotelho2016-07-122-19/+6
| | | | | | | | | | | | basicprojectsdetails and changes the url to a more reader friendly format
| * | adds basic functionality to the new endpoint of the apitiagonbotelho2016-07-123-21/+25
| | |
| * | implements filter_paramstiagonbotelho2016-07-123-0/+21
| | |
* | | Keeps issue number when importing from Gitlab.comDouglas Barbosa Alexandre2016-07-131-0/+1
| | | | | | | | | | | | | | | With these changes we don’t lost the issue references when importing from `GitLab.com`.
* | | Merge branch '18193-developers-can-merge' into 'master' Rémy Coutable2016-07-139-136/+213
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow developers to merge into a protected branch without having push access ## What does this MR do? Adds a "Developers can merge" checkbox to protected branches much like the "Developers can push" checkbox. When the checkbox is enabled, a developer can merge MRs into that protected branch from the Web UI and from the command-line (any push that is entirely composed of merge commits is allowed). ## Are there points in the code the reviewer needs to double check? - This MR refactors the `GitAccess` module, moving parts of it to `UserAccess` and the new `ChangeAccessCheck`. - This MR refactors `GitAccessSpec`, which generates a "matrix" of tests. - The main logic "developers can merge" should be straightforward enough. - The commits are fairly atomic, and the commit messages are descriptive regarding the motivations behind every change. ## Why was this MR needed? A significant portion of this feature was implemented in !4220 (thanks, @mvestergaard!) ; I'm wrapping it up. ## What are the relevant issue numbers? #18193 Closes #967 ## Screenshots ![1](/uploads/c636e88ba38628211754e7cf122b0dc4/1.png) ![2](/uploads/5ed1e7917e2f36853a479faa565b022a/2.png) ![3](/uploads/0d202ba42e8dc6aade7bc6ac8db41ee6/3.png) ## TODO - [ ] #18193 !4892 Add "developers can merge" as an option for protected branches - [x] Review existing code - [x] Fix build - [x] Implementation / refactoring - [x] Clean up `GitAccess` - [x] Clean up `protected_branches.js.coffee` - [x] Figure out authorization issue - If we try to merge code into a protected branch for a user who doesn't have access to that branch, an auth check will fail - We need to get around this, somehow - [x] Try detecting merge commits and allowing those - [x] A push with regular commits _and_ merge commits should fail - [x] Figure out a solution - [x] Extensive tests for `MergeCommitCheck` - [x] Add tests - [x] Untested parts of original MR - [x] Improve the checks in `/allowed` - @dzaporozhets's proposal: - commits in push == commits in merge request - branch to push == target branch of merge request - merge request has required amount of approves (ee only) - merge commit in push == merge commit we created when merged via UI - save merge commit sha in database and compare with `newrev` - my proposal - /allowed finds all open merge requests with the appropriate target branch - For each MR, compare the commit SHAs in the MR to the commit SHAs in the change set - If we have a match, compare the diff of the matching MR to the diff of the change set - If we still have a match, the merge is legit - [x] Wait for replies on my proposal - [x] Pick a strategy - [x] Implementation - [x] Save `in_progress_merge_commit_sha` - [x] Check `in_progress_merge_commit_sha` - [x] Clear `in_progress_merge_commit_sha` - [x] Test / refactor - [x] Merge conflicts - [x] Verify workflows - [x] Developer with 'developer can merge' on: - [x] Can merge an MR from the Web UI - [x] Error message for conflicts in the Web UI - [x] Cannot merge an MR from the command line (HTTP) - [x] Cannot merge an MR from the command line (SSH) - [x] Cannot modify the branch otherwise - [x] Developer with 'developer can merge' off: - [x] Cannot merge an MR from the Web UI - [x] Error message for conflicts in the Web UI - [x] Cannot merge an MR from the command line (HTTP) - [x] Cannot merge an MR from the command line (SSH) - [x] Cannot modify the branch otherwise - [x] New projects created could have have "Developers can merge" turned on automatically for the default branch - [x] CHANGELOG - [x] Fix build - [x] Wait for [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/42624e3d53754064186d4ae9048e310d1d3eed0b/builds) to pass - [x] Screenshots - [x] Assign to endboss - [x] Respond to @dbalexandre's comments - [x] Duplicated line, this is equals to line 26. - [x] We aren't using any of these helpers in this migration, we can remove the include. - [x] What do you think to add a default value for this column to avoid the Three-state Boolean Problem? - [x] group all checks under Gitlab::Checks - [x] You have a default value for developers_can_merge column, but your migration doesn't add it. - [x] What do you think to rename Partially protected to anything else? - [x] Fix conflicts - [x] Make sure [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/b1cfd42f20a78fd7f844288954e97cff32962e20/builds) passes - [ ] Wait for merge See merge request !4892
| * | | Implement last round of review comments from !4892.18193-developers-can-mergeTimothy Andrew2016-07-131-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Fix typos, minor styling errors. 2. Use single quotes rather than double quotes in `user_access_spec`. 3. Test formatting.
| * | | Move all "checks" under `GitLab::Checks`.Timothy Andrew2016-07-134-21/+21
| | | | | | | | | | | | | | | | | | | | - https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4892#note_12892160 - This is more consistent.
| * | | Appease rubocop.Timothy Andrew2016-07-131-1/+0
| | | |
| * | | Refactor `Gitlab::GitAccess`Timothy Andrew2016-07-135-134/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Don't use case statements for dispatch anymore. This leads to a lot of duplication, and makes the logic harder to follow. 2. Remove duplicated logic. - For example, the `can_push_to_branch?` exists, but we also have a different way of checking the same condition within `change_access_check`. - This kind of duplication is removed, and the `can_push_to_branch?` method is used in both places. 3. Move checks returning true/false to `UserAccess`. - All public methods in `GitAccess` now return an instance of `GitAccessStatus`. Previously, some methods would return true/false as well, which was confusing. - It makes sense for these kinds of checks to be at the level of a user, so the `UserAccess` class was repurposed for this. The prior `UserAccess.allowed?` classmethod is converted into an instance method. - All external uses of these checks have been migrated to use the `UserAccess` class 4. Move the "change_access_check" into a separate class. - Create the `GitAccess::ChangeAccessCheck` class to run these checks, which are quite substantial. - `ChangeAccessCheck` returns an instance of `GitAccessStatus` as well. 5. Break out the boolean logic in `ChangeAccessCheck` into `if/else` chains - this seems more readable. 6. I can understand that this might look like overkill for !4892, but I think this is a good opportunity to clean it up. - http://martinfowler.com/bliki/OpportunisticRefactoring.html
| * | | Enforce "developers can merge" during `pre-receive`.Timothy Andrew2016-07-132-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. When a merge request is being merged, save the merge commit SHA in the `in_progress_merge_commit_sha` database column. 2. The `pre-receive` hook looks for any locked (in progress) merge request with `in_progress_merge_commit_sha` matching the `newrev` it is passed. 3. If it finds a matching MR, the merge is legitimate. 4. Update `git_access_spec` to test the behaviour we added here. Also refactored this spec a bit to make it easier to add more contexts / conditions.
| * | | Added "developers can merge" setting to protected branchesMathias Vestergaard2016-07-132-3/+15
| | | | | | | | | | | | | | | | | | | | - Cherry-picked from `mvestergaard:branch-protection-dev-merge` - https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4220
* | | | ObjectRenderer doesn't crash when no objects to cache with ↵Paco Guzman2016-07-131-4/+10
|/ / / | | | | | | | | | Rails.cache.read_multi
* | | Merge branch 'multi-line-inline-diff' into 'master' Douwe Maan2016-07-131-14/+38
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Render inline diffs for multiple changed lines following eachother Before: ![Screen_Shot_2016-07-11_at_00.08.27](/uploads/b14664211e0f5cef6e77a78eadfcbcdf/Screen_Shot_2016-07-11_at_00.08.27.png) After: ![Screen_Shot_2016-07-11_at_00.07.34](/uploads/567be631869a4867a2edf6ff7eda6369/Screen_Shot_2016-07-11_at_00.07.34.png) See merge request !5174
| * | | Rename constant to be more descriptiveDouwe Maan2016-07-131-2/+2
| | | |
| * | | Extended regexes ignore whitespace, so use \smulti-line-inline-diffDouwe Maan2016-07-121-2/+2
| | | |
| * | | Render inline diffs for multiple changed lines following eachotherDouwe Maan2016-07-111-14/+38
| | |/ | |/|
* | | Merge branch 'jacobvosmaer-gitlab/gitlab-ce-strict-host-headers'Douwe Maan2016-07-122-2/+12
|\ \ \
| * | | Defend against 'Host' header injectionJacob Vosmaer2016-07-122-2/+12
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/17877 . This change adds 'defense in depth' against 'Host' HTTP header injection. It affects normal users in the following way. Suppose your GitLab server has IP address 1.2.3.4 and hostname gitlab.example.com. Currently, if you enter 1.2.3.4 in your browser, you get redirected to 1.2.3.4/users/sign_in. After this change, you get redirected from 1.2.3.4 to gitlab.example.com/users/sign_in. This is because the address you typed in the address bar of your browser ('1.2.3.4'), which gets stored in the 'Host' header, is now being overwritten to 'gitlab.example.com' in NGINX. In this change we also make NGINX clear the 'X-Forwarded-Host' header because Ruby on Rails also uses that header the same wayas the 'Host' header. We think that for most GitLab servers this is the right behavior, and if not then administrators can change this behavior themselves at the NGINX level.
* | | Merge branch 'fix-gh-rate-limit' into 'master' Douwe Maan2016-07-121-1/+12
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix GitHub client requests when rate limit is disabled ## What does this MR do? GitHub Rate Limit API returns 404 when the rate limit is disabled. In this case we just want to return gracefully instead of spitting out an error. ## Are there points in the code the reviewer needs to double check? No. ## Why was this MR needed? GitHub importer fails when rate limit is disabled in GitHub Enterprise. ## What are the relevant issue numbers? https://gitlab.com/gitlab-org/gitlab-ee/issues/697 ## Does this MR meet the acceptance criteria? - [X] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - Tests - [X] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [ ] Branch has no merge conflicts with `master` (if you do - rebase it please) - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5191
| * | | Memoize response from `has_rate_limit?` to avoid extra API callfix-gh-rate-limitDouglas Barbosa Alexandre2016-07-121-1/+3
| | | |
| * | | Checks if rate limit is enabled instead of stubbing responseDouglas Barbosa Alexandre2016-07-121-2/+6
| | | |
| * | | Fix GItHub client requests when rate limit is disabledDouglas Barbosa Alexandre2016-07-121-0/+5
| |/ /
* | | Object renderer read_multi rendered entries from Cacheread-multi-rendered-objectsPaco Guzman2016-07-123-11/+72
|/ /
* | Merge branch 'remove-branch-api' into 'master' Rémy Coutable2016-07-121-0/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | api: expose {should,force}_remove_source_branch ## What does this MR do? Exposes the `should_remove_source_branch` and `force_remove_source_branch` booleans via the API. ## Are there points in the code the reviewer needs to double check? I don't think so. ## Why was this MR needed? See the commit message. ## What are the relevant issue numbers? N/A ## Screenshots (if relevant) N/A ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [x] API support added - Tests - [x] Added for this feature/bug - [ ] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [ ] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5184
| * | api: expose {should,force}_remove_source_branchBen Boeckel2016-07-111-0/+2
| | | | | | | | | | | | | | | Workflows which use a bot to merge should remove branches if requested. Expose the flag so that bots can request know this.
* | | Optimize system note visibility checking by hiding notes thatStan Hu2016-07-112-18/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | have been fully redacted and contain cross-project references. The previous implementation relied on Note#cross_reference_not_visible_for?, which essentially tries to render all the Markdown references in a system note and only displays the note if the user can see the referring project. But this duplicated the work that Banzai::NotesRenderer was doing already. Instead, for each note we render, we memoize the number of visible user references and use it later if it is available. Improves #19273
* | | Merge branch 'fix/import-event-error' into 'master' Robert Speicher2016-07-111-0/+9
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Fix problems with events under notes importing GitLab projects Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/19588 See merge request !5154
| * \ \ Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into ↵James Lopez2016-07-1196-319/+1321
| |\ \ \ | | |/ / | | | | | | | | fix/import-event-error
| * | | squashed - refactor to cope with sub sub N relations probably using the ↵James Lopez2016-07-111-0/+9
| | | | | | | | | | | | | | | | sub_relations method recursively.
* | | | Merge branch 'single-file-diffs' into 'master' Douwe Maan2016-07-111-0/+4
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Single file diffs Closes #14103. Related (not part of this MR): #19553. This adds a `diff_for_path` action to each place we render diffs (commit, compare, new MR, existing MR) which renders the diff for a single path. The action is always available with the same params as the 'parent' action, to make it simpler to generate the URIs. If a diff is bigger than 10 KB, it will be collapsed by default and have a data attribute added. You can then click the message or the filename to expand that diff. For expanded files, you can collapse and expand them, but they won't make any AJAX requests. ![Expand_and_collapse_diffs](/uploads/a4072029085082b85c47006f67ac531c/Expand_and_collapse_diffs.gif) See merge request !4990
| * \ \ \ Merge branch 'master' into single-file-diffsSean McGivern2016-07-118-16/+131
| |\ \ \ \ | | | |/ / | | |/| |
| * | | | Collapse large diffs by defaultSean McGivern2016-07-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | When rendering a list of diff files, skip those where the diff is over 10 KB and provide an endpoint to render individually instead.
* | | | | Merge branch 'remove-duplicate-api-field' into 'master' Rémy Coutable2016-07-111-1/+0
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | entities: remove :description from MergeRequest ## What does this MR do? Removes a duplicate `description` key from API JSON objects. ## Are there points in the code the reviewer needs to double check? No. ## Why was this MR needed? `description` is already exported via `ProjectEntity` and doesn't need to be listed in `MergeRequest` as well. ## What are the relevant issue numbers? N/A ## Screenshots (if relevant) N/A ## Does this MR meet the acceptance criteria? - [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added - Tests - [ ] Added for this feature/bug - [ ] All builds are passing - [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [ ] Branch has no merge conflicts with `master` (if you do - rebase it please) - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !5099
| * | | | | entities: remove :description from MergeRequestBen Boeckel2016-07-111-1/+0
| | |/ / / | |/| | | | | | | | | | | | | It is already part of ProjectEntity.
* | | | | Merge branch 'send-entry-via-Gitlab-Workhorse-Send-Data' into 'master' Douwe Maan2016-07-111-0/+12
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use Gitlab-Workhorse-Send-Data to send entry ## What does this MR do? Use Gitlab-Workhorse-Send-Data to send entry: Closes #19224, Closes #19128 Also requires this MR to work: https://gitlab.com/gitlab-org/gitlab-workhorse/merge_requests/53 ## Are there points in the code the reviewer needs to double check? Do we have a test for this? ## Why was this MR needed? This way gitlab-workhorse does not have to call any API. See merge request !5094
| * | | | Use Gitlab-Workhorse-Send-Data to send entry:Lin Jen-Shin2016-07-051-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #19224, Closes #19128 Also requires this MR to work: https://gitlab.com/gitlab-org/gitlab-workhorse/merge_requests/53
* | | | | Merge branch 'fix/remove-import-url-migration' into 'master' Rémy Coutable2016-07-111-0/+2
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove slow migration and add fix to sanitize errors Getting rid of the slow migration and preventing the Error to occur Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/19608 See merge request !5176
| * | | | | spec and fix for sanitize methodJames Lopez2016-07-111-0/+2
| | |/ / / | |/| | |