Skip to content

Commit

Permalink
fix(core): fix importing files with special characters (#27484)
Browse files Browse the repository at this point in the history
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Files which have special characters in the path cannot be imported.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Files which have special characters in the path can be imported.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #27468

(cherry picked from commit a5b93b8)
  • Loading branch information
FrozenPandaz committed Aug 21, 2024
1 parent e269414 commit 8ea11bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ export async function prepareSourceRepo(
await rm(destinationInSource, {
recursive: true,
});
await gitClient.commit('chore(repo): prepare for import');
await gitClient.commit(
`chore(repo): move ${source} to ${relativeDestination} to prepare to be imported`
);
needsSquash = true;
} catch {}

Expand Down Expand Up @@ -118,7 +120,9 @@ export async function prepareSourceRepo(
});
}
}
await gitClient.commit('chore(repo): prepare for import 2');
await gitClient.commit(
`chore(repo): move ${source} to ${relativeDestination} to prepare to be imported`
);
if (needsSquash) {
await gitClient.squashLastTwoCommits();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/utils/git-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class GitRepository {
}

async move(path: string, destination: string) {
return this.execAsync(`git mv ${path} ${destination}`);
return this.execAsync(`git mv "${path}" "${destination}"`);
}

async push(ref: string, remoteName: string) {
Expand Down

0 comments on commit 8ea11bd

Please sign in to comment.