Commit Graph

50 Commits

Author SHA1 Message Date
GitLab Bot 3c55affa66 Add latest changes from gitlab-org/gitlab@master 2023-10-19 15:07:55 +00:00
GitLab Bot 37439afe69 Add latest changes from gitlab-org/gitlab@master 2022-12-15 12:08:09 +00:00
GitLab Bot c52a9411d8 Add latest changes from gitlab-org/gitlab@master 2022-10-27 12:11:01 +00:00
GitLab Bot fcfe959a5d Add latest changes from gitlab-org/gitlab@master 2022-09-28 21:07:58 +00:00
GitLab Bot 1d9f78b3a4 Add latest changes from gitlab-org/gitlab@master 2021-07-28 15:09:57 +00:00
GitLab Bot 7e3f469a40 Add latest changes from gitlab-org/gitlab@master 2021-07-21 21:10:10 +00:00
GitLab Bot 70cfa5e3e7 Add latest changes from gitlab-org/gitlab@master 2021-04-26 21:10:25 +00:00
GitLab Bot ede2fbdc87 Add latest changes from gitlab-org/gitlab@master 2021-04-12 09:09:09 +00:00
GitLab Bot 173bd0618f Add latest changes from gitlab-org/gitlab@master 2020-12-17 09:10:19 +00:00
GitLab Bot feb61d56e7 Add latest changes from gitlab-org/gitlab@master 2020-11-13 18:09:11 +00:00
GitLab Bot 1ec1bec4ee Add latest changes from gitlab-org/gitlab@master 2020-10-08 15:08:17 +00:00
GitLab Bot c59765a50a Add latest changes from gitlab-org/gitlab@master 2020-06-24 18:09:03 +00:00
GitLab Bot 27a18afc7d Add latest changes from gitlab-org/gitlab@master 2020-02-04 00:09:04 +00:00
GitLab Bot 22e9af3c8b Add latest changes from gitlab-org/gitlab@master 2020-01-27 12:08:35 +00:00
GitLab Bot 7f8330873c Add latest changes from gitlab-org/gitlab@master 2019-12-18 21:07:37 +00:00
GitLab Bot e723867717 Add latest changes from gitlab-org/gitlab@master 2019-12-17 18:07:48 +00:00
Thong Kuah f540ffcef6 Add frozen_string_literal to spec/lib (part 1)
Using the sed script from
https://gitlab.com/gitlab-org/gitlab-ce/issues/59758
2019-07-26 13:25:07 +12:00
Zeger-Jan van de Weg 399056ed78 Remove dependencies on Linguist
This saves about 128 MB of baseline RAM usage per Unicorn and
Sidekiq process (!).

Linguist wasn't detecting languages anymore from CE/EE since
9ae8b57467. 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.
2018-10-12 17:17:30 -07:00
Alejandro Rodríguez a99bf447a2 Remove Gitlab::Git::Repository#rugged and Gollum code
Cleanup code, and refactor tests that still use Rugged. After this, there should
be no Rugged code that access the instance's repositories on non-test
environments. There is still some rugged code for other tasks like the
repository import task, but since it doesn't access any repository storage path
it can stay.
2018-10-02 16:34:28 -03:00
Sean McGivern 0d01ac5141 Include rich_text in diff cache keys
Previously, this wasn't needed: text was normally set to the highlighted
contents anyway. Now, it is: we store different things in text and rich_text.

This caused https://gitlab.com/gitlab-com/production/issues/439.
2018-08-28 15:28:47 +01:00
Jacob Vosmaer (GitLab) edb9db37ed Add "deny disk access" Gitaly feature (tripswitch) 2018-06-01 11:56:29 +00:00
Alejandro Rodríguez bb2bf39ddf Cache `#can_be_resolved_in_ui?` git operations 2018-03-08 11:54:21 -03:00
Sean McGivern 64a9e53bd1 Fix conflict highlighting
Conflicts used to take a `Repository` and pass that to
`Gitlab::Highlight.highlight`, which would call `#gitattribute` on the
repository. Now they use a `Gitlab::Git::Repository`, which didn't have that
method defined - but defining it on `Gitlab::Git::Repository` does make it
available on `Repository` through `method_missing`, so we can do that and both
cases will work.
2017-11-17 17:57:48 +00:00
Alejandro Rodríguez faa9bd402d Create a Gitlab::Git submodule for conlict-related files
Rename classes to (hopefully) clearer names while we're doing that.
2017-10-12 22:03:15 -03:00
Alejandro Rodríguez 3fcab51ebb Refactor conflict resolution to contain git ops within Gitlab::Git
This prepares the codebase for a Gitaly migration. See
https://gitlab.com/gitlab-org/gitaly/issues/553
2017-10-12 22:03:14 -03:00
Rémy Coutable cddc5cacfb Use described_class when possible
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Rémy Coutable ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Sean McGivern ad2bfeb857 Fix conflict resolution from corrupted upstream
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.
2017-05-12 20:47:51 +01:00
Sean McGivern 96c77bf775 Allow resolving conflicts with non-ASCII chars
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.
2017-03-15 11:18:29 +00:00
Douwe Maan ad640bc5f9 Use Namespace#full_path instead of #path where appropriate 2017-02-23 17:55:01 -06:00
Douwe Maan 1fe7501b49 Revert "Prefer leading style for Style/DotPosition"
This reverts commit cb10b725c8929b8b4460f89c9d96c773af39ba6b.
2017-02-23 09:33:05 -06:00
Douwe Maan 7d4b52b27d Enable Style/WordArray 2017-02-23 09:32:41 -06:00
Douwe Maan 206953a430 Prefer leading style for Style/DotPosition 2017-02-23 09:32:22 -06:00
Robert Speicher 80a6d2fda2 Use `:empty_project` where possible throughout spec/lib 2017-01-25 12:25:42 -05:00
Sean McGivern 3764fd4b41 Add blob_ace_mode to conflict content response 2016-10-13 14:16:35 -05:00
Sean McGivern 24424d932f Fix merge conflict size limit 2016-09-07 16:00:26 +01:00
Sean McGivern 44eb3197a9 Handle non-UTF-8 conflicts gracefully
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.
2016-08-25 08:27:08 +01:00
Sean McGivern 4952a24f58 Find match line headers by backtracking
This is more efficient for large files than performing a regex match on
every single line.
2016-08-12 23:24:48 +03:00
Sean McGivern ce7eb4e492 Add more tests for conflicts 2016-08-12 23:24:48 +03:00
Sean McGivern ac9229a31b Clarify Conflict::File#sections method 2016-08-12 23:24:48 +03:00
Sean McGivern 52eb523c9b Add blob_icon to conflict file JSON 2016-08-12 23:24:47 +03:00
Sean McGivern e50e88b85c Add blob_path to conflict file JSON 2016-08-12 23:24:47 +03:00
Sean McGivern 3b84cfdc74 Use same resolution format on FE and BE 2016-08-12 23:24:46 +03:00
Sean McGivern 261d47bce9 Fix specs
- 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.
2016-08-12 23:24:46 +03:00
Sean McGivern 18398152fa Raise errors for large and binary files 2016-08-12 23:24:44 +03:00
Sean McGivern 7af277f683 Auto-highlight conflict when rich_text is called 2016-08-12 23:24:43 +03:00
Sean McGivern 14a4b17d1c Allow resolving conflicts in MR controller 2016-08-12 23:24:43 +03:00
Sean McGivern a1c7961217 Handle multiple merge conflict files in collection 2016-08-12 23:24:43 +03:00
Sean McGivern df2ed097b7 Add backend for merge conflicts reading 2016-08-12 23:24:43 +03:00