Commit edf1d0d5 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Git: Fix diff for renamed/copied file from commit editor

Change-Id: I8100c3f029687d5d0b7af6a8f4c29cf939ee93e6
Reviewed-by: default avatarJarek Kobus <jaroslaw.kobus@theqtcompany.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent eb808980
......@@ -220,14 +220,23 @@ void GitSubmitEditor::slotDiffSelected(const QList<int> &rows)
foreach (int row, rows) {
const QString fileName = m_model->file(row);
const FileStates state = static_cast<FileStates>(m_model->extraData(row).toInt());
if (state & UnmergedFile)
if (state & UnmergedFile) {
unmergedFiles.push_back(fileName);
else if (state & StagedFile)
} else if (state & StagedFile) {
if (state & (RenamedFile | CopiedFile)) {
const int arrow = fileName.indexOf(QLatin1String(" -> "));
if (arrow != -1) {
stagedFiles.push_back(fileName.left(arrow));
stagedFiles.push_back(fileName.mid(arrow + 4));
continue;
}
}
stagedFiles.push_back(fileName);
else if (state == UntrackedFile)
} else if (state == UntrackedFile) {
Core::EditorManager::openEditor(m_workingDirectory + QLatin1Char('/') + fileName);
else
} else {
unstagedFiles.push_back(fileName);
}
}
if (!unstagedFiles.empty() || !stagedFiles.empty())
emit diff(unstagedFiles, stagedFiles);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment