mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[git] AT-1563 Don't use lateinit for GitRepositoryImpl#repoInfo
GitOrigin-RevId: 67fa30e797617718c6a0efb2e5941c0035a84fd0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
74ae64a93c
commit
a9dda8946f
@@ -47,7 +47,7 @@ class GitRepositoryImpl private constructor(
|
||||
private val tagHolder: GitTagHolder
|
||||
|
||||
@Volatile
|
||||
private lateinit var repoInfo: GitRepoInfo
|
||||
private var repoInfo: GitRepoInfo
|
||||
|
||||
@Volatile
|
||||
private var recentCheckoutBranches = emptyList<GitLocalBranch>()
|
||||
@@ -65,6 +65,7 @@ class GitRepositoryImpl private constructor(
|
||||
Disposer.register(this, untrackedFilesHolder)
|
||||
|
||||
tagHolder = GitTagHolder(this)
|
||||
repoInfo = readRepoInfo()
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
@@ -156,7 +157,7 @@ class GitRepositoryImpl private constructor(
|
||||
|
||||
override fun update() {
|
||||
ApplicationManager.getApplication().assertIsNonDispatchThread()
|
||||
val previousInfo = if (::repoInfo.isInitialized) repoInfo else null
|
||||
val previousInfo = repoInfo
|
||||
repoInfo = readRepoInfo()
|
||||
notifyIfRepoChanged(this, previousInfo, repoInfo)
|
||||
}
|
||||
@@ -254,14 +255,13 @@ class GitRepositoryImpl private constructor(
|
||||
parentDisposable: Disposable,
|
||||
): GitRepository {
|
||||
ProgressManager.checkCanceled()
|
||||
return GitRepositoryImpl(project, root, gitDir, parentDisposable).apply { installListeners() }
|
||||
}
|
||||
|
||||
private fun GitRepositoryImpl.installListeners() {
|
||||
val updater = GitRepositoryUpdater(this, repositoryFiles)
|
||||
updater.installListeners(this)
|
||||
update()
|
||||
untrackedFilesHolder.invalidate()
|
||||
return GitRepositoryImpl(project, root, gitDir, parentDisposable).apply {
|
||||
val initialRepoInfo = repoInfo
|
||||
val updater = GitRepositoryUpdater(this, this.repositoryFiles)
|
||||
updater.installListeners(this)
|
||||
notifyIfRepoChanged(this, null, initialRepoInfo)
|
||||
this.untrackedFilesHolder.invalidate()
|
||||
}
|
||||
}
|
||||
|
||||
private fun notifyIfRepoChanged(repository: GitRepository, previousInfo: GitRepoInfo?, info: GitRepoInfo) {
|
||||
|
||||
Reference in New Issue
Block a user