exitRestoredWorktree function
void
exitRestoredWorktree({})
Undo restoreWorktreeForResume before a mid-session /resume switches to another session.
Implementation
void exitRestoredWorktree({
Map<String, dynamic>? Function()? getCurrentWorktreeSession,
void Function(Map<String, dynamic>?)? restoreWorktreeSession,
void Function(String)? setCwd,
void Function(String)? setOriginalCwd,
void Function()? clearCaches,
}) {
final current = getCurrentWorktreeSession?.call();
if (current == null) return;
restoreWorktreeSession?.call(null);
clearCaches?.call();
final originalCwd = current['originalCwd'] as String?;
if (originalCwd == null) return;
try {
Directory.current = originalCwd;
} catch (_) {
return;
}
setCwd?.call(originalCwd);
setOriginalCwd?.call(Directory.current.path);
}