Commit Graph

394 Commits

Author SHA1 Message Date
GitLab Bot c9bef85d79 Add latest changes from gitlab-org/gitlab@master 2021-04-19 21:09:27 +00:00
GitLab Bot 413119517c Add latest changes from gitlab-org/gitlab@master 2021-04-07 18:09:45 +00:00
GitLab Bot 4d16568658 Add latest changes from gitlab-org/gitlab@master 2021-03-18 06:11:52 +00:00
GitLab Bot 099333e261 Add latest changes from gitlab-org/gitlab@master 2021-03-18 00:08:58 +00:00
GitLab Bot 9c0f4306f6 Add latest changes from gitlab-org/gitlab@master 2021-03-11 15:09:10 +00:00
GitLab Bot 5d756f9966 Add latest changes from gitlab-org/gitlab@master 2021-03-10 03:09:10 +00:00
GitLab Bot 7ff2de7c12 Add latest changes from gitlab-org/gitlab@master 2021-03-05 00:09:24 +00:00
GitLab Bot b4e854a900 Add latest changes from gitlab-org/gitlab@master 2021-02-16 15:09:50 +00:00
GitLab Bot fb994e98ec Add latest changes from gitlab-org/gitlab@master 2021-02-15 18:09:09 +00:00
GitLab Bot 9ecdb93f4e Add latest changes from gitlab-org/gitlab@master 2021-02-01 12:09:03 +00:00
GitLab Bot 76215aab04 Add latest changes from gitlab-org/gitlab@master 2021-01-26 00:08:57 +00:00
GitLab Bot 8f534e1e96 Add latest changes from gitlab-org/gitlab@master 2021-01-14 21:10:37 +00:00
GitLab Bot 173bd0618f Add latest changes from gitlab-org/gitlab@master 2020-12-17 09:10:19 +00:00
GitLab Bot a79324ad1f Add latest changes from gitlab-org/gitlab@master 2020-12-15 09:10:00 +00:00
GitLab Bot 319ac09313 Add latest changes from gitlab-org/gitlab@master 2020-12-14 18:09:48 +00:00
GitLab Bot a2f16969fa Add latest changes from gitlab-org/gitlab@master 2020-12-04 06:09:34 +00:00
GitLab Bot feb61d56e7 Add latest changes from gitlab-org/gitlab@master 2020-11-13 18:09:11 +00:00
GitLab Bot 2b1e7f7dac Add latest changes from gitlab-org/gitlab@master 2020-10-27 15:08:39 +00:00
GitLab Bot c311ce331f Add latest changes from gitlab-org/gitlab@master 2020-10-16 03:08:29 +00:00
GitLab Bot 6e91fbf774 Add latest changes from gitlab-org/gitlab@master 2020-10-13 12:08:41 +00:00
GitLab Bot 62f486eb35 Add latest changes from gitlab-org/gitlab@master 2020-10-02 15:08:13 +00:00
GitLab Bot b85aae44f9 Add latest changes from gitlab-org/gitlab@master 2020-09-21 15:09:44 +00:00
GitLab Bot a1aeaba23e Add latest changes from gitlab-org/gitlab@master 2020-09-03 09:08:20 +00:00
GitLab Bot e28b754d23 Add latest changes from gitlab-org/gitlab@master 2020-09-02 03:10:30 +00:00
GitLab Bot 895ab10efa Add latest changes from gitlab-org/gitlab@master 2020-08-10 09:09:54 +00:00
GitLab Bot f9d0e89611 Add latest changes from gitlab-org/gitlab@master 2020-08-05 18:09:49 +00:00
GitLab Bot 5da8649911 Add latest changes from gitlab-org/gitlab@master 2020-08-04 03:09:50 +00:00
GitLab Bot ed00b1a6a3 Add latest changes from gitlab-org/gitlab@master 2020-07-28 12:09:49 +00:00
GitLab Bot 3ce55b46df Add latest changes from gitlab-org/gitlab@master 2020-07-22 18:09:27 +00:00
GitLab Bot 49089d4fb1 Add latest changes from gitlab-org/gitlab@master 2020-07-14 12:09:14 +00:00
GitLab Bot 840d5ecdbb Add latest changes from gitlab-org/gitlab@master 2020-07-02 15:09:08 +00:00
GitLab Bot 4c5468b408 Add latest changes from gitlab-org/gitlab@master 2020-06-24 15:08:50 +00:00
GitLab Bot 60082b335c Add latest changes from gitlab-org/gitlab@master 2020-06-19 21:08:32 +00:00
GitLab Bot 908a54b624 Add latest changes from gitlab-org/gitlab@master 2020-06-05 21:08:27 +00:00
GitLab Bot 711f859532 Add latest changes from gitlab-org/gitlab@master 2020-06-01 15:08:16 +00:00
GitLab Bot 808c799a67 Add latest changes from gitlab-org/gitlab@master 2020-05-22 12:08:15 +00:00
GitLab Bot 40cdcdd45b Add latest changes from gitlab-org/gitlab@master 2020-05-18 18:08:22 +00:00
GitLab Bot 8dc1e72e2b Add latest changes from gitlab-org/gitlab@master 2020-05-13 00:07:50 +00:00
GitLab Bot 3795b229ab Add latest changes from gitlab-org/gitlab@master 2020-05-01 00:09:59 +00:00
GitLab Bot c74b7b5e43 Add latest changes from gitlab-org/gitlab@master 2020-04-28 12:09:44 +00:00
GitLab Bot e33f87ac0f Add latest changes from gitlab-org/gitlab@master 2020-04-21 15:21:10 +00:00
GitLab Bot 513eff6210 Add latest changes from gitlab-org/gitlab@master 2020-04-16 09:09:37 +00:00
GitLab Bot ed5add1c2f Add latest changes from gitlab-org/gitlab@master 2020-04-10 18:09:32 +00:00
GitLab Bot 87af6f2e05 Add latest changes from gitlab-org/gitlab@master 2020-03-16 21:09:21 +00:00
GitLab Bot cd3e2c7b93 Add latest changes from gitlab-org/gitlab@master 2020-02-19 12:09:13 +00:00
GitLab Bot eb1f5a3e08 Add latest changes from gitlab-org/gitlab@master 2020-02-17 18:09:00 +00:00
GitLab Bot e144369009 Add latest changes from gitlab-org/gitlab@master 2020-02-14 00:09:07 +00:00
GitLab Bot d466ee5042 Add latest changes from gitlab-org/gitlab@master 2020-02-13 21:08:59 +00:00
GitLab Bot d87918510a Add latest changes from gitlab-org/gitlab@master 2020-02-06 09:09:06 +00:00
GitLab Bot ca05512007 Add latest changes from gitlab-org/gitlab@master 2020-02-04 18:08:50 +00:00
GitLab Bot 6b833f1e03 Add latest changes from gitlab-org/gitlab@master 2020-02-04 15:08:40 +00:00
GitLab Bot 208e2e308c Add latest changes from gitlab-org/gitlab@master 2020-02-02 06:08:56 +00:00
GitLab Bot d0356412df Add latest changes from gitlab-org/gitlab@master 2020-02-01 03:09:04 +00:00
GitLab Bot 1d388ed855 Add latest changes from gitlab-org/gitlab@master 2020-01-30 03:08:50 +00:00
GitLab Bot 6315ed9630 Add latest changes from gitlab-org/gitlab@master 2020-01-28 18:08:35 +00:00
GitLab Bot c158fa8d69 Add latest changes from gitlab-org/gitlab@master 2020-01-16 12:08:32 +00:00
GitLab Bot 600ca97812 Add latest changes from gitlab-org/gitlab@master 2020-01-15 21:08:48 +00:00
GitLab Bot 69d6d3ca20 Add latest changes from gitlab-org/gitlab@master 2019-12-16 21:08:00 +00:00
GitLab Bot d10a462fed Add latest changes from gitlab-org/gitlab@master 2019-12-16 12:07:43 +00:00
GitLab Bot 8cc5f27909 Add latest changes from gitlab-org/gitlab@master 2019-12-13 12:07:41 +00:00
GitLab Bot 4eea104c69 Add latest changes from gitlab-org/gitlab@master 2019-12-11 15:07:38 +00:00
GitLab Bot 115c8ea7af Add latest changes from gitlab-org/gitlab@master 2019-12-10 18:08:04 +00:00
GitLab Bot 93c6764dac Add latest changes from gitlab-org/gitlab@master 2019-12-09 12:07:58 +00:00
GitLab Bot 2349eabc1a Add latest changes from gitlab-org/gitlab@master 2019-12-06 00:07:48 +00:00
GitLab Bot 98420be3dd Add latest changes from gitlab-org/gitlab@master 2019-12-04 12:07:12 +00:00
GitLab Bot eac0da9a47 Add latest changes from gitlab-org/gitlab@master 2019-11-29 15:06:43 +00:00
GitLab Bot 68d3f33d51 Add latest changes from gitlab-org/gitlab@master 2019-11-26 15:06:50 +00:00
GitLab Bot 8e45d25f7d Add latest changes from gitlab-org/gitlab@master 2019-10-16 18:08:01 +00:00
GitLab Bot 308146dc39 Add latest changes from gitlab-org/gitlab@master 2019-10-10 00:06:44 +00:00
GitLab Bot 4b28d5ae77 Add latest changes from gitlab-org/gitlab@master 2019-10-09 21:06:24 +00:00
GitLab Bot 759cd6c298 Add latest changes from gitlab-org/gitlab@master 2019-09-26 09:06:04 +00:00
GitLab Bot c792263edf Add latest changes from gitlab-org/gitlab@master 2019-09-23 18:06:14 +00:00
GitLab Bot 80f61b4035 Add latest changes from gitlab-org/gitlab@master 2019-09-18 14:02:45 +00:00
Massimeddu Cireddu aef0d81792 Fixing #65389
Wrong format on MS Teams integration push events with multi line commit messages
2019-09-02 10:43:54 +00:00
Patrick Bajao 6ef6693e37 Refactor PositionTracer to support different types
This is to prepare for supporing image type position tracing
2019-07-05 11:03:47 +00:00
Patrick Bajao 3d701a7ccc Don't show image diff note on text file 2019-07-01 17:57:41 +08:00
Bob Van Landuyt b6ff5f1e14 Expose comments on Noteables in GraphQL
This exposes `Note`s on Issues & MergeRequests using a
`Types::Notes::NoteableType` in GraphQL.

Exposing notes on a new type can be done by implementing the
`NoteableType` interface on the type. The presented object should
be a `Noteable`.
2019-06-14 12:36:27 +02:00
Kerri Miller fb3d40cb61 Extend #parse to accept a suggestions_filter_enabled param
This will allow the front end to specify the behavior as needed.
2019-06-05 16:19:45 -07:00
Igor c92db3db71 Fix removing empty lines via suggestions
Before this fix, a suggestion which just removes
an empty line wasn't appliable
2019-05-28 07:12:29 +00:00
Igor db68003e8b Memoize old_blob and new_blob to improve performance 2019-03-28 12:11:37 +00:00
Oswaldo Ferreira 03e0604d5d Prepare suggestion implementation for multi-line
Adds the groundwork needed in order to persist multi-line suggestions,
while providing the parsing strategy which will be reused for the
**Preview** as well.
2019-03-27 12:26:53 -03:00
Douwe Maan 7d3c5d882c Merge branch '59147-duplicate-match-line' into 'master'
Fix duplicated bottom match line

Closes #59147

See merge request gitlab-org/gitlab-ce!26402
2019-03-21 16:43:54 +00: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
Oswaldo Ferreira 53a5960496 Implement multi-line suggestions filtering
Implements the filtering logic for
`suggestion:-x+y` syntax.
2019-03-20 11:30:24 -03:00
Oswaldo Ferreira 08f789736e Implement suggestion diff lines parser 2019-03-18 13:21:13 -03:00
Douwe Maan 6cfa5ee536 Merge branch 'expand-diff-to-full-file' into 'master'
Expand diff to entire file

Closes #19054

See merge request gitlab-org/gitlab-ce!24406
2019-03-07 11:33:15 +00:00
Andrew Newdigate 3288e1a874 Adds the Rubocop ReturnNil cop
This style change enforces `return if ...` instead of
`return nil if ...` to save maintainers a few minor review points
2019-03-06 17:51:56 +02: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
Natalia Tepluhina bf8f32da7f Replaced part of diff file properties with diff viewer
- replaced file.too_large
- replaced file.text
- replaced file.collapsed
2019-02-15 17:56:50 +00:00
Oswaldo Ferreira 8303eb8a9e Adjusts duplicated line when commenting on unfolded diff lines 2019-01-08 12:45:19 -02: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
Oswaldo Ferreira 7cf4947792 Cache diff highlight in discussions
This commit handles note diffs caching, which considerably improves
the performance on merge requests with lots of comments.
Important to note that the caching approach taken here is different
from `Gitlab::Diff::HighlightCache`. We do not reset the whole cache
when a new push is sent or anything else. That's because discussions
diffs are persisted and do not change.
2018-12-21 16:59:21 -02:00
Nick Thomas 8d2e1b724b Merge branch '54786-mr-empty-file-display' into 'master'
Display empty files properly on MR diffs

Closes #54786

See merge request gitlab-org/gitlab-ce!23671
2018-12-15 12:21:54 +00:00
Oswaldo Ferreira ed3034bbb7 Allow suggesting single line changes in diffs 2018-12-13 19:17:19 +00:00
Sean Nichols 05dcb2dd76 Display empty files properly on MR diffs 2018-12-11 23:49:04 -05:00
Oswaldo Ferreira 89a676019c Avoid 500's when serializing legacy diff notes 2018-12-04 13:13:22 -02:00
Douwe Maan 4b7e9eaacd
Treat Repository instances with the same disk path as the same hash key 2018-11-26 11:15:18 +01:00
Douwe Maan 56834e6bb2 Merge branch 'osw-comment-on-any-line-on-diffs-w-feature-flag' into 'master'
Comment on any expanded diff line on MRs (with feature-flag)

