Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eas-cli] Finally fix Windows not-ignoring files #2894

Merged
merged 4 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This is the log of notable changes to EAS CLI and related packages.

### 🐛 Bug fixes

- Fix files not being ignored when creating a tarball on Windows in Git repository in no `requireCommit` mode. ([#2894](https://github.com/expo/eas-cli/pull/2894) by [@sjchmiela](https://github.com/sjchmiela))

### 🧹 Chores

## [15.0.8](https://github.com/expo/eas-cli/releases/tag/v15.0.8) - 2025-02-09
Expand Down
5 changes: 1 addition & 4 deletions packages/eas-cli/src/vcs/clients/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,7 @@ export default class GitClient extends Client {

const easIgnorePath = path.join(rootPath, EASIGNORE_FILENAME);
if (await fs.exists(easIgnorePath)) {
const ignore = await Ignore.createAsync(
// eslint-disable-next-line no-underscore-dangle
process.env.__NORMALIZE === '1' ? path.normalize(rootPath) : rootPath
);
const ignore = await Ignore.createAsync(rootPath);
const wouldNotBeCopiedToClone = ignore.ignores(filePath);
const wouldBeDeletedFromClone =
(
Expand Down
21 changes: 6 additions & 15 deletions packages/eas-cli/src/vcs/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@ export class Ignore {
}

export async function makeShallowCopyAsync(_src: string, dst: string): Promise<void> {
let src = _src;

// eslint-disable-next-line no-underscore-dangle
if (process.env.__NORMALIZE === '1') {
src = path.toNamespacedPath(path.normalize(src));
}
// `node:fs` on Windows adds a namespace prefix (e.g. `\\?\`) to the path provided
// to the `filter` function in `fs.cp`. We need to ensure that we compare the right paths
// (both with prefix), otherwise the `relativePath` ends up being wrong and causes no files
// to be ignored.
const src = path.toNamespacedPath(path.normalize(_src));

Log.debug('makeShallowCopyAsync', { src, dst });
const ignore = await Ignore.createAsync(src);
Expand All @@ -109,15 +108,7 @@ export async function makeShallowCopyAsync(_src: string, dst: string): Promise<v
// Preserve symlinks without re-resolving them to their original targets
verbatimSymlinks: true,
filter: (_srcFilePath: string) => {
let srcFilePath = _srcFilePath;

// eslint-disable-next-line no-underscore-dangle
if (process.env.__NORMALIZE === '1') {
// `node:fs` on Windows adds a namespace prefix (e.g. `\\?\`) to the path.
// We need to ensure that we compare the right paths (both with prefix),
// otherwise the `relativePath` ends up being wrong and causes no files to be ignored.
srcFilePath = path.toNamespacedPath(srcFilePath);
}
const srcFilePath = path.toNamespacedPath(_srcFilePath);

if (srcFilePath === src) {
return true;
Expand Down