-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(core): filter branch in preparation for nx import #27652
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
97e1750
to
0df1f8f
Compare
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 5d5aa16. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 3 targetsSent with 💌 from NxCloud. |
a405076
to
dd30ea1
Compare
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx [email protected] my-workspace Or just copy this version and use it in your own command: 0.0.0-pr-27652-a405076
To request a new release for this pull request, mention someone from the Nx team or the |
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx [email protected] my-workspace Or just copy this version and use it in your own command: 0.0.0-pr-27652-0a94c12
To request a new release for this pull request, mention someone from the Nx team or the |
c83e4bd
to
2ddd822
Compare
2ddd822
to
a15068b
Compare
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx [email protected] my-workspace Or just copy this version and use it in your own command: 0.0.0-pr-27652-a15068b
To request a new release for this pull request, mention someone from the Nx team or the |
a15068b
to
3af8043
Compare
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx [email protected] my-workspace Or just copy this version and use it in your own command: 0.0.0-pr-27652-3af8043
To request a new release for this pull request, mention someone from the Nx team or the |
5afacbf
to
5a954f2
Compare
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx [email protected] my-workspace Or just copy this version and use it in your own command: 0.0.0-pr-27652-5a954f2
To request a new release for this pull request, mention someone from the Nx team or the |
161cc40
to
8b3f1eb
Compare
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx [email protected] my-workspace Or just copy this version and use it in your own command: 0.0.0-pr-27652-161cc40
To request a new release for this pull request, mention someone from the Nx team or the |
8b3f1eb
to
cc7682b
Compare
fa7e140
to
6c0bafe
Compare
1746961
to
ef19c0f
Compare
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx [email protected] my-workspace Or just copy this version and use it in your own command: 0.0.0-pr-27652-1746961
To request a new release for this pull request, mention someone from the Nx team or the |
f8ea88a
to
8b04549
Compare
8b04549
to
5d5aa16
Compare
This PR fixes an issue with `nx import` where multiple directories cannot be imported from the same repo. We now use `git filter-repo` (if installed) or `git filter-branch` (fallback) to prepare the repo for import so anything not in the subdirectory will be ignored (i.e. cleaner history). Note: `filter-repo` is much faster but requires the user to install it first via their package manager (e.g. `brew install git-filter-repo` or `apt install git-filter-repo`). We fallback to `git filter-branch` since it comes with git, but it is slower, so the process may take 10+ minutes on really large monorepos (e.g. next.js). Also: - Use `await` before returning a promise to Node can maintain correct stacktrace - Remove logic for `if (relativeSourceDir === '')` since using `filter-branch` moves all the files to the root (`.`) - Default destination project location to be the same as source (e.g. importing `packages/a` will go to `packages/a` unless user types in something else) - Add `--depth` option if users don't want to clone with full history (default is full history) - Fix issues with special characters causing `git ls-files` + `git mv` to since `mv` doesn't work with escaped names <!-- 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 --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes # (cherry picked from commit ab408ab)
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
This PR fixes an issue with
nx import
where multiple directories cannot be imported from the same repo. We now usegit filter-repo
(if installed) orgit filter-branch
(fallback) to prepare the repo for import so anything not in the subdirectory will be ignored (i.e. cleaner history).Note:
filter-repo
is much faster but requires the user to install it first via their package manager (e.g.brew install git-filter-repo
orapt install git-filter-repo
). We fallback togit filter-branch
since it comes with git, but it is slower, so the process may take 10+ minutes on really large monorepos (e.g. next.js).Also:
await
before returning a promise to Node can maintain correct stacktraceif (relativeSourceDir === '')
since usingfilter-branch
moves all the files to the root (.
)packages/a
will go topackages/a
unless user types in something else)--depth
option if users don't want to clone with full history (default is full history)git ls-files
+git mv
to sincemv
doesn't work with escaped namesCurrent Behavior
Expected Behavior
Related Issue(s)
Fixes #