| 456 | } |
| 457 | |
| 458 | void CommitDiffTreeView::openCommit(const QString &hash) |
| 459 | { |
| 460 | m_commitHash = hash; |
| 461 | |
| 462 | auto *git = new QProcess(this); |
| 463 | if (!setupGitProcess(*git, |
| 464 | m_gitDir, |
| 465 | {QStringLiteral("show"), hash, QStringLiteral("--numstat"), QStringLiteral("--pretty=oneline"), QStringLiteral("-z")})) { |
| 466 | delete git; |
| 467 | return; |
| 468 | } |
| 469 | |
| 470 | connect(git, &QProcess::finished, this, [this, git](int e, QProcess::ExitStatus s) { |
| 471 | git->deleteLater(); |
| 472 | if (e != 0 || s != QProcess::NormalExit) { |
| 473 | Utils::showMessage(QString::fromUtf8(git->readAllStandardError()), gitIcon(), i18n("Git"), MessageType::Error, m_mainWindow); |
| 474 | m_backBtn.click(); |
| 475 | return; |
| 476 | } |
| 477 | QByteArray contents = git->readAllStandardOutput(); |
| 478 | int firstNull = contents.indexOf(char(0x00)); |
| 479 | if (firstNull == -1) { |
| 480 | return; |
| 481 | } |
| 482 | QByteArray numstat = contents.mid(firstNull + 1); |
| 483 | createFileTreeForCommit(numstat); |
| 484 | }); |
| 485 | startHostProcess(*git); |
| 486 | } |
| 487 | |
| 488 | void CommitDiffTreeView::createFileTreeForCommit(const QByteArray &rawNumStat) |
| 489 | { |
nothing calls this directly
no test coverage detected