mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
dolphin: greedy search for the root directory of repositories
I don't like that drawback, can be optimized to stat() via KDE::stat() in the future Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
e96b2b5ca6
commit
447b1fe699
1 changed files with 14 additions and 19 deletions
|
@ -295,27 +295,22 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director
|
|||
|
||||
// Version control systems like Git provide the version information
|
||||
// file only in the root directory. Check whether the version information file can
|
||||
// be found in one of the parent directories. For performance reasons this
|
||||
// step is only done, if the previous directory was marked as versioned by
|
||||
// m_versionedDirectory. Drawback: Until e. g. Git is recognized, the root directory
|
||||
// must be shown at least once.
|
||||
if (m_versionedDirectory) {
|
||||
KUrl dirUrl(directory);
|
||||
KUrl upUrl = dirUrl.upUrl();
|
||||
int upUrlCounter = 1;
|
||||
while ((upUrlCounter < bestScore) && (upUrl != dirUrl)) {
|
||||
const QString fileName = dirUrl.path(KUrl::AddTrailingSlash) + plugin->fileName();
|
||||
if (QDir(fileName).exists()) {
|
||||
if (upUrlCounter < bestScore) {
|
||||
bestPlugin = plugin;
|
||||
bestScore = upUrlCounter;
|
||||
}
|
||||
break;
|
||||
// be found in one of the parent directories.
|
||||
KUrl dirUrl(directory);
|
||||
KUrl upUrl = dirUrl.upUrl();
|
||||
int upUrlCounter = 1;
|
||||
while ((upUrlCounter < bestScore) && (upUrl != dirUrl)) {
|
||||
const QString fileName = dirUrl.path(KUrl::AddTrailingSlash) + plugin->fileName();
|
||||
if (QDir(fileName).exists()) {
|
||||
if (upUrlCounter < bestScore) {
|
||||
bestPlugin = plugin;
|
||||
bestScore = upUrlCounter;
|
||||
}
|
||||
dirUrl = upUrl;
|
||||
upUrl = dirUrl.upUrl();
|
||||
++upUrlCounter;
|
||||
break;
|
||||
}
|
||||
dirUrl = upUrl;
|
||||
upUrl = dirUrl.upUrl();
|
||||
++upUrlCounter;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue