Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 89bf12ce9ef..ab5ef4b1106 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -263,4 +263,20 @@ class Repository
contributor
end
end
+
+ def blob_for_diff(commit, diff)
+ file = blob_at(commit.id, diff.new_path)
+
+ unless file
+ file = prev_blob_for_diff(commit, diff)
+ end
+
+ file
+ end
+
+ def prev_blob_for_diff(commit, diff)
+ if commit.parent_id
+ blob_at(commit.parent_id, diff.old_path)
+ end
+ end
end