Commit Graph

425 Commits

Author SHA1 Message Date
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
Alejandro Rodríguez 9fdde3693b Move line code generation into Gitlab::Git
Having a distinct class just for that was a bit overkill
2017-10-12 22:13:05 -03: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 f72598b659 Move Gitlab::Diff::LineCode to module Gitlab::Git 2017-10-12 21:45:16 -03:00
Felipe Artur b54203f0ad Commenting on image diffs 2017-10-07 04:25:17 +00:00
Douwe Maan 19a30595d9 Remove unnecessary comments 2017-09-25 10:23:43 +02:00
Douwe Maan b9857d8b66 Properly compare diff refs and diff positions when shas are truncated 2017-09-25 10:22:28 +02:00
Ahmad Sherif eb36fa17a6 Migrate Gitlab::Git::Repository#diff to Gitaly
Closes gitaly#524
2017-09-21 11:05:06 +02:00
Andrew Newdigate 64d7ec0a9e Detect n+1 issues involving Gitaly 2017-09-19 10:55:37 +00:00
micael.bergeron 46e4e8f4dc changed InlineDiffMarker to make it html_safe its output
updated the spec
2017-09-12 13:42:40 -04: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
Robert Speicher 260c8da060 Whitelist or fix additional `Gitlab/PublicSend` cop violations
An upcoming update to rubocop-gitlab-security added additional
violations.
2017-08-14 12:14:11 -04:00
Brian Neel 9770c57fab Re-enable SqlInjection and CommandInjection 2017-08-08 10:50:54 -04:00
Jacob Vosmaer 7b18c42464 Remove unused (?) code 2017-07-31 17:19:25 +02:00
Douwe Maan 5e8aca2152 Don't display comment on unchanged line on both sides in parallel diff 2017-06-19 11:50:46 -05:00
Douwe Maan 7944254563 Implement diff viewers 2017-06-14 10:12:21 -05:00
Sean McGivern e9002222a0 Merge branch 'dm-diff-file-diffable' into 'master'
Move diffable? method from Repository to Diff::File

See merge request !11980
2017-06-08 16:14:56 +00:00
Douwe Maan e6e29f9220 Use Diff::File blob methods from diff highlighter 2017-06-08 09:39:54 -05:00
Douwe Maan ffbbd4112e Move diffable? method from Repository to Diff::File 2017-06-08 09:32:57 -05:00
Douwe Maan 3a5d375e49 Fix Diff::Position#diff_file for positions on straight diffs 2017-06-06 14:48:05 -05:00
Sean McGivern c1ee45953e Merge branch 'fix_diff_line_comments' into 'master'
Fix: A diff comment on a change at last line of a file shows as two comments in discussion

Closes #32353

See merge request !11802
2017-06-01 10:30:46 +00:00
Valery Sizov 563c1ca01c Fix: A diff comment on a change at last line of a file shows as two comments in discussion 2017-05-31 18:38:10 +03:00
Douwe Maan aed0387f97 Consistent diff and blob size limit names 2017-05-29 17:02:02 -05:00
Robert Speicher 8e2fefc6c4 Merge branch 'dm-diff-cleanup' into 'master'
Clean up diff rendering

See merge request !11390
2017-05-25 22:15:57 +00:00
Douwe Maan d88a5c1db1 Address feedback 2017-05-25 15:17:57 -05:00
Douwe Maan 0bf339f0ed Address review 2017-05-24 10:10:10 -05:00
Douwe Maan 6e698b254e Fix specs 2017-05-23 16:27:30 -05:00
Douwe Maan ab91f76e8b Add system note with link to diff comparison when MR discussion becomes outdated 2017-05-23 16:27:30 -05:00
Douwe Maan 7c479d88a9 Pass fallback_diff_refs to Diff::File instead of using view helpers 2017-05-23 15:37:05 -05:00
Douwe Maan db40c668de Rename Diff::File {old,new}_ref to {old,new}_sha 2017-05-23 15:37:04 -05:00
Douwe Maan d9a0188d2f Add question mark to Gitlab::Diff::File predicate methods 2017-05-23 15:37:04 -05:00
Douwe Maan 7a7e9288d4 Stop MR conflict code from blowing up when branches are missing 2017-05-18 15:48:42 -05:00
Douwe Maan e179707844 Extract generic parts of Gitlab::Diff::InlineDiffMarker 2017-05-10 08:26:21 -05:00
Sean McGivern a0979c05fd Show correct size when MR diff overflows
The problem is that we often go via a diff object constructed from the diffs
stored in the DB. Those diffs, by definition, don't overflow, so we don't have
access to the 'correct' `real_size` - that is stored on the MR diff object
iself.
2017-04-25 16:54:10 +01:00
Douwe Maan 63d38a303b Fix commenting on an existing discussion on an unchanged line that is no longer in the diff 2017-04-24 11:17:15 -05:00
Douwe Maan 2c0de7aaaf Cache MR diffs by diff refs 2017-04-08 14:37:46 -05:00
Douwe Maan afa53810de
Fix specs 2017-04-05 17:44:14 +01:00
Douwe Maan bb8cc94668
Don't use original_discussion_id 2017-04-05 17:44:14 +01:00
Douwe Maan f6f6aaf593
Better notification emails for notes and (diff) discussions 2017-04-05 17:44:14 +01:00
mhasbini 985af1a670 take nonewline context into account in diff parser 2017-03-13 22:09:43 +02:00
Douwe Maan 5c7f9d69e3 Fix code for cops 2017-02-23 09:31:57 -06:00
Douwe Maan 8a4d68c53e Enable Style/ConditionalAssignment 2017-02-23 09:31:57 -06:00
Douwe Maan ccbebbdfeb Enable Performance/RedundantMatch 2017-02-23 09:31:57 -06:00
Douwe Maan b7d8df503c Enable Style/MutableConstant 2017-02-23 09:31:56 -06:00
Robert Speicher 17c8d15b14 Enable `Lint/EmptyWhen` cop and correct offense 2017-02-13 11:00:20 -05:00
Sean McGivern 1e5e56c698 Fix MR with files hidden by .gitattributes
Don't try to highlight and cache files hidden by .gitattributes entries.
2016-12-26 16:25:55 +00:00
Valery Sizov f5d7a61760 Fixes ActionView::Template::Error: undefined method `text?` for nil:NilClass 2016-12-02 14:03:30 +02:00
Valery Sizov 847ada36c4 Fix: Timeout creating and viewing merge request for binary file 2016-11-25 15:25:01 +02: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
Adam Niedzielski 3fa265d195 Fix expanding a collapsed diff when converting a symlink to a regular file
In this case comparing old_path and new_path is not enough because there
are two entires that match.
2016-11-10 18:24:12 +01:00
Adam Niedzielski 317e48193f Fix the diff in the merge request view when converting a symlink to a regular file.
In this specific case using file_path as a cache key is not enough,
because there are two entries with the same path.
Closes #21610.
2016-10-17 18:09:34 +02:00
Dmitriy Zaporozhets 9329436deb
Merge branch 'master' into dz-merge-request-version
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-22 11:34:41 +03:00
Sean McGivern 4a4c1765be Fix line commenting for the initial commit
The initial commit doesn't have a parent, so explicitly pass the blank
SHA and handle that when calculating the position.
2016-08-19 16:35:44 +01:00
Dmitriy Zaporozhets 6db65143db
Merge branch 'master' into dz-merge-request-version
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-19 13:01:58 +03:00
Dmitriy Zaporozhets 643a368fa4
Make merge request diff works with new FileCollection logic
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-15 17:57:19 +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 7af277f683 Auto-highlight conflict when rich_text is called 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
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 1d0c7b7492 Introduce Compare model in the codebase.
This object will manage Gitlab::Git::Compare instances
2016-08-03 07:00:20 +02:00
Paco Guzman 8f359ea917 Move to Gitlab::Diff::FileCollection
Instead calling diff_collection.count use diff_collection.size which is cache on the diff_collection
2016-08-03 07:00:20 +02:00
Paco Guzman cd7c2cb6dd Cache highlighted diff lines for merge requests
Introducing the concept of SafeDiffs which relates 
diffs with UI highlighting.
2016-08-03 07:00:19 +02:00
Robert Speicher 34c083a184 Merge branch 'rubocop/enable-access-modifiers-cops' into 'master'
Enable Rubocop cops that check access modifiers

