diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-06-20 15:34:32 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-06-20 15:35:24 +0300 |
commit | 0734756ee41d97842081c24d1650dfdd75697b45 (patch) | |
tree | 7851873b7a47f8ad11e1f5572dc039ac66a22d7a /app/models/repository.rb | |
parent | 07956981623d6c5a789fc78c8840079b5b73a5b1 (diff) |
Convert CRLF newlines to LF when committing using the web editor.
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 2c6347222aa..b32e8847bb5 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -5,8 +5,13 @@ class Repository def initialize(path_with_namespace, default_branch = nil, project = nil) @path_with_namespace = path_with_namespace - @raw_repository = Gitlab::Git::Repository.new(path_to_repo) if path_with_namespace @project = project + + if path_with_namespace + @raw_repository = Gitlab::Git::Repository.new(path_to_repo) + @raw_repository.autocrlf = :input + end + rescue Gitlab::Git::Repository::NoRepository nil end |