Commit Graph

56 Commits

Author SHA1 Message Date
GitLab Bot b0139a824f Add latest changes from gitlab-org/gitlab@master 2022-06-30 12:09:03 +00:00
GitLab Bot 1f6abbe6fa Add latest changes from gitlab-org/gitlab@master 2022-05-18 21:07:37 +00:00
GitLab Bot 8d9963a8e3 Add latest changes from gitlab-org/gitlab@master 2022-05-13 21:08:46 +00:00
GitLab Bot cd40e11c57 Add latest changes from gitlab-org/gitlab@master 2022-04-19 18:09:14 +00:00
GitLab Bot 4001deba73 Add latest changes from gitlab-org/gitlab@master 2022-04-05 15:08:37 +00:00
GitLab Bot b72218d98e Add latest changes from gitlab-org/gitlab@master 2022-03-30 00:09:03 +00:00
GitLab Bot 95b9a603c3 Add latest changes from gitlab-org/gitlab@master 2022-02-22 15:18:06 +00:00
GitLab Bot 4d3bbc4990 Add latest changes from gitlab-org/gitlab@master 2022-01-24 12:10:54 +00:00
GitLab Bot 0512d12bf1 Add latest changes from gitlab-org/gitlab@master 2021-11-19 12:12:41 +00:00
GitLab Bot f78f3d8678 Add latest changes from gitlab-org/gitlab@master 2021-11-12 03:12:11 +00:00
GitLab Bot b1159cdc7a Add latest changes from gitlab-org/gitlab@master 2021-11-06 00:13:26 +00:00
GitLab Bot f8975b16d1 Add latest changes from gitlab-org/gitlab@master 2021-07-01 21:08:38 +00:00
GitLab Bot bdca097916 Add latest changes from gitlab-org/gitlab@master 2020-08-11 03:11:00 +00:00
GitLab Bot c59765a50a Add latest changes from gitlab-org/gitlab@master 2020-06-24 18:09:03 +00:00
GitLab Bot 808c799a67 Add latest changes from gitlab-org/gitlab@master 2020-05-22 12:08:15 +00:00
GitLab Bot c74b7b5e43 Add latest changes from gitlab-org/gitlab@master 2020-04-28 12:09:44 +00:00
GitLab Bot d466ee5042 Add latest changes from gitlab-org/gitlab@master 2020-02-13 21:08:59 +00:00
GitLab Bot 208e2e308c Add latest changes from gitlab-org/gitlab@master 2020-02-02 06:08:56 +00:00
GitLab Bot 600ca97812 Add latest changes from gitlab-org/gitlab@master 2020-01-15 21:08: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
Mark Chao 8723f29255 Fix diff bottom expand button appears twice
This is a quick fix by only append match line once
when calling diff_lines_for_serializer multiple time.

Also enable feature by default
2019-03-21 23:08:29 +08:00
Phil Hughes b14de8e1f5 Add option to expand diff to full file
The user can also toggle between the diff changes and
the full file diff.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/19054
2019-03-06 15:51:44 +08:00
Francisco Javier López 5a3e6fdff9
Fixing image lfs bug and also displaying text lfs
This commit, introduced in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/23812,
fixes a problem creating a displaying image diff notes when the image
is stored in LFS. The main problem was that `Gitlab::Diff::File` was
returning an invalid valid in `text?` for this kind of files.

It also fixes a rendering problem with other LFS files, like text
ones. They LFS pointer shouldn't be shown when LFS is enabled
for the project, but they were.
2018-12-27 16:51:07 +01:00
Sean Nichols ece6df18f8 Fix redundant returns in spec file 2018-12-13 02:24:31 -05:00
Sean Nichols 4d2448e03a Add tests and move empty file message into own component 2018-12-13 01:49:32 -05:00
Oswaldo Ferreira f9b4130bb7 Comment on any expanded diff line on MRs 2018-11-09 16:56:48 -02:00
Oswaldo Ferreira 198402b38b Revert "Merge branch 'osw-comment-on-any-line-on-diffs' into 'master'"
This reverts commit a82a595728, reversing
changes made to e7df959b8f.
2018-11-07 19:57:26 -02:00
Oswaldo Ferreira ec66ef1b74 Comment on any expanded diff line on MRs 2018-11-06 17:39:31 -02:00
Oswaldo Ferreira 5dce096cf8 Use standalone diff stats RPC on every comparison view 2018-09-19 12:26:28 +00:00
Jan Provaznik 26a8472d6d Don't add bottom 'match' line for deleted files
If a file is deleted, its new_pos is 0 (less than
total_blob_lines), but there is no reason to add the
bottom 'match' line in this case because there is not
extra content which could be expanded.
2018-06-28 22:53:35 +02:00
Jacob Vosmaer f376347f24 Find and mark more Git disk access locations, part 2 2018-06-12 14:33:37 +02:00
Oswaldo Ferreira f46739191a Adjust insufficient diff hunks being persisted on NoteDiffFile
This currently causes 500's errors when loading the MR page
(Discussion) in a few scenarios.

