Skip to content

Commit

Permalink
[eas-cli] Fix git repo root path on Windows (#429)
Browse files Browse the repository at this point in the history
* Fix git repo root path on Windows

* Update CHANGELOG
  • Loading branch information
brentvatne authored Jun 2, 2021
1 parent 91b531d commit 168cb4d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ This is the log of notable changes to EAS CLI and related packages.
### 🐛 Bug fixes

- Fix bundle identifier resolution when native target is not provided. ([#434](https://github.com/expo/eas-cli/pull/434) by [@dsokal](https://github.com/dsokal))
- Fix git repo root path getter on Windows. ([#429](https://github.com/expo/eas-cli/pull/429) by [@brentvatne](https://github.com/brentvatne))

### 🧹 Chores

- Android credentials setup now on Graphql API ([#434](https://github.com/expo/eas-cli/pull/427) by [@quinlanj](https://github.com/quinlanj))
- Android credentials setup now on Graphql API. ([#434](https://github.com/expo/eas-cli/pull/427) by [@quinlanj](https://github.com/quinlanj))

## [0.16.0](https://github.com/expo/eas-cli/releases/tag/v0.16.0) - 2021-05-26

Expand Down
14 changes: 13 additions & 1 deletion packages/eas-cli/src/build/utils/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ async function makeProjectTarballAsync(): Promise<{ path: string; size: number }
'--no-hardlinks',
'--depth',
'1',
`file://${await gitRootDirectoryAsync()}`,
await getGitRootFullPathAsync(),
shallowClonePath,
]);
await tar.create({ cwd: shallowClonePath, file: tarPath, prefix: 'project', gzip: true }, [
Expand Down Expand Up @@ -152,6 +152,18 @@ async function makeProjectTarballAsync(): Promise<{ path: string; size: number }
return { size, path: tarPath };
}

async function getGitRootFullPathAsync() {
if (process.platform === 'win32') {
// getRootDirectoryAsync() will return C:/path/to/repo on Windows and path
// prefix should be file:///
return `file:///${await gitRootDirectoryAsync()}`;
} else {
// getRootDirectoryAsync() will /path/to/repo, and path prefix should be
// file:/// so only file:// needs to be prepended
return `file://${await gitRootDirectoryAsync()}`;
}
}

async function showDiffAsync() {
const outputTooLarge = (await getGitDiffOutputAsync()).split(/\r\n|\r|\n/).length > 100;
await gitDiffAsync({ withPager: outputTooLarge });
Expand Down

0 comments on commit 168cb4d

Please sign in to comment.