summaryrefslogtreecommitdiff
path: root/lib/gitlab/conflict
Commit message (Collapse)AuthorAgeFilesLines
* Enable even more frozen string in lib/gitlabgfyoung2018-11-062-0/+4
| | | | | | | | | | | | | | | | | Enables frozens string for the following: * lib/gitlab/conflict/**/*.rb * lib/gitlab/cross_project_access/**/*.rb * lib/gitlab/cycle_analytics/**/*.rb * lib/gitlab/data_builder/**/*.rb * lib/gitlab/database/**/*.rb * lib/gitlab/dependency_linker/**/*.rb * lib/gitlab/diff/**/*.rb * lib/gitlab/downtime_check/**/*.rb * lib/gitlab/email/**/*.rb * lib/gitlab/etag_caching/**/*.rb Partially addresses gitlab-org/gitlab-ce#47424.
* Make Highlight accept language paramMark Chao2018-10-301-5/+31
| | | | | | | | | | This replaces the repository param. This allows more flexiblity as sometimes we have highlight content not related to repository. Sometimes we know ahead of time the language of the content. Lastly language determination seems better fit as a logic in the Blob class. `repository` param is only used to determine the language, which seems to be the responsiblity of Blob.
* Remove dependencies on LinguistZeger-Jan van de Weg2018-10-121-1/+0
| | | | | | | | | | | | | | | | This saves about 128 MB of baseline RAM usage per Unicorn and Sidekiq process (!). Linguist wasn't detecting languages anymore from CE/EE since 9ae8b57467ac8b38f1fa9020a466d94a93cbb9dd. However, Linguist::BlobHelper was still being depended on by BlobLike and others. This removes the Linguist gem, given it isn't required anymore. EscapeUtils were pulled in as dependency, but given Banzai depends on it, it is now added explicitly. Previously, Linguist was used to detect the best ACE mode. Instead, we rely on ACE to guess the best mode based on the file extension.
* Fix 500 error when trying to resolve non-ASCII conflicts in editorSean McGivern2018-03-231-1/+4
| | | | | | | | | When we added caching, this meant that calling `can_be_resolved_in_ui?` didn't always call `lines`, which meant that we didn't get the benefit of the side-effect from that, where it forced the conflict data itself to UTF-8. To fix that, make this explicit by separating the `raw_content` (any encoding) from the `content` (which is either UTF-8, or an exception is raised).
* Cache `#can_be_resolved_in_ui?` git operationscache-refactorAlejandro Rodríguez2018-03-081-2/+30
|
* Simplify conflict resolution interface and codegitaly-conflict-resolverAlejandro Rodríguez2018-01-021-3/+4
| | | | | | - Add a Gitlab::Git::Conflict::Resolution class to encapsulate resolution data - Simplify conflict file collection assembly
* Simplify conflict resolver interfacegitaly-conflicts-prepAlejandro Rodríguez2017-12-141-3/+3
| | | | | | | | | This does two things: - Pass commit oids instead of `Gitlab::Git::Commit`s. We only need the former. - Depend on only the target repository for conflict listing. For conflict resolution, treat one repository as a remote one so that we can implement it as such in Gitaly.
* Use memoization for commits on diffsZeger-Jan van de Weg2017-12-121-0/+2
| | | | | | | | | | | | | | | | The Gitaly CommitService is being hammered by n + 1 calls, mostly when finding commits. This leads to this gRPC being turned of on production: https://gitlab.com/gitlab-org/gitaly/issues/514#note_48991378 Hunting down where it came from, most of them were due to MergeRequest#show. To prove this, I set a script to request the MergeRequest#show page 50 times. The GDK was being scraped by Prometheus, where we have metrics on controller#action and their Gitaly calls performed. On both occations I've restarted the full GDK so all caches had to be rebuild. Current master, 806a68a81f1baee, needed 435 requests After this commit, 154 requests
* Move line code generation into Gitlab::Gitconflict-resolution-refactorAlejandro Rodríguez2017-10-121-12/+1
| | | | Having a distinct class just for that was a bit overkill
* Create a Gitlab::Git submodule for conlict-related filesAlejandro Rodríguez2017-10-122-6/+9
| | | | Rename classes to (hopefully) clearer names while we're doing that.
* Refactor conflict resolution to contain git ops within Gitlab::GitAlejandro Rodríguez2017-10-124-227/+38
| | | | | This prepares the codebase for a Gitaly migration. See https://gitlab.com/gitlab-org/gitaly/issues/553
* Move Gitlab::Diff::LineCode to module Gitlab::GitAlejandro Rodríguez2017-10-121-1/+1
|
* Encapsulate git operations for conflict resolution into libAlejandro Rodríguez2017-10-121-13/+49
|
* Decrease Cyclomatic Complexity threshold to 13Maxim Rydkin2017-09-121-9/+19
|
* Prepare GitOperationService for move to Gitlab::GitJacob Vosmaer2017-08-311-1/+1
|
* Incorporate Gitaly's CommitService.FindCommit RPCgitaly-find-commitAlejandro Rodríguez2017-08-071-2/+2
|
* Include new URL helpers retroactively into includers of Gitlab::Routingdm-fix-project-path-helpers-productionDouwe Maan2017-07-071-1/+1
|
* Create and use project path helpers that only need a project, no namespaceDouwe Maan2017-07-051-8/+5
|
* Enable Style/DotPosition Rubocop :cop:Grzegorz Bizon2017-06-211-3/+3
|
* Fix conflict resolution from corrupted upstreamfix-conflict-resolution-with-corrupt-reposSean McGivern2017-05-121-8/+34
| | | | | | | | | | | | | | | | | I don't know why this happens exactly, but given an upstream and fork repository from a customer, both of which required GC, resolving conflicts would corrupt the fork so badly that it couldn't be cloned. This isn't a perfect fix for that case, because the MR may still need to be merged manually, but it does ensure that the repository is at least usable. My best guess is that when we generate the index for the conflict resolution (which we previously did in the target project), we obtain a reference to an OID that doesn't exist in the source, even though we already fetch the refs from the target into the source. Explicitly setting the source project as the place to get the merge index from seems to prevent repository corruption in this way.
* Allow resolving conflicts with non-ASCII charsallow-resolving-conflicts-in-utf-8Sean McGivern2017-03-151-5/+3
| | | | | | | | | | | | | | | | | We wanted to check that the text could be encoded as JSON, because conflict resolutions are passed back and forth in that format, so the file itself must be UTF-8. However, all strings from the repository come back without an encoding from Rugged, making them ASCII_8BIT. We force to UTF-8, and reject if it's invalid. This still leaves the problem of a file that 'looks like' UTF-8 (contains valid UTF-8 byte sequences), but isn't. However: 1. If the conflicts contain the problem bytes, the user will see that the file isn't displayed correctly. 2. If the problem bytes are outside of the conflict area, then we will write back the same bytes when we resolve the conflicts, even though we though the encoding was UTF-8.
* Enable and autocorrect the CustomErrorClass copSean McGivern2017-03-014-22/+9
|
* Fix code for copsDouwe Maan2017-02-231-5/+6
|
* Enable Style/ConditionalAssignmentDouwe Maan2017-02-231-3/+3
|
* Add blob_ace_mode to conflict content responseSean McGivern2016-10-131-0/+5
|
* Simplify conflict file JSON creationSean McGivern2016-10-131-7/+15
|
* Allow setting content for resolutionsSean McGivern2016-10-134-13/+63
| | | | | | | | | | | | | | | | | | | | | | | | When reading conflicts: 1. Add a `type` field. `text` works as before, and has `sections`; `text-editor` is a file with ambiguous conflict markers that can only be resolved in an editor. 2. Add a `content_path` field pointing to a JSON representation of the file's content for a single file. 3. Hitting `content_path` returns a similar datastructure to the `file`, but without the `content_path` and `sections` fields, and with a `content` field containing the full contents of the file (with conflict markers). When writing conflicts: 1. Instead of `sections` being at the top level, they are now in a `files` array. This matches the read format better. 2. The `files` array contains file hashes, each of which must contain: a. `new_path` b. `old_path` c. EITHER `sections` (which works as before) or `content` (with the full content of the resolved file).
* Fix merge conflict size limitfix-allowed-conflict-sizeSean McGivern2016-09-071-1/+1
|
* Merge branch ↵Robert Speicher2016-08-251-0/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '21247-mergerequestscontroller-conflicts-may-fail-with-iso-8859-data' into 'master' Handle non-UTF-8 conflicts gracefully ## What does this MR do? If a conflict file isn't in a UTF-8-compatible encoding, we can't resolve it in the UI. ## What are the relevant issue numbers? Closes #21247. See merge request !5961
| * Handle non-UTF-8 conflicts gracefully21247-mergerequestscontroller-conflicts-may-fail-with-iso-8859-dataSean McGivern2016-08-251-0/+9
| | | | | | | | | | | | | | These can't be resolved in the UI because if they aren't in a UTF-8 compatible encoding, they can't be rendered as JSON. Even if they could, we would be implicitly changing the file encoding anyway, which seems like a bad idea.
* | Handle case where conflicts aren't on disk yetSean McGivern2016-08-251-0/+11
|/
* Fix bug where conflict view would have one too many context sectionsDouwe Maan2016-08-121-2/+4
|
* Find match line headers by backtrackingSean McGivern2016-08-121-11/+24
| | | | | This is more efficient for large files than performing a regex match on every single line.
* Add more tests for conflictsSean McGivern2016-08-121-1/+1
|
* Move resolving code to ResolveServiceSean McGivern2016-08-122-29/+0
|
* Clarify Conflict::File#sections methodSean McGivern2016-08-121-3/+19
|
* Don't allow resolving invalid conflictsSean McGivern2016-08-121-2/+2
| | | | | | | | | | An MR can only be resolved in the UI if: - It has conflicts. - It has valid diff_refs (in other words, it supports new diff notes). - It has no conflicts with one side missing. - It has no conflicts in binary files. - It has no conflicts in files too large to display. - It has no conflicts containing invalid conflict markers.
* Add blob_icon to conflict file JSONSean McGivern2016-08-121-2/+4
|
* Add blob_path to conflict file JSONSean McGivern2016-08-122-4/+10
|
* Use same resolution format on FE and BESean McGivern2016-08-122-4/+5
|
* Fix specsSean McGivern2016-08-123-15/+10
| | | | | | | | - Add match line header to expected result for `File#sections`. - Lowercase CSS colours. - Remove unused `diff_refs` keyword argument. - Rename `parent` -> `parent_file`, to be more explicit. - Skip an iteration when highlighting.
* Fix match line headers at start / end of fileSean McGivern2016-08-121-16/+33
|
* Handle case where one side deleted the fileSean McGivern2016-08-121-3/+5
|
* Highlight files based on merged fileSean McGivern2016-08-121-2/+5
|
* Remove unneeded raiseSean McGivern2016-08-121-3/+0
|
* Add match line headersSean McGivern2016-08-121-1/+8
|
* Raise errors for large and binary filesSean McGivern2016-08-121-1/+5
|
* Handle conflict resolution errors in controllerSean McGivern2016-08-122-7/+10
|
* Fix MR conflict resolution commitsSean McGivern2016-08-121-1/+1
|
* Auto-highlight conflict when rich_text is calledSean McGivern2016-08-122-11/+8
|