Skip to content
Snippets Groups Projects
Commit de6b276e authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre
Browse files

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

parent d315f7c9
No related branches found
No related tags found
No related merge requests found
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
Loading
Loading
Loading
Loading
@@ -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? ||
Loading
Loading
class ChangeMaxFileSizeToNotNullOnGitHooks < ActiveRecord::Migration
def change
change_column_null :git_hooks, :max_file_size, false, 0
end
end
Loading
Loading
@@ -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"
Loading
Loading
@@ -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|
Loading
Loading
Loading
Loading
@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment