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

Fix import command so it works if Lerna root is a subdir of git root #1199

Merged
merged 1 commit into from Jan 16, 2018

Conversation

RoystonS
Copy link
Contributor

Fix for #1197

Description

The code in the import command was computing a targetDir relative to the Lerna root directory, and using that in the Git patches. If the Lerna root directory wasn't in the Git root directory, that produced incorrect import locations.

Motivation and Context

This fix is needed in order to enable Lerna to import correctly if Lerna is not based in the root of the Git workspace.

Fixes issue #1197

How Has This Been Tested?

  1. New unit test added to import command tests. The test creates a Lerna environment where Lerna is in a subdirectory of the Git workspace, and checks that the import works correctly. It failed before I fixed the code, and now passes. I've added a sibling 'describe' that configures an environment where Lerna isn't in the root, in order to avoid touching all the existing tests.
  2. I've manually run the resulting Lerna build on a real-world workspace example I had that previously produced the wrong output. It's now correct.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

The import patches computed for Git need paths relative to the
Git workspace root, but the directory was being computed relative
to the Lerna root.

Added a new utility to GitUtilities to find the Git workspace root.

refs lerna#1197
Copy link
Member

@evocateur evocateur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lock
Copy link

lock bot commented Dec 27, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants