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:
authorLukas Eipert <leipert@gitlab.com>2018-10-16 16:56:03 +0300
committerLukas Eipert <leipert@gitlab.com>2018-10-22 12:04:55 +0300
commit253e1818aa3efafb05d9994aab0f778d339e26ac (patch)
treea453ba647ef7635157519adc96718e3369890755 /danger/database
parentfdcdc36eecdbe904cf80fa130aebf4edd34c3f12 (diff)
Create helper to get all changed files
Danger apparently has three different objects which could contain files you often want to check: - git.added_files - git.modified_files - git.renamed_files The problem: If a file is renamed, `modified_files` contains the file path before the rename. In some Danger checks we use `added_files` + `modified_files`, which might contain the deleted paths of renamed files, but missing the new paths of renamed files. So we need to consider `renamed_files` as well.
Diffstat (limited to 'danger/database')
-rw-r--r--danger/database/Dangerfile4
1 files changed, 1 insertions, 3 deletions
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile
index ad5f1c1e0f3..38ccbd94edb 100644
--- a/danger/database/Dangerfile
+++ b/danger/database/Dangerfile
@@ -39,8 +39,6 @@ def database_paths_requiring_review(files)
to_review
end
-all_files = git.added_files + git.modified_files
-
non_geo_db_schema_updated = !git.modified_files.grep(%r{\Adb/schema\.rb}).empty?
geo_db_schema_updated = !git.modified_files.grep(%r{\Aee/db/geo/schema\.rb}).empty?
@@ -55,7 +53,7 @@ if geo_migration_created && !geo_db_schema_updated
warn format(SCHEMA_NOT_UPDATED_MESSAGE, migrations: 'Geo migrations', schema: gitlab.html_link("ee/db/geo/schema.rb"))
end
-db_paths_to_review = database_paths_requiring_review(all_files)
+db_paths_to_review = database_paths_requiring_review(helper.all_changed_files)
unless db_paths_to_review.empty?
message 'This merge request adds or changes files that require a ' \