Git: Improve tracking of external changes to HEAD

Instead of using FileSystemWatcher, emit repositoryChanged when
refreshTopic is called.

This reverts commit 2a8c48cb15.

Fixes: QTCREATORBUG-21089
Change-Id: Iaee8a895f3bc087583cbdea11c6dc2c263694a86
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Orgad Shaneh
2022-10-11 16:28:02 +03:00
committed by Orgad Shaneh
parent e757122843
commit 8394bb0a2b
2 changed files with 25 additions and 36 deletions

View File

@@ -85,29 +85,6 @@ namespace Git::Internal {
using GitClientMemberFunc = void (GitClient::*)(const FilePath &) const;
class GitTopicCache : public IVersionControl::TopicCache
{
public:
GitTopicCache(GitClient *client) :
m_client(client)
{ }
protected:
FilePath trackFile(const FilePath &repository) override
{
const QString gitDir = m_client->findGitDirForRepository(repository);
return gitDir.isEmpty() ? FilePath() : FilePath::fromString(gitDir + "/HEAD");
}
QString refreshTopic(const FilePath &repository) override
{
return m_client->synchronousTopic(repository);
}
private:
GitClient *m_client;
};
class GitReflogEditorWidget : public GitEditorWidget
{
public:
@@ -437,6 +414,30 @@ public:
static GitPluginPrivate *dd = nullptr;
class GitTopicCache : public IVersionControl::TopicCache
{
public:
GitTopicCache(GitClient *client) :
m_client(client)
{ }
protected:
FilePath trackFile(const FilePath &repository) override
{
const QString gitDir = m_client->findGitDirForRepository(repository);
return gitDir.isEmpty() ? FilePath() : FilePath::fromString(gitDir + "/HEAD");
}
QString refreshTopic(const FilePath &repository) override
{
emit dd->repositoryChanged(repository);
return m_client->synchronousTopic(repository);
}
private:
GitClient *m_client;
};
GitPluginPrivate::~GitPluginPrivate()
{
cleanCommitMessageFile();