Commit Graph

73 Commits

Author SHA1 Message Date
Douwe Maan c8b63a28af Improve performance of finding last deployed environment 2017-02-06 16:12:24 -06:00
Douwe Maan 27f2ca9418 Add 'View on [env]' link to blobs and individual files in diffs 2017-02-06 16:12:23 -06:00
Douwe Maan 742cee756b Merge branch 'jej-22869' into 'security'
Fix information disclosure in `Projects::BlobController#update`

It was possible to discover private project names by modifying `from_merge_request`parameter in `Projects::BlobController#update`. This fixes that.

- [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md) entry added
- Tests
  - [x] Added for this feature/bug
  - [ ] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

https://gitlab.com/gitlab-org/gitlab-ce/issues/22869

See merge request !2023
2016-11-28 21:25:18 -03:00
Yar 8782bb96cc Unify anchor link format for MR diff files !7298
Right now, the following naming scheme for diff files is used: diff-1, diff-2, ... and also we have "internal" format which is file-path-HASH, where HASH is sha1 of file path.
Besides, we have HASH_lineA_lineB format to link exact line number in MR diff. It makes sence to unify the way we link diff from outside, while leave "file-path-HASH" format for internal (js) usage.
Changes in this commit  allow to link diff just by HASH, if we don't want specify exact lines, also it changes "file-path-HASH" and "diff-NUMBER" links in code to this unified format.

Inspired by #24010 and !7298
2016-11-15 20:51:21 +03:00
tiagonbotelho 08dc8af733 fixes distinction between renaming a file and updating its content and
refactors update file
2016-09-09 23:05:30 -04:00
Frank West ade0c2c892 Prevents accidental overwrites of commits from UI
Currently when a user performs an update of a file through the UI  and there
has already been a change committed to the file the previous commits will be
overwritten without a check to see if the file has been changed.

This commit uses the last commit sha at the time the user starts editing the
file and compares it with the current sha of the file being edited to ensure
they are the same before committing the file. If the shas do not match we
throw an exception preventing the commit from the commit from occurring.

Fixes #5857
2016-08-15 02:34:55 +00:00
Tim Masliuchenko b6d545df51 Add unfold links for Side-by-Side view 2016-08-04 09:09:59 +03:00
tiagonbotelho dd3addad48 renames :file_name to :file_path 2016-07-13 11:19:14 +01:00
tiagonbotelho 98c0eb4615 test for nil params :file_name 2016-07-12 15:55:16 +01:00
tiagonbotelho 893f3f2856 refactors update action to change commit_params with the correct path 2016-07-12 15:55:16 +01:00
tiagonbotelho cf96c7596a changes the usasge of path to file_path on blob_controller for compatibillity with the create action 2016-07-12 15:55:16 +01:00
tiagonbotelho 4deab9a540 fixes merge request edit bug where it would generate a cloned file and not remove the previous one 2016-07-12 15:54:17 +01:00
tiagonbotelho b0ce99f5b0 implements the form for renaming the new filename on the file edit page 2016-07-12 15:48:43 +01:00
tiagonbotelho fba72e1e0c creates the update_file method in repository.rb and applies changes accordingly 2016-07-12 15:48:24 +01:00
tiagonbotelho 09194eebff successfully adds the new version with the updated name on the projects repo 2016-07-12 15:46:14 +01:00
tiagonbotelho d9561118e8 implements the form for renaming the new filename on the file edit page 2016-07-12 15:46:14 +01:00
tiagonbotelho f85834bc96 remove prints and useless comments 2016-07-12 15:46:14 +01:00
tiagonbotelho 10954f93e9 successfully adds the new version with the updated name on the projects repo 2016-07-12 15:45:59 +01:00
tiagonbotelho 50613fc6d3 implements the form for renaming the new filename on the file edit page 2016-07-12 15:44:57 +01:00
tiagonbotelho fc747dc346 fixes merge request edit bug where it would generate a cloned file and not remove the previous one 2016-07-12 15:42:19 +01:00
tiagonbotelho 1d5d5b1a42 refactors blob_controller 2016-07-12 15:33:39 +01:00
tiagonbotelho 9951854648 creates the update_file method in repository.rb and applies changes accordingly 2016-07-12 15:24:17 +01:00
tiagonbotelho bb627b6fc2 implements the form for renaming the new filename on the file edit page 2016-07-12 15:23:35 +01:00
tiagonbotelho ea50760b02 remove prints and useless comments 2016-07-12 15:23:02 +01:00
tiagonbotelho ac30c60ad9 successfully adds the new version with the updated name on the projects repo 2016-07-12 15:22:54 +01:00
tiagonbotelho b34310ae9e implements the form for renaming the new filename on the file edit page 2016-07-12 15:22:17 +01:00
Douwe Maan a9fa45f09e Represent DiffRefs as proper class instead of tuple array 2016-07-06 18:50:58 -04:00
Ruben Davila 7627cc1989 Validate presence of essential params for diff rendering
This will avoid application errors generated by the assumption of the
presence of these params.
2016-06-24 16:20:53 -05:00
Robert Speicher 8c454b3624 Add a `Blob` model that wraps `Gitlab::Git::Blob`
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.
2016-02-18 22:45:30 -05:00
Jacob Vosmaer 51574d779c Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into lazy-blobs 2016-02-01 13:51:05 +01:00
Jacob Vosmaer 64c8ee47c9 WIP lazy blobs 2016-02-01 10:41:52 +01:00
Douwe Maan 150b4f66e6 Make sure non-highlighted diffs are still escaped 2016-01-22 01:47:17 +01:00
Douwe Maan 8dfad143d4 Add inline diff markers in highlighted diffs. 2016-01-14 22:28:07 +01:00
Rubén Dávila c476395b4d Reuse existent vars with ref and path. #3945 2016-01-12 11:14:41 -05:00
Rubén Dávila 21b602c60a Change strategy to highlight diffs. #3945
Now we apply syntax highlighting to the whole old and new files.
This basically help us to highlight adequately multiline content.
2016-01-07 22:37:01 -05:00
Rubén Dávila 3fbcf52ec8 Apply syntax highlighting when expanding diff plus some refactor. #3945 2015-12-31 01:05:52 -05:00
Douwe Maan d9c82d679f Automatically fork a project when not allowed to edit a file. 2015-12-18 10:03:34 +01:00
Douwe Maan df6750d3d6 Default target branch to patch-n when editing file in protected branch 2015-12-08 16:42:10 +01:00
Douwe Maan f3cfd20952 DRY up code 2015-11-18 17:17:38 +01:00
Douwe Maan e945ec0280 Add "Start a new merge request" option to every commit form 2015-11-17 18:53:56 +01:00
Douwe Maan 0b540a0fad Merge branch 'master' into dirceu/gitlab-ce-new-merge-request-from-file-edit 2015-11-17 17:01:28 +01:00
Ben Ford 3be9d2c422 Add ability to create directories in the editor
Simply type a name with a `/` directory separator and new directories
will be created. This does not do the fancy UI work that github.com
does, but it will get the job done.

I could not find tests for file creation, so I didn't add a test for
this slight behaviour modification. I did test directory traversals
though, using both absolute paths like `/tmp/foo.txt` and relative paths
like `../../foo.txt`. Neither case escaped the repository, though
attempting to traverse with a relative path resulted in a 500 error that
did not affect application stability upon reload.
2015-10-29 15:49:07 +01:00
Dirceu Pereira Tiegs 3d50b99d01 Add option to create merge request when editing/creating a file 2015-10-19 20:25:35 -02:00
Valery Sizov 8346dde052 Only render 404 page from /public 2015-10-13 20:12:34 +03:00
Stan Hu 0ab6ca93aa Add directory feature button
Change "+" icon under "Files" section to have three options:

* Create file
* Upload file
* New directory

Upload file is no longer accessible from the "Create file" page.
Users can now select a target branch in upload file as well.

Closes #2799: Fixes a bug where file modes were overwritten after a commit

Closes https://github.com/gitlabhq/gitlabhq/issues/8253: Existing files
can no longer be overwritten in the "Create file" section.

Closes #2557
2015-10-07 04:22:55 -07:00
Stan Hu ac855e5ed3 Move partial locals out of controller 2015-09-17 07:24:45 -07:00
Stan Hu d9af6f79ed Change the replace placeholder to use the filename
Dynamically adjust placedholder for uploads and fix Dropzone event handlers

Override error handler to prevent error messages from being inserted underneath image preview

Fix tests

Use regexp instead of startsWith for better browser compatibility

Remove duplicate code in _replace.html.haml and use one template

Remove files upon error and retain alert messages until user adds a new file
2015-09-15 13:07:32 -07:00
liyakun e2ece2bc35 Add "Replace" and "Upload" features
Refactor upload and replace functionality

    Rename file and move CSS

    Fix typo

    Make dropzone a div

    Remove unnecessary file

    Change color of "upload existing one"

    Add missing changes
2015-09-15 02:12:56 +02:00
Dmitriy Zaporozhets 3e259ea8bc Revert "Merge branch 'revert-satellites' into 'master' "
This reverts commit 5daf44b7c8, reversing
changes made to 2f706fbd23.
2015-08-11 14:33:31 +02:00
Dmitriy Zaporozhets d4cfa0bf76
Revert "Refactor web editor"
This reverts commit dfccb06dda.

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-08-11 11:49:09 +02:00