| 1780 | } |
| 1781 | |
| 1782 | void GitPlugin::registerRepositoryForCurrentBranchChanges(const QUrl& repository, const QObject* listener) |
| 1783 | { |
| 1784 | Q_ASSERT(listener); // precondition |
| 1785 | const auto headFile = gitHeadFile(repository); |
| 1786 | qCDebug(PLUGIN_GIT) << "registering repository" << repository.toString(QUrl::PreferLocalFile) << "and listener" |
| 1787 | << listener << "with the HEAD file" << headFile; |
| 1788 | |
| 1789 | const auto it = findWatchedFile(headFile); |
| 1790 | if (it == m_watchedFiles.end()) { |
| 1791 | auto& watchedFile = m_watchedFiles.emplace_back(headFile); |
| 1792 | Q_ASSERT(watchedFile.listeners.empty()); |
| 1793 | watchedFile.listeners.push_back(listener); |
| 1794 | |
| 1795 | m_watcher->addFile(headFile); |
| 1796 | qCDebug(PLUGIN_GIT) << "started watching the HEAD file" << headFile; |
| 1797 | } else { |
| 1798 | // headFile is already watched => just register another listener |
| 1799 | it->listeners.push_back(listener); |
| 1800 | } |
| 1801 | } |
| 1802 | |
| 1803 | void GitPlugin::unregisterRepositoryForCurrentBranchChanges(const QUrl& repository, const QObject* listener) |
| 1804 | { |