MCPcopy Index your code
hub / github.com/codeaashu/claude-code / checkOutTeleportedSessionBranch

Function checkOutTeleportedSessionBranch

src/utils/teleport.tsx:315–344  ·  view source on GitHub ↗
(branch?: string)

Source from the content-addressed store, hash-verified

313 * @returns The current branch name and any error that occurred
314 */
315export async function checkOutTeleportedSessionBranch(branch?: string): Promise<{
316 branchName: string;
317 branchError: Error | null;
318}> {
319 try {
320 const currentBranch = await getCurrentBranch();
321 logForDebugging(`Current branch before teleport: '${currentBranch}'`);
322 if (branch) {
323 logForDebugging(`Switching to branch '${branch}'...`);
324 await fetchFromOrigin(branch);
325 await checkoutBranch(branch);
326 const newBranch = await getCurrentBranch();
327 logForDebugging(`Branch after checkout: '${newBranch}'`);
328 } else {
329 logForDebugging('No branch specified, staying on current branch');
330 }
331 const branchName = await getCurrentBranch();
332 return {
333 branchName,
334 branchError: null
335 };
336 } catch (error) {
337 const branchName = await getCurrentBranch();
338 const branchError = toError(error);
339 return {
340 branchName,
341 branchError
342 };
343 }
344}
345
346/**
347 * Result of repository validation for teleport

Callers 3

runFunction · 0.85
teleportWithProgressFunction · 0.85
loadInitialMessagesFunction · 0.85

Calls 5

getCurrentBranchFunction · 0.85
logForDebuggingFunction · 0.85
fetchFromOriginFunction · 0.85
checkoutBranchFunction · 0.85
toErrorFunction · 0.85

Tested by

no test coverage detected