Refactor runtime app architecture (#1878)
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -220,10 +220,14 @@ describe('getDiff', () => {
|
||||
|
||||
const result = await getDiff('/repo', 'src/file.ts', false)
|
||||
|
||||
expect(gitExecFileAsyncBufferMock).toHaveBeenNthCalledWith(2, ['show', 'HEAD:src/file.ts'], {
|
||||
cwd: '/repo',
|
||||
maxBuffer: 10 * 1024 * 1024
|
||||
})
|
||||
expect(gitExecFileAsyncBufferMock).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
['show', '--end-of-options', 'HEAD:src/file.ts'],
|
||||
{
|
||||
cwd: '/repo',
|
||||
maxBuffer: 10 * 1024 * 1024
|
||||
}
|
||||
)
|
||||
expect(result.originalContent).toBe('head-content\n')
|
||||
expect(result.modifiedContent).toBe('working-tree-content')
|
||||
})
|
||||
|
||||
@@ -551,7 +551,7 @@ async function resolveCompareRef(worktreePath: string): Promise<string> {
|
||||
}
|
||||
|
||||
async function resolveRefOid(worktreePath: string, ref: string): Promise<string> {
|
||||
const { stdout } = await gitExecFileAsync(['rev-parse', '--verify', ref], {
|
||||
const { stdout } = await gitExecFileAsync(['rev-parse', '--verify', '--end-of-options', ref], {
|
||||
cwd: worktreePath
|
||||
})
|
||||
return stdout.trim()
|
||||
@@ -613,10 +613,13 @@ async function readGitBlobAtOidPath(
|
||||
filePath: string
|
||||
): Promise<GitBlobReadResult> {
|
||||
try {
|
||||
const { stdout } = await gitExecFileAsyncBuffer(['show', `${oid}:${filePath}`], {
|
||||
cwd: worktreePath,
|
||||
maxBuffer: MAX_GIT_SHOW_BYTES
|
||||
})
|
||||
const { stdout } = await gitExecFileAsyncBuffer(
|
||||
['show', '--end-of-options', `${oid}:${filePath}`],
|
||||
{
|
||||
cwd: worktreePath,
|
||||
maxBuffer: MAX_GIT_SHOW_BYTES
|
||||
}
|
||||
)
|
||||
|
||||
return { ...bufferToBlob(stdout, filePath), exists: true }
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user