diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-07-06 19:28:13 -0400 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-07-06 19:28:13 -0400 |
commit | 228d2a4cb1943c4eda751f80990eed06a3875864 (patch) | |
tree | 402ec01514399a54f51688474ee855c1a30c6782 /lib/gitlab/diff/diff_refs.rb | |
parent | d9c75aec3adf23428e4c85a21ce2c357da006b6c (diff) | |
download | gitlab-ce-228d2a4cb1943c4eda751f80990eed06a3875864.tar.gz |
Add some more code comments.
Diffstat (limited to 'lib/gitlab/diff/diff_refs.rb')
-rw-r--r-- | lib/gitlab/diff/diff_refs.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/gitlab/diff/diff_refs.rb b/lib/gitlab/diff/diff_refs.rb index 43489ae876b..8406ca4269c 100644 --- a/lib/gitlab/diff/diff_refs.rb +++ b/lib/gitlab/diff/diff_refs.rb @@ -18,6 +18,16 @@ module Gitlab head_sha == other.head_sha end + # There is only one case in which we will have `start_sha` and `head_sha`, + # but not `base_sha`, which is when a diff is generated between an + # orphaned branch and another branch, which means there _is_ no base, but + # we're still able to highlight it, and to create diff notes, which are + # the primary things `DiffRefs` are used for. + # `DiffRefs` are "complete" when they have `start_sha` and `head_sha`, + # because `base_sha` can always be derived from this, to return an actual + # sha, or `nil`. + # We have `base_sha` directly available on `DiffRefs` because it's faster# + # than having to look it up in the repo every time. def complete? start_sha && head_sha end |