-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 git repository discovery in npm version #221
Conversation
I also opened a thread about it here , but found out that it's an easy fix, so I did the change instead. :) |
When package.json is not in the git root, then npm version bumps didn't make a commit. Issue was with how npm version discovered if it's in a git repository: it assumed that it's a git repository only if .git folder is at the same level as the package.json. In reality you cannot make such assumptions, as the .git directory is implementation detail. Proper way of discovering if you're in a git directory is invoking `git rev-parse --git-dir`.
Can you update the test as well? They're failing: https://travis-ci.com/npm/cli/jobs/219563951#L1661 These look directly related to changes to |
@isaacs it wasn't intentional, will try to figure out why those tests fail. |
I understand there is an argument against doing git tag if this is a package in a subdir of a repo with other packages (with potentially separate versioning -- although here, I would expect users to explicitly disable git tagging?). So if this doesn't get merged, I +1 @reegnz idea to emit warning and/or update |
@zerog2k you can customize the tag prefix in each subdir with |
Pardon my ignorance, but I don't understand what is the resolution of this issue. Is is (going to be) merged in? In what version of There's a label |
@ivos doesn't merged. Original issue is still not resolved npm/npm#9111 |
When package.json is not in the git root, then npm version bumps didn't
make a commit.
Issue was with how npm version discovered if it's in a git repository: it
assumed that it's a git repository only if .git folder is at the same
level as the package.json.
In reality you cannot make such assumptions, as the .git directory is
implementation detail.
Proper way of discovering if you're in a git directory is invoking
git rev-parse --git-dir
.