Closes #13950

See merge request gitlab-org/gitlab-ce!22914
2018-11-12 15:36:48 +00: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
Douwe Maan a82a595728 Merge branch 'osw-comment-on-any-line-on-diffs' into 'master'
Comment on any expanded diff line on MRs

See merge request gitlab-org/gitlab-ce!22398
2018-11-07 11:56:46 +00:00
gfyoung 7e6f6e1603 Enable even more frozen string in lib/gitlab
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.
2018-11-06 22:47:32 -08:00
Oswaldo Ferreira 1bc0e9e3c5 Apply additional guard-clauses for unfold_required? 2018-11-06 17:59:09 -02:00
Oswaldo Ferreira ec66ef1b74 Comment on any expanded diff line on MRs 2018-11-06 17:39:31 -02:00
Sean McGivern c0d30fad97 Merge branch 'sh-optimize-reload-diffs-service' into 'master'
Significantly cut memory and SQL queries when reloading diffs

See merge request gitlab-org/gitlab-ce!22725
2018-11-02 10:09:50 +00:00
Stan Hu de1db4972c Avoidp loading merge request diff files when not needed 2018-11-01 07:50:39 -07:00
Achilleas Pipinellis 7f47e13218 Merge branch 'gt-update-typos-in-comments-and-specs' into 'master'
Fix typos in comments and specs

See merge request gitlab-org/gitlab-ce!22683
2018-11-01 10:34:23 +00:00
George Tsiolis 733ae94921 Fix typos in comments and specs 2018-11-01 08:59:20 +02:00
Mark Chao 39ae9a59a5 Make Highlight accept language param
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.
2018-10-30 15:44:55 +08:00
Phil Hughes 14ed916cf2 Merge branch '51958-fix-mr-discussion-loading' into 'master'
Fix MR discussion not loaded issue

Closes #51958

See merge request gitlab-org/gitlab-ce!21982
2018-10-04 07:37:24 +00:00
Francisco Javier López c40400ceae [master] Stored XSS in Gitlab Merge Request from imported repository 2018-10-01 16:44:30 +00:00
Mark Chao f09303b00a Fix MR discussion not loaded issue
Display `formatter` as the sole content of `position` object.
This means `diff_file` data is not referenced, which is the
caseu of "IOError: not opened for reading".
2018-10-01 22:37:43 +08:00
Michael Kozono f107bc69e3 Simplify by using Gitlab::SafeRequestStore
These are clear wins.
2018-09-24 12:11:26 -07:00
Oswaldo Ferreira 5dce096cf8 Use standalone diff stats RPC on every comparison view 2018-09-19 12:26:28 +00:00
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
Oswaldo Ferreira cd1d5b2440 Cache diff highlighting upon Merge Request creation (refactors diff caching) 2018-09-07 10:07:18 -03:00
Felipe Artur 5bc54ca425 Use a serializer to render diff lines 2018-08-31 15:32:48 -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
Chantal Rollison 81a403f05f Escaped html characters 2018-08-21 07:37:33 -07:00
Lin Jen-Shin 3bfe306624 Resolve Naming/UncommunicativeMethod 2018-07-09 21:13:08 +08:00
Sean McGivern fe695ebd24 Merge branch 'issue_48474' into 'master'
Fix discussion entity for legacy diff notes

Closes #48474

See merge request gitlab-org/gitlab-ce!20214
2018-07-05 10:18:53 +00:00
Felipe Artur 6d41df5071 Render LegacyDiffNote when diff_file blob is nil 2018-07-04 12:34:41 -03:00
Jan Provaznik dc551581d0 Use serialize_keys as part of highlight diff cache
This assures that old cache is not used if we change format of
cached data.
2018-07-04 11:34:35 +02: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
Felipe Artur 3e66795ef1 Changes tab VUE refactoring 2018-06-21 12:22:40 +00: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
Douwe Maan 202c100d5a Merge branch 'osw-use-cached-highlighted-content-for-discussions' into 'master'
Use persisted diff data instead fetching Git on discussions