We were not considering detailed diff headers such as
"--- a/doc/update/mysql_to_postgresql.md\n+++ b/doc/update/mysql_to_postgresql.md"
to crop the diff. In order to address it, we're now using
Gitlab::Diff::Parser, clean the diffs and builds Gitlab::Diff::Line objects
we can iterate and filter on.
2018-06-05 01:02:30 -03:00
Oswaldo Ferreira bb8f2520b4 Persist truncated note diffs on a new table
We request Gitaly in a N+1 manner to build discussion diffs. Once the diffs are from different revisions, it's hard to make a single request to the service in order to build the whole response.
With this change we solve this problem and simplify a lot fetching this piece of info.
2018-05-24 15:34:43 -03:00
Sean McGivern bb226a294b Ensure that we never assume old_blob or new_blob are nil
These can be a `BatchLoader` which is proxying a nil, while not being concrete
nils themselves.
2018-03-16 18:19:33 +00:00
Sean McGivern 528b5eeb76 Fix error when viewing diffs without blobs
Old merge requests can have diffs without corresponding blobs. (This also may be
possible for commit diffs in corrupt repositories.)

We can't use the `&.` operator on the blobs, because the blob objects are never
nil, but `BatchLoader` instances that delegate to `Blob`. We can't use
`Object#try`, because `Blob` doesn't inherit from `Object`.

`BatchLoader` provides a `__sync` method that returns the delegated object, but
using `itself` also works because it's forwarded, and will work for
non-`BatchLoader` instances too. So the simplest solution is to just use that
with the `&.` operator.
2018-01-04 14:33:12 +00:00
Zeger-Jan van de Weg f9565e3039
Batchload blobs for diff generation
After installing a new gem, batch-loader, a construct can be used to
queue data to be fetched in bulk. The gem was also introduced in both
gitlab-org/gitlab-ce!14680 and gitlab-org/gitlab-ce!14846, but those mrs
are not merged yet.

For the generation of diffs, both the old blob and the new blob need to
be loaded. This for every file in the diff, too. Now we collect all
these so we do 1 fetch. Three `.allow_n_plus_1_calls` have been removed,
which I expect to be valid, but this needs to be confirmed by a full CI
run.

Possibly closes:
- https://gitlab.com/gitlab-org/gitlab-ce/issues/37445
- https://gitlab.com/gitlab-org/gitlab-ce/issues/37599
- https://gitlab.com/gitlab-org/gitlab-ce/issues/37431
2017-11-21 13:53:26 +01:00
Sean McGivern e8525e107d Show un-highlighted diffs when blobs are the same
For some old merge requests, we don't have enough information to figure out the
old blob and the new blob for the file. This means that we can't highlight the
diff correctly, but we can still display it without highlighting.
2017-08-24 11:11:18 +01:00
Sean McGivern b0f09406f5 Always return a simple diff viewer
We didn't have a fallback case before, because we believed the conditions were
exhaustive. They weren't, so we can always fallback to not previewing.
2017-08-22 14:04:54 +01:00
Jacob Vosmaer 7b18c42464 Remove unused (?) code 2017-07-31 17:19:25 +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
Douwe Maan 7944254563 Implement diff viewers 2017-06-14 10:12:21 -05:00
Douwe Maan ffbbd4112e Move diffable? method from Repository to Diff::File 2017-06-08 09:32:57 -05:00
Robert Speicher 80a6d2fda2 Use `:empty_project` where possible throughout spec/lib 2017-01-25 12:25:42 -05:00
Stan Hu 0f61bb2dc5
Fix Error 500 when creating a merge request that contains an image that was deleted and added
Steps to reproduce:

1. Start with a repo with an image
2. Add a commit to delete the image
3. Add another commit to replace the image with another image

In a diff comparison, we really just compare about what the image was before the diff, not
the direct parent of the last commit. This MR fixes that.

Closes #3893, gitlab-org/gitlab-ee#678

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-14 15:57:01 +01:00
Paco Guzman c86c1905b5 switch from diff_file_collection to diffs
So we have raw_diffs too
2016-08-03 07:00:20 +02:00
Paco Guzman a404ab380d Collapsed diffs lines/size don't accumulate to overflow diffs. 2016-07-18 14:43:28 -06:00
Robert Speicher adc6ec4a9c Avoid `describe`-ing symbols in specs 2016-07-12 10:27:58 -05:00
Douwe Maan a9fa45f09e Represent DiffRefs as proper class instead of tuple array 2016-07-06 18:50:58 -04:00
Yorick Peterse 3f0d780c19 Show a notice for diffs that are too large
This builds on the changes introduced in
https://gitlab.com/gitlab-org/gitlab_git/merge_requests/72 and results
in merge requests with large diffs (e.g. due to them containing minified
CSS) loading much faster.
2016-03-18 12:30:46 +01:00
Rubén Dávila 6b9c730e91 More refactoring from last code review. #3945
* Use commit objects instead of IDs when generating diffs
* Use proper references when generating MR's source and target
* Update broken specs
2016-01-14 16:47:55 -05:00