Commit Graph

213 Commits

Author SHA1 Message Date
Phil Hughes 3530274b13
only return last_commit_sha in the JSON 2018-06-15 11:19:35 +01:00
Phil Hughes e906be2f68
IDE sends last commit ID when committing changes
Closes #46192
2018-06-15 11:18:48 +01:00
Douwe Maan fbc749a96e Reuse viewer param and move logic to blob controller 2018-06-15 09:42:56 +00:00
blackst0ne 037334d2f2 [Rails5] Explicitly set request.format for blob_controller
In Rails 4.2 if params[:format] is empty, Rails set it to :html
But since Rails 5.0 the framework now looks for an extension.
E.g. for `blob/master/CHANGELOG.md` in Rails 4 the format would be
`:html`, but in Rails 5 on it'd be `:md`

This commit explicitly sets the `:html` format for all requests unless
`:format` is set by a client e.g. by JS for XHR requests.
2018-06-15 16:00:20 +11:00
Bob Van Landuyt e74879280f Allow maintainers to edit directly in a fork 2018-03-07 16:55:34 +01:00
Dmitriy Zaporozhets 8fe9995f11
Replace deprecated name_with_namespace with full_name in app and spec
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2018-03-05 16:15:26 +02:00
Bob Van Landuyt 148816cd67 Port `read_cross_project` ability from EE 2018-02-22 17:11:36 +01:00
🙈 jacopo beschi 🙉 729f05f0e3 Adds Rubocop rule for line break around conditionals 2018-01-11 16:34:01 +00:00
Robert Speicher 6552c36495 Remove a redundant `InvalidPathError` definition
This is already defined in `ExtractsPath`, which this controller
includes.
2017-12-20 16:02:36 -06:00
Phil Hughes 60ce5155c8
fixed bug with tabs not switching correctly
clears all tmp files after cancelling edit mode
2017-10-23 10:46:27 +01:00
Douwe Maan 711bb28568 Add Page-Title header to tree and blob JSON endpoints 2017-09-26 17:31:47 +02:00
Jacob Schatz 2024198da7 Many Repo Fixes 2017-08-15 19:53:41 +00:00
Luke "Jared" Bennett bbf2ef06eb
Fix ABC size of BlobController#show 2017-08-04 13:21:02 +01:00
Douwe Maan 869668c9cf Add render_error to blob JSON 2017-08-03 16:36:04 +02:00
Douwe Maan f711b2df8b Clean up some backend 2017-08-03 14:29:35 +02:00
Luke "Jared" Bennett 933cfe1e0c
Add environment instance var to BlobController#show html resp 2017-07-31 17:04:30 +01:00
Luke "Jared" Bennett 2a6f1b32dd
render blob/show if not show_new_repo? 2017-07-28 19:40:12 +01:00
Luke "Jared" Bennett 6448368b5b
Merge remote-tracking branch 'origin/master' into ide 2017-07-20 17:51:07 +01:00
Jacob Schatz 62ad011340 Get single view working. 2017-07-10 23:22:21 -04:00
Douwe Maan fe13f11041 Create and use project path helpers that only need a project, no namespace 2017-07-05 11:11:59 -05:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Douwe Maan b38c74d696 Revert 'New file from interface on existing branch' 2017-06-09 10:10:47 -05:00
Douwe Maan e6e29f9220 Use Diff::File blob methods from diff highlighter 2017-06-08 09:39:54 -05:00
Douwe Maan dbffaaa97e Blob#load_all_data! doesn’t need an argument 2017-06-07 14:28:33 -05:00
Douwe Maan aed0387f97 Consistent diff and blob size limit names 2017-05-29 17:02:02 -05:00
Douwe Maan d3b24a7638 Show last commit for current tree on tree page 2017-05-17 20:59:26 +03:00
Douwe Maan 60ebd101d0 Use blob viewers for snippets 2017-04-30 11:21:20 -05:00
Douwe Maan 0e0c760e48 Refactor overriding max size 2017-04-27 12:23:26 -05:00
Douwe Maan 121c5f6618 Add JSON endpoint to get simple blob viewer 2017-04-27 12:23:26 -05:00
Douwe Maan 7f625f06d3 Pass project to Blob 2017-04-27 12:23:26 -05:00
Douwe Maan d170133bde Refactor changing files in web UI 2017-04-20 00:37:44 +00:00
Eric Eastwood b42dc1a52b Linking to edit file directly 2017-04-06 16:36:38 +00:00
Jacopo 7b04b63eeb New directory from interface on existing branch
The user can create a new directory on a different branch than the
source branch when the branch already exists.
2017-03-21 11:51:53 +01:00
Jacopo e0fe2834eb New file from interface on existing branch
Now you can create a new file and select a target_branch != source_branch.
If the file that you want to create already exists on the target branch an error message is shown
A glDropdown is used to select and create a new branch instead of a text field.
2017-03-13 16:36:11 +01:00
Douwe Maan 6cc4cf1e15 Fix cherry-picking or reverting through an MR 2017-03-02 17:41:05 -06:00
Sean McGivern 811e598f60 Enable and autocorrect the CustomErrorClass cop 2017-03-01 15:28:10 +00:00
Douwe Maan f40716f48a No more and/or 2017-02-21 16:31:14 -06:00
dixpac fa2339641f Rename Files::DeleteService to Files::DestroyService
Reason for renaming is to comply with naming convention of services in
codebase.
2017-02-10 18:22:18 +01:00
Douwe Maan 9d7c5e7584 Address feedback 2017-02-06 18:06:46 -06:00
Douwe Maan 6edc8d50dc Add feature specs 2017-02-06 16:12:24 -06:00
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
Dmitriy Zaporozhets dfccb06dda
Refactor web editor
* fix problem with editing non-master branch
* before commit make sure branch exists
* dont allow user change file in one branch and commit to another existing branch
* remove a lot of code duplication
* remove outdated statellite errors

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-05 15:01:38 +02:00
Jeroen van Baarsen 5a4ebfb47a Fixed the Rails/ActionFilter cop
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-04-20 15:39:37 +02:00
Valery Sizov 71a844cdae Web Editor: save to new branch 2015-02-24 11:43:20 +02:00
Vinnie Okada 2a9eed6620 Merge branch 'master' into rails-4.1.9
Conflicts:
	app/views/projects/commits/_commit.html.haml
	app/views/projects/issues/_issue.html.haml
	app/views/projects/issues/_issue_context.html.haml
	app/views/projects/merge_requests/_merge_request.html.haml
	app/views/projects/merge_requests/show/_context.html.haml
