@@ -105,9 +105,6 @@ object AICommitsUtils {
105105 reversePatch : Boolean ,
106106 project : Project
107107 ): String {
108-
109- val gitRepositoryManager = GitRepositoryManager .getInstance(project)
110-
111108 // go through included changes, create a map of repository to changes and discard nulls
112109 val changesByRepository = includedChanges
113110 .filter {
@@ -117,9 +114,9 @@ object AICommitsUtils {
117114 }
118115 .mapNotNull { change ->
119116 change.filePath()?.let { filePath ->
120- gitRepositoryManager.getRepositoryForFileQuick(
121- filePath
122- ) to change
117+ VcsUtil .getVcsRootFor(project, filePath)?. let { vcsRoot ->
118+ vcsRoot to change
119+ }
123120 }
124121 }
125122 .filter { ! it.second.isSubmoduleChange(project) }
@@ -128,19 +125,17 @@ object AICommitsUtils {
128125
129126 // compute diff for each repository
130127 return changesByRepository
131- .map { (repository, changes) ->
132- repository?.let {
133- val filePatches = IdeaTextPatchBuilder .buildPatch(
134- project,
135- changes,
136- repository.root.toNioPath(), reversePatch, true
137- )
138-
139- val stringWriter = StringWriter ()
140- stringWriter.write(" Repository: ${repository.root.path} \n " )
141- UnifiedDiffWriter .write(project, filePatches, stringWriter, " \n " , null )
142- stringWriter.toString()
143- }
128+ .map { (vcsRoot, changes) ->
129+ val filePatches = IdeaTextPatchBuilder .buildPatch(
130+ project,
131+ changes,
132+ vcsRoot.toNioPath(), reversePatch, true
133+ )
134+
135+ val stringWriter = StringWriter ()
136+ stringWriter.write(" Repository: ${vcsRoot.path} \n " )
137+ UnifiedDiffWriter .write(project, filePatches, stringWriter, " \n " , null )
138+ stringWriter.toString()
144139 }
145140 .joinToString(" \n " )
146141 }
0 commit comments