MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / keepWorktree

Function keepWorktree

source code/utils/worktree.ts:782–813  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

780}
781
782export async function keepWorktree(): Promise<void> {
783 if (!currentWorktreeSession) {
784 return
785 }
786
787 try {
788 const { worktreePath, originalCwd, worktreeBranch } = currentWorktreeSession
789
790 // Change back to original directory first
791 process.chdir(originalCwd)
792
793 // Clear the session but keep the worktree intact
794 currentWorktreeSession = null
795
796 // Update config
797 saveCurrentProjectConfig(current => ({
798 ...current,
799 activeWorktreeSession: undefined,
800 }))
801
802 logForDebugging(
803 `Linked worktree preserved at: ${worktreePath}${worktreeBranch ? ` on branch: ${worktreeBranch}` : ''}`,
804 )
805 logForDebugging(
806 `You can continue working there by running: cd ${worktreePath}`,
807 )
808 } catch (error) {
809 logForDebugging(`Error keeping worktree: ${error}`, {
810 level: 'error',
811 })
812 }
813}
814
815export async function cleanupWorktree(): Promise<void> {
816 if (!currentWorktreeSession) {

Callers 2

callFunction · 0.85
handleSelectFunction · 0.85

Calls 2

saveCurrentProjectConfigFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected