Skip to content

Commit

Permalink
chore(git): remove redundant variable match (#4255)
Browse files Browse the repository at this point in the history
* chore(git): remove redundant variable match

* chore: yarn version check --interactive
  • Loading branch information
trivikr committed Mar 25, 2022
1 parent 8c2f598 commit 8e87c0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .yarn/versions/95d4f806.yml
Original file line number Diff line number Diff line change
@@ -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"
8 changes: 3 additions & 5 deletions packages/plugin-git/sources/gitUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>}) {
Expand Down

0 comments on commit 8e87c0e

Please sign in to comment.