2015-02-21 12:55:28 -07:00
Douwe Maan 00408f37e3 Move 'require_non_empty_project' filter to front so 'assign_ref_vars' doesn't 404. 2015-02-20 17:20:03 +01:00
Vinnie Okada 76aad9b76e Upgrade to Rails 4.1.9
Make the following changes to deal with new behavior in Rails 4.1.2:

* Use nested resources to avoid slashes in arguments to path helpers.
2015-02-14 11:09:23 -07:00
Dmitriy Zaporozhets cc39bca3fa Rubocop: Style/AlignHash enabled 2015-02-02 21:15:44 -08:00
Dmitriy Zaporozhets ed91378627 Fix blob controller rendering in case of errors 2015-01-26 15:12:13 -08:00
Dmitriy Zaporozhets 59b08942aa Refactor blob controllers 2015-01-26 15:02:28 -08:00
Valery Sizov 6f34d40436 remove auth duplication 2014-11-05 11:04:08 +02:00
Dmitriy Zaporozhets 8ad9a75f88 Merge pull request #8030 from cirosantilli/factor-authorize
Factor authorize_push! and authorize_code_access!
2014-10-21 11:43:12 +03:00
Ciro Santilli 4d0d5e79ba Factor authorize_push! and authorize_code_access!
with existing method_missing. Pattern already used extensively,
so let's be consistent and use it everywhere.
2014-10-13 21:31:49 +02:00
Ciro Santilli 2d23522107 Use :message key, not :error for File::Service. 2014-10-13 20:55:09 +02:00
skv 4e40800166 diff unfold 2014-08-14 15:48:14 +04:00
Marin Jankovski 005752e4c6 Check if blob or tree and redirect to the correct one. 2014-07-07 15:46:57 +02:00
Dmitriy Zaporozhets 237ddd6024
Improve authorization for new/edit blob pages
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-01-24 21:29:52 +02:00
Dmitriy Zaporozhets 1d2bdb4d58
Move all Context classes into Services
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-01-16 19:03:42 +02:00
Takuya Nishigori e78b90ab1d Fix messages typo 2013-12-16 17:57:50 +09:00
Dmitriy Zaporozhets bd20ec1a34 Remove file from repository feature
After click on remove file button you will be asked for commit message
via modal window. After submitting modal form file will be removed from
repository

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2013-11-19 16:14:56 +02:00
Dmitriy Zaporozhets 970d86b7c5 Refactor blob finding 2013-10-01 20:34:41 +03:00
Dmitriy Zaporozhets 1d3f03fb69 Fix blob and repo stuff after gitlab_git v3 2013-10-01 18:26:55 +03:00
Dmitriy Zaporozhets ae9dd62762 Update code to work with gitlab_git 3 2013-10-01 17:00:28 +03:00
Dmitriy Zaporozhets 2ed7cbfba4 Move projects controllers/views in Projects module 2013-06-23 19:47:22 +03:00