forked from qt-creator/qt-creator
VCS: Filter out untracked files only if they don't appear in any project
Change-Id: I9a87f082467f4688c1ebe5dd5e832c9e5a684ca1 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
e63841cf3e
commit
28e8960a1e
@@ -50,6 +50,7 @@
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/session.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
@@ -722,22 +723,10 @@ QIcon VcsBaseSubmitEditor::submitIcon()
|
||||
void VcsBaseSubmitEditor::filterUntrackedFilesOfProject(const QString &repositoryDirectory,
|
||||
QStringList *untrackedFiles)
|
||||
{
|
||||
if (untrackedFiles->empty())
|
||||
return;
|
||||
|
||||
ProjectExplorer::Project *vcsProject = VcsProjectCache::projectFor(repositoryDirectory);
|
||||
if (!vcsProject)
|
||||
return;
|
||||
|
||||
const QSet<QString> projectFiles
|
||||
= QSet<QString>::fromList(vcsProject->files(ProjectExplorer::Project::SourceFiles));
|
||||
|
||||
if (projectFiles.empty())
|
||||
return;
|
||||
const QDir repoDir(repositoryDirectory);
|
||||
for (QStringList::iterator it = untrackedFiles->begin(); it != untrackedFiles->end(); ) {
|
||||
const QString path = repoDir.absoluteFilePath(*it);
|
||||
if (projectFiles.contains(path))
|
||||
if (ProjectExplorer::SessionManager::projectForFile(FileName::fromString(path)))
|
||||
++it;
|
||||
else
|
||||
it = untrackedFiles->erase(it);
|
||||
|
||||
Reference in New Issue
Block a user