diff --git a/.yarn/versions/95d4f806.yml b/.yarn/versions/95d4f806.yml new file mode 100644 index 000000000000..011a784392d6 --- /dev/null +++ b/.yarn/versions/95d4f806.yml @@ -0,0 +1,9 @@ +releases: + "@yarnpkg/plugin-git": patch + +declined: + - "@yarnpkg/plugin-essentials" + - "@yarnpkg/plugin-github" + - "@yarnpkg/plugin-version" + - "@yarnpkg/plugin-workspace-tools" + - "@yarnpkg/cli" diff --git a/packages/plugin-git/sources/gitUtils.ts b/packages/plugin-git/sources/gitUtils.ts index 4472fb382a90..e817dc10f083 100644 --- a/packages/plugin-git/sources/gitUtils.ts +++ b/packages/plugin-git/sources/gitUtils.ts @@ -302,18 +302,16 @@ export async function fetchRoot(initialCwd: PortablePath) { // it may return long paths even when the cwd uses short paths, and we have no // way to detect it from Node (not even realpath). - let match: PortablePath | null = null; - let cwd: PortablePath; let nextCwd = initialCwd; do { cwd = nextCwd; if (await xfs.existsPromise(ppath.join(cwd, `.git` as Filename))) - match = cwd; + return cwd; nextCwd = ppath.dirname(cwd); - } while (match === null && nextCwd !== cwd); + } while (nextCwd !== cwd); - return match; + return null; } export async function fetchBase(root: PortablePath, {baseRefs}: {baseRefs: Array}) {