MCPcopy
hub / github.com/coder/mux / cleanStaleLock

Function cleanStaleLock

src/node/git.ts:22–34  ·  view source on GitHub ↗
(repoPath: string)

Source from the content-addressed store, hash-verified

20const STALE_LOCK_AGE_MS = 5000; // 5 seconds
21
22export function cleanStaleLock(repoPath: string): void {
23 const lockPath = path.join(repoPath, ".git", "index.lock");
24 try {
25 const stat = fs.statSync(lockPath);
26 const ageMs = Date.now() - stat.mtimeMs;
27 if (ageMs > STALE_LOCK_AGE_MS) {
28 fs.unlinkSync(lockPath);
29 log.info(`Removed stale git index.lock (age: ${Math.round(ageMs / 1000)}s) at ${lockPath}`);
30 }
31 } catch {
32 // Lock doesn't exist or can't be accessed - this is fine
33 }
34}
35
36export interface WorktreeResult {
37 success: boolean;

Callers 8

git.test.tsFile · 0.90
createWorkspaceMethod · 0.90
renameWorkspaceMethod · 0.90
deleteWorkspaceMethod · 0.90
createWorktreeFunction · 0.85
removeWorktreeFunction · 0.85
pruneWorktreesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected