| 1801 | } |
| 1802 | |
| 1803 | void GitPlugin::unregisterRepositoryForCurrentBranchChanges(const QUrl& repository, const QObject* listener) |
| 1804 | { |
| 1805 | Q_ASSERT(listener); // precondition |
| 1806 | const auto headFile = gitHeadFile(repository); |
| 1807 | qCDebug(PLUGIN_GIT) << "unregistering repository" << repository.toString(QUrl::PreferLocalFile) << "and listener" |
| 1808 | << listener << "with the HEAD file" << headFile; |
| 1809 | |
| 1810 | const auto it = findWatchedFile(headFile); |
| 1811 | if (it == m_watchedFiles.end()) { |
| 1812 | qCDebug(PLUGIN_GIT) << "the HEAD file" << headFile << "is not watched => nothing to do"; |
| 1813 | return; |
| 1814 | } |
| 1815 | |
| 1816 | // unregister listener from one of possibly multiple same-URL repositories |
| 1817 | it->listeners.removeOne(listener); |
| 1818 | // clean up |
| 1819 | if (it->listeners.empty()) { |
| 1820 | m_watchedFiles.erase(it); |
| 1821 | m_watcher->removeFile(headFile); |
| 1822 | qCDebug(PLUGIN_GIT) << "stopped watching the HEAD file" << headFile; |
| 1823 | } |
| 1824 | } |
| 1825 | |
| 1826 | void GitPlugin::fileChanged(const QString& file) |
| 1827 | { |