diff options
author | Friedemann Kleint <[email protected]> | 2010-05-20 16:24:39 +0200 |
---|---|---|
committer | Friedemann Kleint <[email protected]> | 2010-05-20 16:24:56 +0200 |
commit | 7003b82e2ba68f24c9e5c27107aacd82898ba9cf (patch) | |
tree | 9b18d005e0b5f34089e82e9092ce852806d5a471 /src/plugins/git/gitversioncontrol.cpp | |
parent | 58a5da63a8b698de6f7faae95afa9e783569353c (diff) |
Version control: Improve detection.
Merge managesDirectory() and findTopLevelForDirectory()
into one giving managesDirectory() an optional topLevel
parameter. This removes the need to go up the directory
hierarchy twice when checking for Merurial or git and also
saves some checks for CVS/Subversion.
VCSManager: Check cache in reverse order starting out with
the full path first to improve handling of nested repositories.
Rubber-stamped-by: con
Acked-by: dt
Diffstat (limited to 'src/plugins/git/gitversioncontrol.cpp')
-rw-r--r-- | src/plugins/git/gitversioncontrol.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/plugins/git/gitversioncontrol.cpp b/src/plugins/git/gitversioncontrol.cpp index 65a46e492e1..370e20bb270 100644 --- a/src/plugins/git/gitversioncontrol.cpp +++ b/src/plugins/git/gitversioncontrol.cpp @@ -206,14 +206,12 @@ bool GitVersionControl::vcsRemoveSnapshot(const QString &topLevel, const QString && gitClient()->synchronousStashRemove(topLevel, stashName); } -bool GitVersionControl::managesDirectory(const QString &directory) const +bool GitVersionControl::managesDirectory(const QString &directory, QString *topLevel) const { - return !GitClient::findRepositoryForDirectory(directory).isEmpty(); -} - -QString GitVersionControl::findTopLevelForDirectory(const QString &directory) const -{ - return GitClient::findRepositoryForDirectory(directory); + const QString topLevelFound = GitClient::findRepositoryForDirectory(directory); + if (topLevel) + *topLevel = topLevelFound; + return !topLevelFound.isEmpty(); } bool GitVersionControl::vcsAnnotate(const QString &file, int line) |