## What does this MR do?

This MR enables Rubocop cops that detect methods that should be restricted but are the part of public API because of access modifiers used improperly.

This also fixes existing offenses.

## Why was this MR needed?

Some method in our codebase are public instead of being private because it is sometimes difficult to get it right without static analysis.

## What are the relevant issue numbers?

See #17478  
Closes #17372 

See merge request !5014
2016-07-29 15:58:09 +00:00
Douwe Maan 79214be727 Add Discussion model to represent MR/diff discussion 2016-07-20 16:18:18 -06:00
Sean McGivern 4f0780cc04 Ensure to_json methods take optional argument 2016-07-20 11:14:06 +01:00
Grzegorz Bizon 20a5033d79 Fix method visibility in inline diff class 2016-07-19 15:12:14 +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 9b0ef1559f Merge branch 'better-parallel-diff' into 'master'
Actually render old and new sections of parallel diff next to each other

See merge request !5173
2016-07-13 18:10:01 +00:00
Douwe Maan 5fea640e90 Merge branch 'multi-line-inline-diff' into 'master'
Render inline diffs for multiple changed lines following eachother

Before:

![Screen_Shot_2016-07-11_at_00.08.27](/uploads/b14664211e0f5cef6e77a78eadfcbcdf/Screen_Shot_2016-07-11_at_00.08.27.png)

After:

![Screen_Shot_2016-07-11_at_00.07.34](/uploads/567be631869a4867a2edf6ff7eda6369/Screen_Shot_2016-07-11_at_00.07.34.png)

See merge request !5174
2016-07-13 05:29:49 +00:00
Douwe Maan 545a85dc64 Actually render old and new sections of parallel diff next to each other 2016-07-13 00:04:07 -05:00
Douwe Maan 489e193704 Rename constant to be more descriptive 2016-07-13 00:02:20 -05:00
Douwe Maan e981d6cd0d Extended regexes ignore whitespace, so use \s 2016-07-12 11:25:39 -05:00
Douwe Maan f5cc3f63a8 Render inline diffs for multiple changed lines following eachother 2016-07-11 18:58:15 -05:00
Sean McGivern b6b26692ea Collapse large diffs by default
When rendering a list of diff files, skip those where the diff is over
10 KB and provide an endpoint to render individually instead.
2016-07-08 10:56:55 +01:00
Douwe Maan ac26b23712 Remove duplication, unused methods, and some other style things 2016-07-06 19:29:41 -04:00
Douwe Maan 228d2a4cb1 Add some more code comments. 2016-07-06 19:28:13 -04:00
Douwe Maan 29d574868a Display new diff notes and allow creation through the web interface 2016-07-06 18:51:00 -04:00
Douwe Maan db65954d78 Add Gitlab::Git::PositionTracer 2016-07-06 18:50:59 -04:00
Douwe Maan e9e06ca627 Add Gitlab::Diff::LineMapper 2016-07-06 18:50:59 -04:00
Douwe Maan 9abcc0a98f Add Gitlab::Git::Position 2016-07-06 18:50:59 -04:00
Douwe Maan a27462a5c6 Extract parts of LegacyDiffNote into DiffOnNote concern and move part of responsibility to other classes 2016-07-06 18:50:59 -04:00
Douwe Maan 375193455a Style diff and blob file headers the same way 2016-07-06 18:50:59 -04:00
Douwe Maan 9fc0e11e0d Add DiffFile#blob and #old_blob 2016-07-06 18:50:58 -04:00
Douwe Maan a9fa45f09e Represent DiffRefs as proper class instead of tuple array 2016-07-06 18:50:58 -04:00
Grzegorz Bizon 9e211091a8 Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
Felipe Artur 56f3b243ce Add leading comment space cop 2016-05-31 19:33:46 -03:00
Rémy Coutable 5341b16fc9
Reuse existing SCSS variables
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-05-18 13:20:46 -05:00
Adam Butler 8a8b5497c5 Create DiffFilter and change SystemNoteService#change_title to use Gitlab::Diff::InlineDiff 2016-05-18 11:15:10 -05:00
Connor Shea 4995302df6
Enable the StringReplacement cop.
Also fix one use of `gsub` that would be faster as `delete`.

Use `tr` instead of `gsub` when you are replacing the same number of
characters. Use `delete` instead of `gsub` when you are deleting
characters.
2016-05-10 18:34:15 -06: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 7e03b40221 Return an empty Array when there aren't lines to parse. 2016-03-15 19:51:27 -05:00
Jacob Vosmaer 1764e1b7cb Use Gitlab::Git::DiffCollections 2016-03-03 18:38:44 +01:00
Douwe Maan 677b4db9e6 Mark inline difference between old and new paths when a file is renamed 2016-01-29 19:37:17 +01:00
Robert Speicher 2fed8bf390 Merge branch 'fix-diff-comments' into 'master'
More highlighted diff fixes

See merge request !2545
2016-01-22 07:37:47 +00:00
Douwe Maan 3db24ec9e8 Properly highlight right side of parallel diff 2016-01-22 02:12:43 +01:00
Douwe Maan 16d17b78ca Restore diff comments 2016-01-22 02:10:58 +01:00
Douwe Maan 82d0fa8e45 Fix 2016-01-22 01:53:01 +01:00
Douwe Maan 150b4f66e6 Make sure non-highlighted diffs are still escaped 2016-01-22 01:47:17 +01:00
Douwe Maan 6000f8545f Validate bounds just to be sure 2016-01-20 19:33:34 +01:00
Douwe Maan 0e992a3b4e Properly highlight lines around '\ No newline at end of file' 2016-01-20 19:20:13 +01:00
Douwe Maan 577f2fb47a Save and use actual diff base commit for MR diff highlighting 2016-01-20 18:44:27 +01:00
Douwe Maan a010db5db2 Properly handle HTML entities with inline diffs 2016-01-20 15:26:44 +01:00
Douwe Maan 701513dcc7 Move parallel diff logic to separate class 2016-01-20 14:53:20 +01:00
Douwe Maan 0a8039eb77 Remove useless assignments 2016-01-19 13:56:36 +01:00
Douwe Maan 12546f895f Add tests 2016-01-15 16:29:26 +01:00
Douwe Maan 5de8971ddf Whoops, forgot to add files 2016-01-15 16:02:48 +01:00
Douwe Maan 13f10efcf1 Move inline diff marker logic to its own class 2016-01-15 14:39:43 +01:00
Douwe Maan 7d31f37219 Move inline diff logic to its own class 2016-01-15 14:25:29 +01:00
Douwe Maan 71b4341a37 Method was moved 2016-01-15 14:11:36 +01:00
Rubén Dávila c8db25c37c Merge branch 'master' into issue_3945 2016-01-14 17:28:44 -05: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
Douwe Maan 8dfad143d4 Add inline diff markers in highlighted diffs. 2016-01-14 22:28:07 +01:00
Douwe Maan 83e4fc188b Refactor highlighting lines 2016-01-14 16:13:35 +01:00
Douwe Maan 3a1d053599 Remove duplication around highlighting. 2016-01-14 15:11:50 +01:00
Douwe Maan 05187f0fc6 Properly generate diff of orphan commits, like the first commit in a repository 2016-01-14 13:09:36 +01:00
Rubén Dávila c179b48c97 Use #sub instead of #gsub!. #3945
* This is because is not a good idea to modify the original lines
* Also I run into this issue https://gitlab.com/gitlab-org/gitlab_git/issues/14
  which is returning Diff Lines with the same @new_pos value.
2016-01-13 21:04:53 -05:00
Rubén Dávila 0f0af19139 Little refactor for usage of html_safe. #3945 2016-01-13 11:39:15 -05:00
Rubén Dávila 7307fa48e7 Fix broken specs. #3945 2016-01-12 19:28:31 -05:00
Rubén Dávila 6e3358a507 Remove no longer required code. #3945 2016-01-12 17:36:08 -05:00
Rubén Dávila f1f9b5f7d3 Small fixes from code review. #3945 2016-01-12 12:53:54 -05:00
Rubén Dávila fed10766e5 Fix broken spec for submodule commit. #3945 2016-01-09 01:55:31 -05:00
Rubén Dávila 78d7c0e0d8 Fix broken specs. #3945 2016-01-08 19:05:55 -05:00
Rubén Dávila 6282202ee8 Remove custom Lexer. #3945 [ci skip]
Inline diff is going to be generated client side now. #3945
2016-01-08 15:20:48 -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 f1f4fdf778 Don't process inline diffs on backend. #3945 2016-01-07 21:08:57 -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
Rubén Dávila fd100e1ef1 Don't modify "match" diff lines. #3945 2015-12-30 21:44:12 -05:00
Rubén Dávila 8b079315d9 A bit of refactoring. #3945 2015-12-30 21:23:50 -05:00
Rubén Dávila 7de90f4b53 Fix broken spec and small refactor. #3945 2015-12-30 18:42:11 -05:00
Rubén Dávila b74f36c9ca Fix Rubocop complain. #3945 2015-12-30 13:10:28 -05:00
Rubén Dávila bb96d63153 New implementation for highlighting diff files. #3945
* It is more performant given now we process all the diff file instead
  of processing line by line.
* Multiline comments are highlighted correctly.
2015-12-30 00:52:50 -05:00
Gabriel Mazetto b5291f9599 Fixed Rubocop offenses 2015-12-15 00:53:52 -02:00
Guilherme Garnier 59d0263bc8 Fix rubocop warnings in lib 2015-10-03 01:29:58 -05:00
Dmitriy Zaporozhets 0d967bce57
Show additions/deletions stats on merge request diff
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-10-01 13:52:08 +02:00
Douwe Maan 0632e85c82 Fix commit comments on first line of diff not rendering in Merge Request Discussion view. 2015-02-20 10:23:34 +01:00
Dmitriy Zaporozhets 61cc6a9244 Rubocop: indentation fixes Yay!!! 2015-02-02 21:59:28 -08:00
Dmitriy Zaporozhets c427bf08e4 Rubocop: Style/AlignArray enabled 2015-02-02 20:58:28 -08:00
Ciro Santilli 2e9f5de868 Add parenthesis to function def with arguments. 2014-10-03 09:18:46 +02:00
Dmitriy Zaporozhets b13c1469a3
Rollback diff drop and set default commit id to HEAD
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-09-25 12:46:30 +03:00
Dmitriy Zaporozhets 13aec95264 Improve diff and bump gitlab_git revision 2014-09-24 15:59:57 +03:00
Dmitriy Zaporozhets 53f2130e63 Use new version of gitlab_git with extended rugged usage 2014-09-24 13:26:53 +03:00
Dmitriy Zaporozhets 218219abbd
Refactoring inside refactoring. We need to go deeper
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-09-08 21:54:52 +03:00
Dmitriy Zaporozhets bde3f25d26
Specs for diff parser! Yay!
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-09-08 20:42:12 +03:00
Dmitriy Zaporozhets 4ef809c77d
Gitlab::Diff classes added
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-09-08 16:25:50 +03:00