message: use git functions to get content so it is indipendend of the line ending
diff: @@ -475,14 +475,9 @@ void FileWidget::stageHunks(const HunkWidget *hunk,
  // available in the file.
  QString name = mPatch.name();
  git::Repository repo = mPatch.repo();
  - QFile dev(repo.workdir().filePath(name));
  - if (!dev.open(QFile::ReadOnly))
  - return;
  -
  - QByteArray fileContent = dev.readAll();
  - dev.close();
  + git::Blob blob = repo.lookupBlob(repo.workdirId(name));
  - const bool crlf = crlfNewLine(fileContent);
  + QByteArray fileContent = blob.content();
  QByteArray buffer;
  QList<QList<QByteArray>> image;
  @@ -493,8 +488,6 @@ void FileWidget::stageHunks(const HunkWidget *hunk,
  mPatch.apply(image, i, hunk_content);
  }
  buffer = mPatch.generateResult(image);
  - if (crlf)
  - buffer = buffer.replace("\r\n", "\n");
  // Add the buffer to the index.
  index.add(mPatch.name(), buffer);
  @@ -513,21 +506,11 @@ void FileWidget::discardHunk() {
  }
  QString name = mPatch.name();
  - QFile dev(repo.workdir().filePath(name));
  - if (!dev.open(QFile::ReadOnly))
  - return;
  -
  - QByteArray fileContent = dev.readAll();
  - dev.close();
  + git::Blob blob = repo.lookupBlob(repo.workdirId(name));
  + QByteArray fileContent = blob.content();
  - QSaveFile file(repo.workdir().filePath(name));
  - if (!file.open(QFile::WriteOnly))
  - return;
  -
  - const bool crlf = crlfNewLine(fileContent);
  QByteArray buffer;
  for (int i = 0; i < mHunks.size(); ++i) {
  -
  QByteArray hunk_content;
  if (mHunks[i] == hunk) {
  hunk_content = mHunks[i]->hunk();
  @@ -535,8 +518,10 @@ void FileWidget::discardHunk() {
  }
  }
  - if (crlf)
  - buffer = buffer.replace("\r\n", "\n");
  + QSaveFile file(repo.workdir().filePath(name));
  + if (!file.open(QFile::WriteOnly))
  + return;
  +
  file.write(buffer);
  if (!file.commit())
  return;
  