From 8ea11bd7cd264e210dfeda6262f8dfbe5daf5d82 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Mon, 19 Aug 2024 16:48:43 -0400 Subject: [PATCH] fix(core): fix importing files with special characters (#27484) ## Current Behavior Files which have special characters in the path cannot be imported. ## Expected Behavior Files which have special characters in the path can be imported. ## Related Issue(s) Fixes #27468 (cherry picked from commit a5b93b8e83a8595a442f052517c9cdfc93eb3601) --- .../src/command-line/import/utils/prepare-source-repo.ts | 8 ++++++-- packages/nx/src/utils/git-utils.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/nx/src/command-line/import/utils/prepare-source-repo.ts b/packages/nx/src/command-line/import/utils/prepare-source-repo.ts index 65cd5841a4e07..25cae28176531 100644 --- a/packages/nx/src/command-line/import/utils/prepare-source-repo.ts +++ b/packages/nx/src/command-line/import/utils/prepare-source-repo.ts @@ -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 {} @@ -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(); } diff --git a/packages/nx/src/utils/git-utils.ts b/packages/nx/src/utils/git-utils.ts index c05680351429a..f4811781f4aee 100644 --- a/packages/nx/src/utils/git-utils.ts +++ b/packages/nx/src/utils/git-utils.ts @@ -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) {