(projectPath: string)
| 698 | } |
| 699 | |
| 700 | private async getWorkspaceBranchMapPath(projectPath: string): Promise<string> { |
| 701 | const gitPath = path.join(projectPath, ".git"); |
| 702 | |
| 703 | try { |
| 704 | const gitPathStat = await fsPromises.stat(gitPath); |
| 705 | if (gitPathStat.isDirectory()) { |
| 706 | return path.join(gitPath, "mux-workspace-branches.json"); |
| 707 | } |
| 708 | |
| 709 | const gitDirRef = await fsPromises.readFile(gitPath, "utf8"); |
| 710 | const gitDirPrefix = "gitdir:"; |
| 711 | const gitDirLine = gitDirRef.trim(); |
| 712 | if (gitDirLine.startsWith(gitDirPrefix)) { |
| 713 | return path.join( |
| 714 | path.resolve(projectPath, gitDirLine.slice(gitDirPrefix.length).trim()), |
| 715 | "mux-workspace-branches.json" |
| 716 | ); |
| 717 | } |
| 718 | } catch { |
| 719 | // Fall through to the default .git path when git metadata is unavailable. |
| 720 | } |
| 721 | |
| 722 | return path.join(gitPath, "mux-workspace-branches.json"); |
| 723 | } |
| 724 | |
| 725 | private async deleteWorkspaceBranchIfSafe(args: { |
| 726 | projectPath: string; |
no test coverage detected