Closes #44052

See merge request gitlab-org/gitlab-ce!18657
2018-05-01 15:11:21 +00:00
Jan Provaznik 7a76caa5a8 Merge request and commit discussions API 2018-05-01 12:39:44 +00:00
Oswaldo Ferreira be8a320bd8 Use persisted diff data instead fetching Git on discussions
Today, when fetching diffs of a note, we always go to Gitaly in order to diff between commits and return the diff of each discussion note. With this change we avoid doing that for notes on the "current version" of the MR.
2018-04-30 20:07:21 -03:00
Bob Van Landuyt 5f7f5eda92 Method to track recoverable exceptions in sentry
This adds a method to track errors that can be recovered from in
sentry.

It is useful when debugging performance issues, or exceptions that are
hard to reproduce.
2018-04-17 11:39:23 +02:00
Douwe Maan 98106ec54e
Merge branch '42028-xss-diffs-10-6' into 'security-10-6'
Port of "Fix XSS on commit diff view" for 10-6

See merge request gitlab/gitlabhq!2364
2018-04-05 08:40:05 +02: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 db90882665 Only cache MR diffs for one week
This may lead to some being evicted and having to be cached again, but many MRs
get closed or updated in that time anyway.
2018-03-15 11:49:53 +00:00
Sean McGivern 6cd7f679d0 Only cache highlight results for latest MR diffs
Previously, we kept them all in the cache. We don't need the highlight results
for older diffs - if someone does view that (which is rare), we can do the
highlighting on the fly.
2018-03-15 11:49:53 +00:00
Sean McGivern 4bc58ca210 Merge branch 'osw-stop-recalculating-merge-base-on-mr-loading' into 'master'
Avoid re-fetching merge-base SHA from Gitaly unnecessarily

See merge request gitlab-org/gitlab-ce!17630
2018-03-12 13:22:26 +00:00
Oswaldo Ferreira ea81c27612 Submit a single batch blob RPC to Gitaly per HTTP request when viewing diffs 2018-03-09 12:36:46 -03:00
Oswaldo Ferreira c6273ec50c Avoid re-fetching merge-base SHA from Gitaly unnecessarily 2018-03-07 22:46:29 -03:00
Sean McGivern cdf3ae04f8 Fix 500 error when diff context line has broken encoding
Rugged sometimes chops a context line in between bytes, resulting in the context
line having an invalid encoding: https://github.com/libgit2/rugged/issues/716

When that happens, we will try to detect the encoding for the diff, and
sometimes we'll get it wrong. If that difference in encoding results in a
difference in string lengths between the diff and the underlying blobs, we'd
fail to highlight any inline diffs, and return a 500 status to the user.

As we're using the underlying blobs, the encoding is 'correct' anyway, so if the
string range is invalid, we can just discard the inline diff highlighting. We
still report to Sentry to ensure that we can investigate further in future.
2018-02-22 12:26:23 +00:00
🙈 jacopo beschi 🙉 729f05f0e3 Adds Rubocop rule for line break around conditionals 2018-01-11 16:34:01 +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
Douwe Maan 771bf9527f Improve performance of DiffDiscussion#truncated_diff_lines and DiffNote#diff_line by removing expensive diff position calculation and comparison 2017-12-22 18:07:15 +01:00
Sean McGivern 7838317a14 Merge branch 'fix_39233' into 'master'
fix #39233 - 500 in merge request

Closes #39233

See merge request gitlab-org/gitlab-ce!15774
2017-12-07 20:35:39 +00:00
Martin Nowak b7a5125f02 fix #39233 - 500 in merge request
- handle unchanged empty lines in inline diff
2017-12-07 20:19:37 +01:00
micael.bergeron cb6f51ec9b add support for the commit reference filter 2017-12-07 09:01:37 -05: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
Jacopo 181cd299f9 Adds Rubocop rule for line break after guard clause
Adds a rubocop rule (with autocorrect) to ensure line break after guard clauses.
2017-11-16 17:58:29 +01:00
AlexWayfer 7ba7fa5048 Fix 500 error for old (somewhat) MRs 2017-10-30 12:30:31 +00:00
Sean McGivern b2553840e8 Merge branch 'conflict-resolution-refactor' into 'master'
Conflict resolution refactor

See merge request gitlab-org/gitlab-ce!14747
2017-10-16 10:36:06 +00:00
Valery Sizov d09895a0de Fix diff parser so it tolerates to diff special markers in the content 2017-10-15 17:00:36 +03:00