MCPcopy
hub / github.com/xintaofei/codeg / handleSelectFile

Function handleSelectFile

src/components/layout/push-workspace.tsx:369–386  ·  view source on GitHub ↗
(commitHash: string, file: string)

Source from the content-addressed store, hash-verified

367 }, [selectedRemote, loadCommits])
368
369 async function handleSelectFile(commitHash: string, file: string) {
370 setSelectedFile(file)
371 setSelectedCommit(commitHash)
372 setDiffLoading(true)
373 try {
374 const [orig, mod] = await Promise.all([
375 gitShowFile(folderPath, file, `${commitHash}~1`).catch(() => ""),
376 gitShowFile(folderPath, file, commitHash).catch(() => ""),
377 ])
378 setOriginalContent(orig)
379 setModifiedContent(mod)
380 } catch {
381 setOriginalContent("")
382 setModifiedContent("")
383 } finally {
384 setDiffLoading(false)
385 }
386 }
387
388 async function handlePush() {
389 setPushing(true)

Callers 1

PushWorkspaceFunction · 0.70

Calls 1

gitShowFileFunction · 0.90

Tested by

no test coverage detected