diff options
| author | David Schulz <david.schulz@qt.io> | 2025-10-23 10:43:21 +0200 |
|---|---|---|
| committer | David Schulz <david.schulz@qt.io> | 2025-10-24 04:58:28 +0000 |
| commit | a8fb8e274fc1d85313b11ecc58ab7122c1ae5dba (patch) | |
| tree | ad7bd535badec1e73404caeef7381070be47714d /src/plugins/git/gitplugin.cpp | |
| parent | 954bc476304b109a93147b8c82fe8bd9f07c893e (diff) | |
Core: Allow passing top level dir modificationState
This avoids looking up the toplevel dir a second time inside the git
plugin. Since the modification state is used inside the project tree
this reduces the time to calculate the size hint in the project tree
from ~250ms to ~100ms for showing the tree for the first time on
windows.
Api: IVersionControl::modificationState(...)
-> IVersionControl::modificationState(..., const FilePath &topLevelDir = {})
Change-Id: Ice89a62265f35d5bd1f87c5c4f1b6c6971e2db8e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Diffstat (limited to 'src/plugins/git/gitplugin.cpp')
| -rw-r--r-- | src/plugins/git/gitplugin.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 02d36dfb440..213b3435cb7 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -157,7 +157,8 @@ public: FilePaths unmanagedFiles(const FilePaths &filePaths) const final; bool isConfigured() const final; - IVersionControl::FileState modificationState(const Utils::FilePath &path) const final; + Core::IVersionControl::FileState modificationState( + const FilePath &path, const FilePath &topLevelDir = {}) const final; void monitorDirectory(const Utils::FilePath &path) final; void stopMonitoringDirectory(const Utils::FilePath &path) final; bool supportsOperation(Operation operation) const final; @@ -1872,11 +1873,13 @@ bool GitPluginPrivate::isConfigured() const return !gitClient().vcsBinary({}).isEmpty(); } -IVersionControl::FileState GitPluginPrivate::modificationState(const Utils::FilePath &path) const +IVersionControl::FileState GitPluginPrivate::modificationState( + const FilePath &path, const FilePath &topLevelDir) const { - const Utils::FilePath projectDir = gitClient().findRepositoryForDirectory(path.absolutePath()); - return gitClient().modificationState(projectDir, path); -} + FilePath projectDir = topLevelDir; + if (projectDir.isEmpty()) + projectDir = gitClient().findRepositoryForDirectory(path.absolutePath()); + return gitClient().modificationState(projectDir, path);} void GitPluginPrivate::monitorDirectory(const Utils::FilePath &path) { |
