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

Skip git repo check by default in Commands which do not rely on git #803

Merged

Conversation

noherczeg
Copy link
Contributor

@noherczeg noherczeg commented May 3, 2017

According to Bootstrap Command's description it is not necessarily true that we need to check if the command was run in a project where there is a pre-initialized git repository. This PR tries to resolve this issue.

Description

I added a --skip-git-check flag to the Bootstrap Command which is on by default resulting in a behavior described above

Motivation and Context

#438

How Has This Been Tested?

I added integration tests.

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.

@noherczeg noherczeg requested a review from evocateur May 3, 2017 00:22
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.

Basically, this isn't really something that needs to be configurable by users; a command either requires git or it doesn't. I think we can get more clarity (and keep the CLI less noisy) with an opt-out subclass getter method override.

src/Command.js Outdated
@@ -175,7 +175,7 @@ export default class Command {
}

runValidations() {
if (!GitUtilities.isInitialized(this.execOpts)) {
if (!this.options.skipGitCheck && !GitUtilities.isInitialized(this.execOpts)) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather this was some sort of class property optionally overridden (kinda like the otherCommandConfigs() getter) when a command requires git. The base class has get requiresGit() { return true; }, and various commands that don't need git can opt-out by overriding the getter method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll update the PR in the evening. Thanks for the feedback!

@noherczeg noherczeg changed the title Skip git repo check by default in Bootstrap Command Skip git repo check by default in Commands which do not rely on git May 3, 2017
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.

Awesome, thanks @noherczeg!

@evocateur evocateur merged commit 64a01ac into lerna:master May 4, 2017
@shospodarets
Copy link

shospodarets commented May 20, 2017

Hey @noherczeg , thanks for revisiting this.
In my case we use Git for development, but then deliver project for the customers, which can use anything.
In that case we want to avoid "lerna botstrap" to throw an error "This is not a git repository" as it still may be fully functional without it.
I tried you solution with version 2.0.0-rc4, but seems still there is a problem:

> lerna "bootstrap" "--skip-git-check"

lerna info version 2.0.0-rc.4
lerna ERR! ENOGIT This is not a git repository, did you already run `git init` or `lerna init`?

Or it's supposed to be available in rc5?

@evocateur
Copy link
Member

Yep, this has not been released yet.

@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