mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 08:24:46 +00:00
fix(projects): preserve exact placement identity
This commit is contained in:
@@ -159,6 +159,21 @@ describe("deriveProjectGroupKey", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("preserves leading whitespace in SCP repository paths", () => {
|
||||
const rootPath = path.resolve("repo");
|
||||
const derive = (remoteUrl: string) =>
|
||||
deriveProjectGroupKey({
|
||||
rootPath,
|
||||
remoteUrl,
|
||||
worktreeRoot: rootPath,
|
||||
mainRepoRoot: null,
|
||||
});
|
||||
|
||||
expect(derive("git@example.com: acme/repo.git")).not.toBe(
|
||||
derive("git@example.com:acme/repo.git"),
|
||||
);
|
||||
});
|
||||
|
||||
test("does not parse drive-relative Windows paths as SCP remotes", () => {
|
||||
const rootPath = path.resolve("repo");
|
||||
|
||||
|
||||
@@ -50,9 +50,8 @@ function encodeSelectedPath(selectedPath: string): string {
|
||||
}
|
||||
|
||||
function deriveRemoteProjectGroupKey(remoteUrl: string | null): string | null {
|
||||
const trimmed = remoteUrl?.trim();
|
||||
if (!trimmed) return null;
|
||||
const remote = parseRemoteLocation(trimmed);
|
||||
if (!remoteUrl?.trim()) return null;
|
||||
const remote = parseRemoteLocation(remoteUrl);
|
||||
if (!remote) return null;
|
||||
const cleanedPath = normalizeRemotePath(
|
||||
remote.path,
|
||||
@@ -143,7 +142,7 @@ function normalizeRemotePath(
|
||||
decodePercentEncoding: boolean,
|
||||
stripDotGitSuffix: boolean,
|
||||
): string {
|
||||
const trimmedPath = remotePath.trim().replace(/\/+$/, "");
|
||||
const trimmedPath = remotePath.replace(/\/+$/, "");
|
||||
const pathForEncoding = preserveLeadingSlash ? trimmedPath : trimmedPath.replace(/^\/+/, "");
|
||||
const segments = pathForEncoding.split("/");
|
||||
const decodedSegments = segments.map((segment) => {
|
||||
|
||||
Reference in New Issue
Block a user