summaryrefslogtreecommitdiff
path: root/doc/development/diffs.md
diff options
context:
space:
mode:
authorMarcia Ramos <virtua.creative@gmail.com>2018-08-16 10:17:22 +0100
committerMarcia Ramos <virtua.creative@gmail.com>2018-08-16 10:17:22 +0100
commitbfc0c602072bd5b9bf73e117d0808043adc9465e (patch)
treeea55f6e86fdfdcccca9c593d5441c9d2c3efd441 /doc/development/diffs.md
parent1e23577417b3e4eb06b9aba1ec174dbe78b6b9be (diff)
parent0a666b2cb1020df4b8f7b71041b6bd109b49656a (diff)
downloadgitlab-ce-docs-processes.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into docs-processesdocs-processes
Diffstat (limited to 'doc/development/diffs.md')
-rw-r--r--doc/development/diffs.md17
1 files changed, 15 insertions, 2 deletions
diff --git a/doc/development/diffs.md b/doc/development/diffs.md
index 55fc16e0b33..d06339480b1 100644
--- a/doc/development/diffs.md
+++ b/doc/development/diffs.md
@@ -1,6 +1,6 @@
-# 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
- Gitaly service
@@ -11,6 +11,8 @@ We're constantly moving Rugged calls to Gitaly and the progress can be followed
## 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)
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_).
@@ -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
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
As explained above, we limit single diff files and the size of the whole diff. There are scenarios where we collapse the diff file,