lib/gitlab_git/blob.rb in gitlab_git-7.2.4 vs lib/gitlab_git/blob.rb in gitlab_git-7.2.5

- old
+ new

@@ -124,10 +124,16 @@ end if action == :remove index.remove(file[:path]) else - oid = repo.write(file[:content], :blob) + content = file[:content] + + # When writing to the repo directly as we are doing here, + # the `core.autocrlf` config isn't taken into account. + content.gsub!("\r\n", "\n") if repository.autocrlf + + oid = repo.write(content, :blob) index.add(path: file[:path], oid: oid, mode: 0100644) end opts = {} opts[:tree] = index.write_tree(repo)