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: lerna diff for repositories without commits #124

Merged
merged 2 commits into from
May 10, 2016

Conversation

joscha
Copy link
Contributor

@joscha joscha commented May 9, 2016

lerna diff on a repository without any commits fails due to:

$ lerna diff
Lerna v2.0.0-beta.7
Independent Versioning Mode
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Errored while running DiffCommand.initialize
Error: Command failed: git rev-list --max-parents=0 HEAD
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

    at checkExecSyncError (child_process.js:470:13)
    at Object.execSync (child_process.js:510:13)
    at Function.execSync (/usr/local/lib/node_modules/lerna/lib/ChildProcessUtilities.js:37:38)
    at Function.getFirstCommit (/usr/local/lib/node_modules/lerna/lib/GitUtilities.js:92:46)
    at DiffCommand.initialize (/usr/local/lib/node_modules/lerna/lib/commands/DiffCommand.js:63:130)
    at DiffCommand._attempt (/usr/local/lib/node_modules/lerna/lib/Command.js:148:21)
    at DiffCommand.runCommand (/usr/local/lib/node_modules/lerna/lib/Command.js:132:12)
    at DiffCommand.run (/usr/local/lib/node_modules/lerna/lib/Command.js:62:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/lerna/bin/lerna.j%

currently.

@joscha joscha force-pushed the do-not-die-on-empty-commit-log branch from 516fcd8 to 71b16cb Compare May 9, 2016 04:03

@logger.logifySync
static hasCommit() {
return ChildProcessUtilities.execSync("git log");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you make this return a boolean instead:

!!ChildProcessUtilities.execSync("git log");

@jamiebuilds
Copy link
Contributor

Thanks for tackling this @joscha

@joscha
Copy link
Contributor Author

joscha commented May 10, 2016

@thejameskyle I made the changes, let me know if that works for you. I can also squash the commits in case you'd like that.

@hzoo
Copy link
Contributor

hzoo commented May 10, 2016

We can squash in the merge now so it's ok

@jamiebuilds jamiebuilds merged commit 02b8996 into lerna:master May 10, 2016
@jamiebuilds
Copy link
Contributor

Thanks!

@joscha joscha deleted the do-not-die-on-empty-commit-log branch May 10, 2016 03:59
@joscha
Copy link
Contributor Author

joscha commented May 10, 2016

Thank you for merging - one thing I thought with the errors we have now in quite a few places - would you be happy to integrate a PR that unifies and cleans up the errors using https://www.npmjs.com/package/define-error ?

@jamiebuilds
Copy link
Contributor

Yeah, errors and error handling are definitely places I want to be focusing on. I'm not sure what that package would do to help though.,

@joscha
Copy link
Contributor Author

joscha commented May 10, 2016

I think exporting the errors and making them importable at the right places would be the first step. The package itself only makes sure that there is a proper stack trace attached.

@lock
Copy link

lock bot commented Dec 28, 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 28, 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