Commit 8f8ea9fe authored by Robert Speicher's avatar Robert Speicher

Merge branch 'max-file-size-not-allow-null-on-git-hooks' into 'master'

Doesn't accept null value for max file size on Git hooks

Fixes gitlab-org/gitlab-ce#4664

See merge request !101
parents d315f7c9 de6b276e
v 8.4.0 (unreleased)
- Add ability to create a note for user by admin
- Fix "Commit was rejected by git hook", when max_file_size was set null in project's Git hooks
v 8.3.0
- License information can now be retrieved via the API
......
......@@ -2,6 +2,7 @@ class GitHook < ActiveRecord::Base
belongs_to :project
validates :project, presence: true, unless: "is_sample?"
validates :max_file_size, numericality: { greater_than_or_equal_to: 0, only_integer: true }
def commit_validation?
commit_message_regex.present? ||
......
class ChangeMaxFileSizeToNotNullOnGitHooks < ActiveRecord::Migration
def change
change_column_null :git_hooks, :max_file_size, false, 0
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20151215132013) do
ActiveRecord::Schema.define(version: 20151228203337) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -400,7 +400,7 @@ ActiveRecord::Schema.define(version: 20151215132013) do
t.boolean "member_check", default: false, null: false
t.string "file_name_regex", limit: 255
t.boolean "is_sample", default: false
t.integer "max_file_size", default: 0
t.integer "max_file_size", default: 0, null: false
end
create_table "historical_data", force: :cascade do |t|
......
......@@ -7,5 +7,6 @@ describe GitHook do
describe "Validation" do
it { should validate_presence_of(:project) }
it { should validate_numericality_of(:max_file_size).is_greater_than_or_equal_to(0).only_integer }
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment