forked from qt-creator/qt-creator
VCS: Decide file/project control by top level
Instead of actual file. In case currentFile is a directory, it is cleared, and project top level is used instead. This leads to unexpected results. This patch corrects repository resolution in stash dialog when opened inside a submodule. Task-number: QTCREATORBUG-10397 Change-Id: I070cc7f9cbebe3be800dbbb9569cf73f540a6d14 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
16cf6177d8
commit
05b939db01
@@ -95,8 +95,8 @@ struct State
|
|||||||
|
|
||||||
bool equals(const State &rhs) const;
|
bool equals(const State &rhs) const;
|
||||||
|
|
||||||
inline bool hasFile() const { return !currentFile.isEmpty(); }
|
inline bool hasFile() const { return !currentFileTopLevel.isEmpty(); }
|
||||||
inline bool hasProject() const { return !currentProjectPath.isEmpty(); }
|
inline bool hasProject() const { return !currentProjectTopLevel.isEmpty(); }
|
||||||
inline bool isEmpty() const { return !hasFile() && !hasProject(); }
|
inline bool isEmpty() const { return !hasFile() && !hasProject(); }
|
||||||
|
|
||||||
QString currentFile;
|
QString currentFile;
|
||||||
@@ -280,12 +280,12 @@ void StateListener::slotStateChanged()
|
|||||||
} else {
|
} else {
|
||||||
state.currentFileDirectory = currentFileInfo->absolutePath();
|
state.currentFileDirectory = currentFileInfo->absolutePath();
|
||||||
state.currentFileName = currentFileInfo->fileName();
|
state.currentFileName = currentFileInfo->fileName();
|
||||||
fileControl = Core::VcsManager::findVersionControlForDirectory(
|
|
||||||
state.currentFileDirectory,
|
|
||||||
&state.currentFileTopLevel);
|
|
||||||
if (!fileControl)
|
|
||||||
state.clearFile();
|
|
||||||
}
|
}
|
||||||
|
fileControl = Core::VcsManager::findVersionControlForDirectory(
|
||||||
|
state.currentFileDirectory,
|
||||||
|
&state.currentFileTopLevel);
|
||||||
|
if (!fileControl)
|
||||||
|
state.clearFile();
|
||||||
}
|
}
|
||||||
// Check for project, find the control
|
// Check for project, find the control
|
||||||
Core::IVersionControl *projectControl = 0;
|
Core::IVersionControl *projectControl = 0;
|
||||||
@@ -303,7 +303,9 @@ void StateListener::slotStateChanged()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Assemble state and emit signal.
|
// Assemble state and emit signal.
|
||||||
Core::IVersionControl *vc = state.currentFile.isEmpty() ? projectControl : fileControl;
|
Core::IVersionControl *vc = fileControl;
|
||||||
|
if (!vc)
|
||||||
|
vc = projectControl;
|
||||||
if (!vc) {
|
if (!vc) {
|
||||||
state.clearPatchFile(); // Need a repository to patch
|
state.clearPatchFile(); // Need a repository to patch
|
||||||
Core::EditorManager::setWindowTitleVcsTopic(QString());
|
Core::EditorManager::setWindowTitleVcsTopic(QString());
|
||||||
|
|||||||
Reference in New Issue
Block a user