forked from qt-creator/qt-creator
Git: Fix diff for renamed/copied file from commit editor
Change-Id: I8100c3f029687d5d0b7af6a8f4c29cf939ee93e6 Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com> Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
eb808980f7
commit
edf1d0d513
@@ -220,15 +220,24 @@ 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);
|
||||
if (!unmergedFiles.empty())
|
||||
|
||||
Reference in New Issue
Block a user