mirror of
https://github.com/stablyai/orca.git
synced 2026-10-05 16:02:22 +00:00
perf(git): skip malformed remote base probes
This commit is contained in:
@@ -176,8 +176,17 @@ describe('OrcaRuntimeService.fetchRemoteWithCache', () => {
|
||||
expect(caches.fetchLastCompletedAt.has('/repo/cache-0::origin')).toBe(false)
|
||||
})
|
||||
|
||||
it.each(['main', 'a'.repeat(40), 'refs/remotes/main', ''])(
|
||||
'does not launch Git for a base without a remote/branch separator: %s',
|
||||
it.each([
|
||||
'main',
|
||||
'a'.repeat(40),
|
||||
'refs/remotes/main',
|
||||
'',
|
||||
'origin/',
|
||||
'/main',
|
||||
'refs/remotes/origin/',
|
||||
'refs/remotes//main'
|
||||
])(
|
||||
'does not launch Git for a base without both remote and branch components: %s',
|
||||
async (base) => {
|
||||
const runtime = new OrcaRuntimeService(null)
|
||||
await expect(runtime.resolveRemoteTrackingBase('/repo/e', base)).resolves.toBeNull()
|
||||
|
||||
@@ -231,7 +231,7 @@ export class RuntimeRemoteFetchController {
|
||||
? baseBranch.slice(remoteRefPrefix.length)
|
||||
: baseBranch
|
||||
// A remote-tracking base needs both a configured remote and a branch component.
|
||||
if (!shortBaseBranch.includes('/')) {
|
||||
if (shortBaseBranch.indexOf('/') <= 0 || shortBaseBranch.endsWith('/')) {
|
||||
return null
|
||||
}
|
||||
let remotes: string[]
|
||||
|
||||
Reference in New Issue
Block a user