diff options
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 5a25ccb1dd6..381b1db3758 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -24,14 +24,16 @@ class Repository return nil unless path_with_namespace @raw_repository ||= begin - repo = Gitlab::Git::Repository.new(path_to_repo) - repo.autocrlf = :input - repo + Gitlab::Git::Repository.new(path_to_repo) rescue Gitlab::Git::Repository::NoRepository nil end end + def update_autocrlf_option + raw_repository.autocrlf = :input if raw_repository.autocrlf != :input + end + # Return absolute path to repository def path_to_repo @path_to_repo ||= File.expand_path( @@ -693,6 +695,8 @@ class Repository end def commit_with_hooks(current_user, branch) + update_autocrlf_option + oldrev = Gitlab::Git::BLANK_SHA ref = Gitlab::Git::BRANCH_REF_PREFIX + branch was_empty = empty? |