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

Gracefully handle branch not having an upstream #321

Merged
merged 7 commits into from
Jan 12, 2019
Merged

Gracefully handle branch not having an upstream #321

merged 7 commits into from
Jan 12, 2019

Conversation

itaisteinherz
Copy link
Collaborator

@itaisteinherz itaisteinherz commented Jan 9, 2019

This fixes #90.
Let me know if there should be added a test for this to prevent future regressions.

@sindresorhus
Copy link
Owner

Let me know if there should be added a test for this to prevent future regressions.

That would be great, but we don't really have a good test suite setup yet. See #29. Up to you, but it's not a blocker to add tests.

index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
lib/git-util.js Outdated Show resolved Hide resolved
Co-Authored-By: itaisteinherz <itaisteinherz@gmail.com>
lib/git-util.js Outdated Show resolved Hide resolved
@sindresorhus sindresorhus merged commit 535e190 into sindresorhus:master Jan 12, 2019
@sindresorhus
Copy link
Owner

This is great. Thank you 🙌

@itaisteinherz itaisteinherz deleted the handle-no-upstream branch January 12, 2019 08:26
@itaisteinherz
Copy link
Collaborator Author

@sindresorhus It would be great if you could approve this PR on IssueHunt as well 🙃

@sindresorhus
Copy link
Owner

Done. Was gonna do it right when merging, but it hadn't updated yet on IssueHunt then.

@kyleolsondesign
Copy link

This is failing for me using npm@6.7.0

$ git status --short --branch --porcelain=2
error: option `porcelain' takes no value

@itaisteinherz
Copy link
Collaborator Author

@kyleolsondesign Are you running the command inside a Git repo? Also, which version of Git are you using?
In case you're using Git submodules, the issue might be related to this.
If you're using Git v2.11 or higher, the command should work as expected.

@kyleolsondesign
Copy link

I'm not using sub-modules

$ git --version
git version 2.4.5

I suppose that is a bit old, but I believe I'm just using what comes with the xcode tools bundled in macOS Mojave, which means it would be a pretty common issue.

I can file a separate issue here if you'd like :)

@itaisteinherz
Copy link
Collaborator Author

itaisteinherz commented Feb 12, 2019

Yes, it would be better to discuss this in a separate issue 🙃
However, from what I can tell, this is an issue related to Git which has been resolved in its newer versions. Upgrading to the latest Git should fix the problem (that could be done using the installer or using Homebrew - brew install git).

@kyleolsondesign
Copy link

Ah, it looks like did install via brew at some point, but have not kept it up-to-date.

Mojave apparently comes with a compatible version, so I don't think it's a critical issue to support the legacy git versions... But you might want to consider adding documentation, since you have a dependency on a minimum version.

I believe this is the default mojave version, which according to your original assessment should work :)

$ /usr/bin/git --version
git version 2.17.2 (Apple Git-113)

@itaisteinherz
Copy link
Collaborator Author

@kyleolsondesign Feel free to open a PR which documents this in readme.md 👍🏻

@kyleolsondesign
Copy link

👍 #345

Thanks for your help!

@sindresorhus
Copy link
Owner

@itaisteinherz Maybe we should add a Git version check to np?

@itaisteinherz
Copy link
Collaborator Author

@itaisteinherz Maybe we should add a Git version check to np?

Sounds good 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gracefully handle branch not having an upstream
3 participants