@@ -71,11 +71,9 @@ class RealSquareGit(rootDir: Path, private val context: CoroutineContext) : Squa
7171 }
7272
7373 override suspend fun findRecentSharedCommits (baseRef : String , count : Int ): List <ObjectId > {
74- val originRef = if (baseRef.startsWith(" origin/" )) baseRef else " origin/$baseRef "
75- LOGGER .info(" Finding merge base between $originRef and ${Constants .HEAD } " )
74+ LOGGER .info(" Finding merge base between $baseRef and ${Constants .HEAD } " )
7675 val baseCommit =
77- repository.resolve(originRef)
78- ? : throw IllegalStateException (" $originRef could not be resolved" )
76+ repository.resolve(baseRef) ? : throw IllegalStateException (" $baseRef could not be resolved" )
7977 val headCommit =
8078 repository.resolve(Constants .HEAD )
8179 ? : throw IllegalStateException (" ${Constants .HEAD } could not be resolved" )
@@ -90,7 +88,7 @@ class RealSquareGit(rootDir: Path, private val context: CoroutineContext) : Squa
9088 }
9189 }
9290 if (mergeBase == null ) {
93- throw IllegalStateException (" No merge base found between $originRef and ${Constants .HEAD } " )
91+ throw IllegalStateException (" No merge base found between $baseRef and ${Constants .HEAD } " )
9492 }
9593 val commits = git.log().add(mergeBase).call().take(count).map { it.id }
9694 return commits
@@ -107,7 +105,7 @@ class RealSquareGit(rootDir: Path, private val context: CoroutineContext) : Squa
107105 @OptIn(ExperimentalCoroutinesApi ::class )
108106 override suspend fun findChangedFiles (baseRef : String ): Result <Set <Path >> = runCatching {
109107 val baseCommit =
110- findRecentSharedCommits(baseRef)?.first ()
108+ findRecentSharedCommits(baseRef).firstOrNull ()
111109 ? : throw IllegalStateException (" No recent shared commits found" )
112110 LOGGER .debug(" Got comparison labels: {}" , getComparisonLabels(baseCommit))
113111
0 commit comments