Files
paseo/packages/server/src/utils/git-rev-parse-path.ts
T
paseo-bot[bot] 9246813fd2 Preserve spaces in project folder names for Changes and worktrees (#6686)
* fix(workspaces): preserve spaces in project directory names

Git path output and app workspace descriptors each stripped significant path whitespace. Preserve directory names while retaining single-record Git output validation and workspace separator normalization.

* test(workspaces): capture Changes after files appear

* test(workspaces): release fixtures when setup fails

---------

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
2026-10-12 10:25:18 +02:00

17 lines
511 B
TypeScript

import { resolve } from "node:path";
export function parseGitRevParsePath(stdout: string): string | null {
// Remove Git's record delimiter, not whitespace belonging to the path.
const path = stdout.replace(/\r?\n$/, "");
if (!path || /[\r\n]/.test(path) || path.startsWith("--")) {
return null;
}
return path;
}
export function resolveGitRevParsePath(cwd: string, stdout: string): string | null {
const parsed = parseGitRevParsePath(stdout);
return parsed ? resolve(cwd, parsed) : null;
}