diff --git a/.changeset/clean-roots-match.md b/.changeset/clean-roots-match.md new file mode 100644 index 0000000..04dbd2b --- /dev/null +++ b/.changeset/clean-roots-match.md @@ -0,0 +1,5 @@ +--- +'frog': patch +--- + +Normalize Git repository roots before binding the file store so Windows commands accept equivalent path separators. diff --git a/src/cli/internal/context.test.ts b/src/cli/internal/context.test.ts new file mode 100644 index 0000000..d85fe79 --- /dev/null +++ b/src/cli/internal/context.test.ts @@ -0,0 +1,9 @@ +import path from 'node:path' +import * as helpers from '../../../test/helpers.js' +import * as context from './context.js' + +test('behavior: normalizes the repository root for local consumers', async () => { + const cwd = await helpers.repo() + + expect((await context.resolve({ cwd })).root).toBe(path.resolve(cwd)) +}) diff --git a/src/cli/internal/context.ts b/src/cli/internal/context.ts index fc9a591..e98c271 100644 --- a/src/cli/internal/context.ts +++ b/src/cli/internal/context.ts @@ -1,3 +1,4 @@ +import path from 'node:path' import { z } from 'incur' import * as Config from '../../Config.js' import * as Git from '../../Git.js' @@ -17,7 +18,7 @@ export type Context = { */ export async function resolve(options: resolve.Options = {}): Promise { const cwd = options.cwd ?? process.cwd() - const root = (await Git.root({ cwd })) ?? cwd + const root = path.resolve((await Git.root({ cwd })) ?? cwd) const remote = await Git.repo({ cwd: root }) const config = await Config.resolve({ root,