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/commit.rb')
-rw-r--r--app/models/commit.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 492f6be1ce3..912b4dedf51 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -146,7 +146,10 @@ class Commit
author: {
name: author_name,
email: author_email
- }
+ },
+ added: repo_changes[:added],
+ modified: repo_changes[:modified],
+ removed: repo_changes[:removed]
}
end
@@ -196,4 +199,23 @@ class Commit
def status
ci_commit.try(:status) || :not_found
end
+
+ private
+
+ def repo_changes
+ changes = { added: [], modified: [], removed: [] }
+
+ diffs.each do |diff|
+ case true
+ when diff.deleted_file
+ changes[:removed] << diff.old_path
+ when diff.renamed_file, diff.new_file
+ changes[:added] << diff.new_path
+ else
+ changes[:modified] << diff.new_path
+ end
+ end
+
+ changes
+ end
end