Commit 5337f26f authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Update diff docs regarding note diff file usage

parent d867a58c
# Working with Merge Request diffs # Working with diffs
Currently we rely on different sources to present merge request diffs, these include: Currently we rely on different sources to present diffs, these include:
- Rugged gem - Rugged gem
- Gitaly service - Gitaly service
...@@ -11,6 +11,8 @@ We're constantly moving Rugged calls to Gitaly and the progress can be followed ...@@ -11,6 +11,8 @@ We're constantly moving Rugged calls to Gitaly and the progress can be followed
## Architecture overview ## Architecture overview
### Merge request diffs
When refreshing a Merge Request (pushing to a source branch, force-pushing to target branch, or if the target branch now contains any commits from the MR) When refreshing a Merge Request (pushing to a source branch, force-pushing to target branch, or if the target branch now contains any commits from the MR)
we fetch the comparison information using `Gitlab::Git::Compare`, which fetches `base` and `head` data using Gitaly and diff between them through we fetch the comparison information using `Gitlab::Git::Compare`, which fetches `base` and `head` data using Gitaly and diff between them through
`Gitlab::Git::Diff.between` (which uses _Gitaly_ if it's enabled, otherwise _Rugged_). `Gitlab::Git::Diff.between` (which uses _Gitaly_ if it's enabled, otherwise _Rugged_).
...@@ -32,6 +34,17 @@ In order to present diffs information on the Merge Request diffs page, we: ...@@ -32,6 +34,17 @@ In order to present diffs information on the Merge Request diffs page, we:
3. If the diff file is cacheable (text-based), it's cached on Redis 3. If the diff file is cacheable (text-based), it's cached on Redis
using `Gitlab::Diff::FileCollection::MergeRequestDiff` using `Gitlab::Diff::FileCollection::MergeRequestDiff`
### Note diffs
When commenting on a diff (any comparison), we persist a truncated diff version
on `NoteDiffFile` (which is associated with the actual `DiffNote`). So instead
of hitting the repository every time we need the diff of the file, we:
1. Check whether we have the `NoteDiffFile#diff` persisted and use it
2. Otherwise, if it's a current MR revision, use the persisted
`MergeRequestDiffFile#diff`
3. In the last scenario, go the the repository and fetch the diff
## Diff limits ## Diff limits
As explained above, we limit single diff files and the size of the whole diff. There are scenarios where we collapse the diff file, As explained above, we limit single diff files and the size of the whole diff. There are scenarios where we collapse the diff file,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment