summaryrefslogtreecommitdiff
path: root/app
Commit message (Collapse)AuthorAgeFilesLines
* Rename profile navigation tab 'Personal Access Tokes' to 'Access Tokens'dz-rename-personal-access-tokensDmitriy Zaporozhets2016-07-111-1/+1
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Merge branch 'dz-sidebar-shadow' into 'master' Dmitriy Zaporozhets2016-07-111-0/+7
|\ | | | | | | | | | | | | Add side shadow for unpinned sidebar See merge request !5167
| * Refactor box-shadow style for sidebar to satisfy css lintdz-sidebar-shadowDmitriy Zaporozhets2016-07-111-1/+1
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
| * Add side shadow for unpinned sidebarDmitriy Zaporozhets2016-07-091-0/+7
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Merge branch 'dz-today-issue-color' into 'master' Dmitriy Zaporozhets2016-07-111-2/+2
|\ \ | | | | | | | | | | | | | | | | | | Make color that highligh today issues more lightweight See merge request !5168
| * | Lower case todya issue colorsdz-today-issue-colorDmitriy Zaporozhets2016-07-111-2/+2
| | | | | | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
| * | Make color that highligh today issues more lightweightDmitriy Zaporozhets2016-07-091-2/+2
| |/ | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Merge branch 'sshkey-ux' into 'master' Rémy Coutable2016-07-111-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add reminder to not paste private SSH keys ## What does this MR do? Just got the "How would you make GitLab better?" mail and thought that I could follow it. This commit adds a short reminder to not paste the private part of an SSH key to the form where one can add SSH keys to one's account. I think that's an useful message, both for people who aren't that experienced yet and for people who are sleep-deprived. :-) I decided to just list the most common key type, `ssh-rsa`. The full list of key types in the [CVS repository of OpenSSH](http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/usr.bin/ssh/sshkey.c?rev=HEAD&content-type=text/plain) contains some types which I'd regard as a bit obscure. Mentioning all of those types would probably clutter the form too much. We could think about whether to list what is probably the second most common key type, namely `ssh-dss`. But note that this key type [seems to be deprecated](https://security.stackexchange.com/questions/5096/rsa-vs-dsa-for-ssh-authentication-keys). ## Are there points in the code the reviewer needs to double check? I didn't actually test this one-line change. ## Why was this MR needed? It's not, strictly speaking, needed, but could be considered a nice addition. See merge request !4399
| * | Add reminder to not paste private SSH keysIngo Blechschmidt2016-07-091-1/+1
| |/
* | Merge branch 'compare-avatar-alignment' into 'master' Robert Speicher2016-07-101-0/+6
|\ \ | |/ |/| | | | | | | | | Fix commit avatar alignment in compare view Closes #19567 See merge request !5128
| * Fixed commit avatar alignment in compare viewcompare-avatar-alignmentPhil Hughes2016-07-071-0/+6
| | | | | | | | Closes #19567
* | Make subnavigation a bit darker colorDmitriy Zaporozhets2016-07-092-9/+7
| | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | Use btn-danger for delete button.Connor Shea2016-07-081-1/+1
| |
* | Update New Snippet buttons.Connor Shea2016-07-084-43/+45
| | | | | | | | | | | | | | | | No longer shows New Snippet button to users who aren't able to create a new snippet in the given context. Also removes the plus icon from the New Snippet buttons, as they're no longer used in other creation buttons. Fixes #14595.
* | Merge branch 'cs-cropper' into 'master' Fatih Acet2016-07-0817-4/+24
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Split Cropper.js from the main JavaScript manifest. ## What does this MR do? Splits Cropper.js from the main JavaScript file. ## Are there points in the code the reviewer needs to double check? That the avatar uploader works. (It did in my testing) ## Why was this MR needed? Smaller JS payload. ## What are the relevant issue numbers? #14372 ## Does this MR meet the acceptance criteria? - Tests - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] 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 !4978
| * | Fix preferences tests.cs-cropperConnor Shea2016-06-3010-3/+12
| | |
| * | Add a helper function for getting the page path from JS.Connor Shea2016-06-292-3/+6
| | |
| * | Split Cropper.js from the main JavaScript manifest.Connor Shea2016-06-297-2/+10
| | |
* | | Merge branch 'improve-project-limit-field' into 'master' Rémy Coutable2016-07-081-1/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add min attribute to projects_limit field on user's form This PR adds `min=0` attribute to `:projects_limit` field on user's form in the admin panel. It improves UX disallowing user to enter negative values in this field. ![](http://take.ms/70V8W) See merge request !3622
| * | | Add min attribute to project_limit field on user's formAndrey Krivko2016-07-081-1/+1
| | | |
* | | | Merge branch 'rubocop/enable-identical-conditional-branches-cop' into 'master' Robert Speicher2016-07-083-19/+6
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable Style/IdenticalConditionalBranches Rubocop cop ## What does this MR do? This MR enables Rubocop cop that checks for identical lines at the end of each branch of a conditional statement. Examples: ```ruby @bad if condition do_x do_z else do_y do_z end @good if condition do_x else do_y end do_z ``` ## What are the relevant issue numbers? #17478 See merge request !5011
| * | | | Remove legacy conditional from irker service coderubocop/enable-identical-conditional-branches-copGrzegorz Bizon2016-07-081-8/+0
| | | | |
| * | | | Enable Style/IdenticalConditionalBranches Rubocop copGrzegorz Bizon2016-07-083-12/+7
| | | | |
* | | | | Merge branch 'retrieve-mr-closes-issues-just-when-required' into 'master' Rémy Coutable2016-07-083-9/+7
|\ \ \ \ \ | |_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid calculation of closes_issues. ## What does this MR do? Avoid unneeded calls to MR closes issues ## Are there points in the code the reviewer needs to double check? I'm not sure if calling this method from a view is a good practice, but I cannot see another simple way of avoiding this problem. In case we want to avoid this in the controller we need to specify the action, format and status of the merge request, because in that case we know that the `_open` partial will render. We could add some lazy evaluation but it not a thing I see in use along the app but feedback is welcome ## What are the relevant issue numbers? #14202 , #19490 ## Does this MR meet the acceptance criteria? - [x] [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~~ - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] 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 !5140
| * | | | Avoid calculation of closes_issues.retrieve-mr-closes-issues-just-when-requiredPaco Guzman2016-07-073-9/+7
| | |_|/ | |/| | | | | | | | | | We just need to get merge requests closes issues when we’re going to show them
* | | | Merge branch 'yatish27/gitlab-ce-project-commit-range-comment' into 'master' Rémy Coutable2016-07-081-2/+2
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix comment for project argument in commit_range.rb ## What does this MR do? It fixes the documentation for commit_range project argument ## Are there points in the code the reviewer needs to double check? ## Why was this MR needed? ## What are the relevant issue numbers? ## Screenshots (if relevant) ## 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 !4805
| * | | | Fix comment for project argument in commit_range.rbYatish Mehta2016-06-201-2/+2
| | | | |
* | | | | Merge branch 'dont-render-discussion-notes-on-not-html-requests'Douwe Maan2016-07-082-24/+34
|\ \ \ \ \
| * | | | | Don't render discussion notes when requesting diff tab through AJAXdont-render-discussion-notes-on-not-html-requestsPaco Guzman2016-07-082-24/+34
| | | | | |
* | | | | | Memoize MR merged/closed events retrievalmemoize_merge_request_eventsPaco Guzman2016-07-081-2/+2
| |_|_|/ / |/| | | |
* | | | | Merge branch 'feature/option-set-new-users-external' into 'master' Rémy Coutable2016-07-084-1/+10
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added setting to set new users by default as external ## What does this MR do? This implements the feature request #14508. It adds an option in the application settings to set new users by default as external. ## Are there points in the code the reviewer needs to double check? Everything. Like I mentioned in the discussion of the issue my knowledge of Ruby basically doesn't exists. I tested it on my machine and it seems to work, but as I am very unexperienced in Ruby I highly recommend to take a close look at the code. ## Why was this MR needed? It was requested by @DouweM to work on the issue with the proposed changes by me. ## What are the relevant issue numbers? This MR is for the issue #14508 that followed up after the implementation of #4009. See merge request !4545
| * | | | | Added setting to set new users by default as externalDravere2016-07-074-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As requested by the issue #14508 this adds an option in the application settings to set newly registered users by default as external. The default setting is set to false to stay backward compatible.
* | | | | | Merge branch '9127-link-report-to-profile' into 'master' Robert Speicher2016-07-082-2/+7
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Link to the user's profile in the abuse reports Link to the user's profile in the abuse reports and add a link to the admin area view if the user viewing the profile is an admin Fixes #9127 See merge request !5118
| * | | | | Removed unnecessary `id` from links and corrected tests to use the proper ↵9127-link-report-to-profilePatricio Cano2016-07-072-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | matcher.
| * | | | | Added specs to check for the correct links.Patricio Cano2016-07-062-2/+2
| | | | | |
| * | | | | Link to the user's profile in the abuse reports and add a link to the admin ↵Patricio Cano2016-07-062-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | area view if the user viewing the profile is an admin
* | | | | | Revert "Revert "Merge branch 'issue_3946' into 'master' ""Robert Speicher2016-07-0717-289/+388
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit bf2a86b73cce332ff8f4392ffc8df501193f32ec.
* | | | | | Merge branch 'prefer-scope' into 'master' Douwe Maan2016-07-071-4/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use scope rather than class method ## What does this MR do? Use scope rather than class method ## Why was this MR needed? I assume this would be useful and more clear. See merge request !5133
| * | | | | | Use scope rather than class methodprefer-scopeLin Jen-Shin2016-07-071-4/+1
| | |_|_|/ / | |/| | | |
* | | | | | Merge branch 'prefer-ref' into 'master' Douwe Maan2016-07-072-4/+4
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prefer ref rather than id because id is shadowing database id ## What does this MR do? Just a local variable renaming. ## Why was this MR needed? Prefer ref rather than id because id is shadowing database id. See merge request !5134
| * | | | | | Also use ref in Repository#commitprefer-refLin Jen-Shin2016-07-071-2/+2
| | | | | | |
| * | | | | | Prefer ref rather than id because id is shadowing database idLin Jen-Shin2016-07-071-2/+2
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some context: http://doc.gitlab.com/ce/api/repository_files.html#get-file-from-repository http://doc.gitlab.com/ce/api/repositories.html#list-repository-tree Slack: https://gitlab.slack.com/archives/questions/p1467890450002077
* | | | | | Merge remote-tracking branch 'origin/master'Robert Speicher2016-07-0712-58/+212
|\ \ \ \ \ \
| * \ \ \ \ \ Merge branch '18627-wildcard-branch-protection' into 'master' Douwe Maan2016-07-0712-58/+212
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow specifying protected branches using wildcards Closes #18627 # Tasks - [ ] #18627 !4665 Allow specifying protected branches using wildcards - [x] Find existing usages of protected branches - Protecting branches - `ProtectedBranchesController` is used to mark a branch protected/unprotected - `API::Branches` can be used to mark a branch protected/unprotected - Enforcing branch protection - `Gitlab::GitAccess` has helpers (`can_push_to_branch?`, `check`) that are used to deny pushes if a branch is protected - Over SSH: `gitlab-shell` receives a push, and calls `/allowed` on the GitLab API, which calls `GitAccess.check` - Over HTTP: - `gitlab-workhorse` receives the request, and forwards it to rails - Rails (in the `GitHttpController#git-recieve-pack`) runs basic checks (is the user logged in, not protected branch checks) and returns ok with `GL_ID` and `RepoPath` - `gitlab-workhorse` looks at the response, and calls the relevant `gitlab-shell` action from `git-http/handlePostRPC` - Rest of this flow is the same as the SSH flow above - [x] Implementation - [x] Backend - [x] Change `project#protected_branch?` to look at wildcard protected branches - [x] Change `project#developers_can_push_to_protected_branch?` - [x] Change `project#open_branches` - [x] Better error message when creating a disallowed branch from the Web UI - [x] Frontend - [x] Protected branches page should allow typing out a wildcard pattern - [x] Add help text explaining the use of wildcards - [x] Show matching branches for each protected branch - [x] ~~On the index page~~ - [x] On a show page - [x] Index? - [x] Can't have the "last commit" column for wildcard protected branches - [x] Fix / write tests - [x] What happens if a hook is missing in dev? - [x] Refactor - [x] Test workflows - Create a branch matching a wildcard pattern - Push to a branch matching a wildcard pattern - Force push to a branch matching a wildcard pattern - Delete a branch matching a wildcard pattern - [x] Test using Web UI - [x] Test over SSH - [x] Test over HTTP - [x] Test as developer and master - [x] Investigate performance - [x] Test with a large number of protected branches / branches - [x] Paginate list of protected branches - [x] ~~Possibly rewrite `open_branches`~~ - [x] Add `iid`s to existing `ProtectedBranch`es - [x] Add documentation - [x] Add CHANGELOG entry - [x] Add screenshots - [x] Make sure [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/2f753e3ed2ce681b4444944d521f4419e8ed37f7/builds) passes - [x] Assign to endboss for review - [x] Address @DouweM's comments - [x] `protected_branch_params` - [x] `exact_match` instead of `explicit_match` - [x] When would self.name be blank? - [x] Move `protected_branches.each` to a partial - [x] Move `matching_branches.each` to a partial - [x] If the branch is in @matching_branches, it's not been removed - [x] move this regex to a method and memoize it - [x] `commit_sha` directly for exact matches - [x] Number of matches for wildcard matches, with a link - [x] Wait for [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/43f9ce0e88194b8f719bb1c1e656b7fc13278d56/builds) to pass - [x] Respond to @DouweM's comments - [x] Don't use iid - [x] Controller should use `@project.protected_branches.new` - [x] move the memoization to `def wildcard_regex` - [x] render with `collection: @protected_branches` - [x] Wait for [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/f7beedf122fa0c7aa89e86181fe7499321fb10ca/builds) to pass - [x] Wait for @DouweM's review - [x] Wait for @jschatz1's review - [x] Respond to @jschatz1's comments - [x] Use the new dropdown style - [x] description should be moved to the description section without the styling - [x] Protect button should be disabled when no branch is selected - [x] Update screenshots - [x] Merge conflicts - [x] Make sure [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/20f3cfe8d5540eab64c2ba548043d600b28c61ba/builds) passes - [ ] Revisit performance, possibly with staging/production data - [ ] Get a dump of staging / run against staging live - [ ] Get SSH access to staging - [ ] Wait for review/merge # Screenshots ## Creating wildcard protected branches ![1](/uploads/9446afccfdf6fa381e00c800dd2cc82e/1.png) ![2](/uploads/0b154503b297a818d3577488c575d845/2.png) ![3](/uploads/36217f79df9e41cc1550601f02627fe8/3.png) ![4](/uploads/041ca9bd529bcfa5373fca67e917cbcb/4.png) ### Using the `GLDropdown` component ![2016-06-30_14-16-15](/uploads/508afc2a5e2463c2954641409a560d88/2016-06-30_14-16-15.gif) ## Enforcing wildcard protected branches ### From the Web UI ![Screen_Shot_2016-06-20_at_1.21.18_PM](/uploads/8b5d4b1911e9152698a0488daf1880bc/Screen_Shot_2016-06-20_at_1.21.18_PM.png) ### Over SSH ![SSH](/uploads/7365989d7e4c406ef37b6ae5106442c9/SSH.gif) ### Over HTTPS ![HTTPS](/uploads/a7c0f56ae58efcffc75e6700fa2f4ac0/HTTPS.gif) ## Listing matching branches ![Screen_Shot_2016-06-20_at_1.33.44_PM](/uploads/d054113022f5d7ec64c0e57e501ac104/Screen_Shot_2016-06-20_at_1.33.44_PM.png) See merge request !4665
| | * | | | | | Have `Project#open_branches` return branches that are matched by a wildcard ↵18627-wildcard-branch-protectionTimothy Andrew2016-07-072-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | protected branch. 1. The `open_branches` method is used to provide a list of branches while creating a protected branch. 2. It makes sense to include branches which are matched by one or more wildcard protected branches, since the user might want to make exact protected branches from these as well. 3. This also provides a large performance improvement. On my machine, in a project with 5000 branches and 2000 protected branches, the `ProtectedBranches#index` page went from a 40 seconds load time to 4 seconds (10x speedup).
| | * | | | | | Use the `GLDropdown` component to select protected branches.Timothy Andrew2016-07-075-10/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Modify the component to support a callback for every key press in the filter. We need this so we can update the "Create: <branch_name" label. 2. Modify the component to use `$(<selector>).first().click()` instead of `$(selector)[0].click()`, because the latter is non-standard, and doesn't work in PhantomJS.
| | * | | | | | Add documentation for wildcard protected branches.Timothy Andrew2016-07-051-1/+2
| | | | | | | |
| | * | | | | | Improve the error message displayed when branch creation fails.Timothy Andrew2016-07-051-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note: This feature was developed independently on master while this was in review. I've removed the conflicting bits and left the relevant additions, mainly a test for `Gitlab::Git::Hook`. The original commit message follows: 1. `gitlab-shell` outputs errors to `stderr`, but we weren't using this information, prior to this commit. Now we capture the `stderr`, and display it in the flash message when branch creation fails. 2. This can be used to display better errors for other git operation failures with small tweaks. 3. The return value of `Gitlab::Git::Hook#trigger` is changed from a simple `true`/`false` to a tuple of `[status, errors]`. All usages and tests have been updated to reflect this change. 4. This is only relevant to branch creation _from the Web UI_, since SSH and HTTP pushes access `gitlab-shell` either directly or through `gitlab-workhorse`. 5. A few minor changes need to be made on the `gitlab-shell` end. Right now, the `stderr` message it outputs is prefixed by "GitLab: ", which shows up in our flash message. This is better removed.
| | * | | | | | Modify the frontend for wildcard protected branches.Timothy Andrew2016-07-058-37/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Allow entering any branch name for a protected branch. - Either pick from a list of options, or enter it manually - You can enter wildcards. 2. Display branches matching a protected branch. - Add a `ProtectedBranches#show` page that displays the branches matching the given protected branch, or a message if there are no matches. - On the `index` page, display the last commit for an exact match, or the number of matching branches for a wildcard match. - Add an `iid` column to `protected_branches` - this is what we use for the `show` page URL. - On the off chance that this feature is unnecessary, this commit encapsulates it neatly, so it can be removed without affecting anything else. 3. Remove the "Last Commit" column from the list of protected branches. - There's no way to pull these for wildcard protected branches, so it's best left for the `show` page. - Rename the `@branches` instance variable to `@protected_branches` - Minor styling changes with the "Unprotect" button - floated right like the "Revoke" button for personal access tokens 4. Paginate the list of protected branches. 5. Move the instructions to the left side of the page.
| | * | | | | | Support wildcard matches for protected branches at the model level.Timothy Andrew2016-07-052-13/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. The main implementation is in the `ProtectedBranch` model. The wildcard is converted to a Regex and compared. This has been tested thoroughly. - While `Project#protected_branch?` is the main entry point, `project#open_branches` and `project#developers_can_push_to_protected_branch?` have also been modified to work with wildcard protected branches. - The regex is memoized (within the `ProtectedBranch` instance) 2. Improve the performance of `Project#protected_branch?` - This method is called from `Project#open_branches` once _per branch_ in the project, to check if that branch is protected or not. - Before, `#protected_branch?` was making a database call every time it was invoked (in the above case, that amounts to once per branch), which is expensive. - This commit caches the list of protected branches in memory, which reduces the number of database calls down to 1. - A downside to this approach is that `#protected_branch?` _could_ return a stale value (due to the caching), but this is an acceptable tradeoff. 3. Remove the (now) unused `Project#protected_branch_names` method. - This was previously used to check for protected branch status.