Commit 59237338 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

VCS: Speed up

Do not listen on ICore::contextChanged to update actions
(became slow after additional contexts).
git: Make code to find top level faster, avoid
constructing file info lists.
Acked-by: con
parent fbbb6cf6
......@@ -153,28 +153,14 @@ GitClient::~GitClient()
const char *GitClient::noColorOption = "--no-color";
QString GitClient::findRepositoryForFile(const QString &fileName)
{
const QString gitDirectory = QLatin1String(kGitDirectoryC);
const QFileInfo info(fileName);
QDir dir = info.absoluteDir();
do {
if (dir.entryList(QDir::AllDirs|QDir::Hidden).contains(gitDirectory))
return dir.absolutePath();
} while (dir.cdUp());
return QString();
}
QString GitClient::findRepositoryForDirectory(const QString &dir)
{
const QString gitDirectory = QLatin1String(kGitDirectoryC);
QDir directory(dir);
do {
if (directory.entryList(QDir::AllDirs|QDir::Hidden).contains(gitDirectory))
if (QFileInfo(directory, gitDirectory).isDir())
return directory.absolutePath();
} while (directory.cdUp());
return QString();
}
......
......@@ -75,7 +75,6 @@ public:
bool managesDirectory(const QString &) const { return false; }
QString findTopLevelForDirectory(const QString &) const { return QString(); }
static QString findRepositoryForFile(const QString &fileName);
static QString findRepositoryForDirectory(const QString &dir);
void diff(const QString &workingDirectory, const QStringList &diffArgs, const QString &fileName);
......
......@@ -173,8 +173,6 @@ StateListener::StateListener(QObject *parent) :
QObject(parent)
{
Core::ICore *core = Core::ICore::instance();
connect(core, SIGNAL(contextChanged(Core::IContext*,QList<int>)),
this, SLOT(slotStateChanged()));
connect(core->fileManager(), SIGNAL(currentFileChanged(QString)),
this, SLOT(slotStateChanged()));
......
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