summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-06-23 14:58:14 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-07-13 13:24:56 +0530
commit495db09653bafb0371e5d5a5f12d5bc33cdb584b (patch)
treea524d76e48cb8c34e414ac4ee422f33dfa6625e2 /db
parentf0577d838544152f558411ef1101d56c5852d92e (diff)
downloadgitlab-ce-495db09653bafb0371e5d5a5f12d5bc33cdb584b.tar.gz
Enforce "developers can merge" during `pre-receive`.
1. When a merge request is being merged, save the merge commit SHA in the `in_progress_merge_commit_sha` database column. 2. The `pre-receive` hook looks for any locked (in progress) merge request with `in_progress_merge_commit_sha` matching the `newrev` it is passed. 3. If it finds a matching MR, the merge is legitimate. 4. Update `git_access_spec` to test the behaviour we added here. Also refactored this spec a bit to make it easier to add more contexts / conditions.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20160629025435_add_column_in_progress_merge_commit_sha_to_merge_requests.rb8
-rw-r--r--db/schema.rb1
2 files changed, 9 insertions, 0 deletions
diff --git a/db/migrate/20160629025435_add_column_in_progress_merge_commit_sha_to_merge_requests.rb b/db/migrate/20160629025435_add_column_in_progress_merge_commit_sha_to_merge_requests.rb
new file mode 100644
index 00000000000..7c5f76572ef
--- /dev/null
+++ b/db/migrate/20160629025435_add_column_in_progress_merge_commit_sha_to_merge_requests.rb
@@ -0,0 +1,8 @@
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddColumnInProgressMergeCommitShaToMergeRequests < ActiveRecord::Migration
+ def change
+ add_column :merge_requests, :in_progress_merge_commit_sha, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 4562e6bb0c3..64019cf79bb 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -626,6 +626,7 @@ ActiveRecord::Schema.define(version: 20160712171823) do
t.string "merge_commit_sha"
t.datetime "deleted_at"
t.integer "lock_version", default: 0, null: false
+ t.string "in_progress_merge_commit_sha"
end
add_index "merge_requests", ["assignee_id"], name: "index_merge_requests_on_assignee_id", using: :btree