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

Git "no unpulled changes" not working? #390

Closed
ntwb opened this issue Apr 18, 2019 · 6 comments
Closed

Git "no unpulled changes" not working? #390

ntwb opened this issue Apr 18, 2019 · 6 comments

Comments

@ntwb
Copy link
Sponsor

ntwb commented Apr 18, 2019

Description

I've just been testing this package as an alternative to the current publish tool I've been using.

I wanted to test some of the features this tool provides, one of those is:

"Ensures the working directory is clean and that there are no unpulled changes"

My test of "the working directory is clean" worked perfectly, though the test of "no unpulled changes" failed.

Steps to reproduce

Here is the output of what I ran:

np --no-yarn --no-publish

Publish a new version of stylelint-config-wordpress (current: 13.1.0)

Commits:
- chore(package): update stylelint to version 10.0.1 (#215)  a78332e
- Update stylelint-find-rules to the latest version 🚀 (#213)  057f539
- chore(package): update eslint-plugin-jest to version 22.0.0 (#212)  8c74c5e
- chore(package): update remark-cli to version 6.0.0 (#211)  9e7ea46
- chore(package): update husky to version 1.1.2 (#210)  bbff6f1

Commit Range:
13.1.0...master

? Select semver increment or specify new version major  14.0.0
? Will bump from 13.1.0 to 14.0.0. Continue? Yes
  ✔ Git
  ✔ Cleanup
  ⠇ Installing dependencies using npm
    → husky > done
    Running tests using npm
    Bumping version using npm
    Pushing tags
    Creating release draft on GitHub
^C
Aborted!
netweb@Stephens-MacBook-Pro ~/D/C/W/stylelint-config-wordpress> git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
netweb@Stephens-MacBook-Pro ~/D/C/W/stylelint-config-wordpress> git pull
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
From github.com:WordPress-Coding-Standards/stylelint-config-wordpress
   a78332e..51a0b30  master     -> origin/master
Updating a78332e..51a0b30
Fast-forward
 package.json | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

I hit CTRL-C at the "Installing dependencies using npm" step as I knew I had upstream changes that had not yet been pulled into my local checkout.

Looking at https://github.com/sindresorhus/np/blob/master/source/git-tasks.js#L16-L17 I expect the "Check remote history" should have been run, and failed at the Git step/stage of the above workflow but did not.

As you can see after it ran I ran git status followed by git pull to pull in said remote changes that had not yet been pulled.

Expected behavior

I expected the checks to fail when there are upstream changes not yet pulled down

Environment

np - 4.0.2
Node.js - 10.15.0
npm - 6.9.0
Git - 2.21.0
OS - macOS 10.14.4

@itaisteinherz
Copy link
Collaborator

For me the check seems to fail as expected when there are remote commits that don't exist locally. Can you upload a minimal reproducible example / steps to reproduce?

@ntwb
Copy link
Sponsor Author

ntwb commented Apr 18, 2019

  1. Clone a repo you have control of
  2. Run npm install np --save-dev
  3. On the repo on GitHub create a PR with a minor change and merge the PR
  4. Locally run np --no-yarn --no-publish

Expected behavior:

The Git check to fail as there are remote changes not pulled

Actual behavior:

The Git check passes

@itaisteinherz
Copy link
Collaborator

itaisteinherz commented Apr 18, 2019

@ntwb Following the steps above did not lead to any unexpected behavior on my end 😕
The repo I'm testing this on is itai-playground (see itaisteinherz/itai-playground#1).

@sindresorhus
Copy link
Owner

@ntwb Can you try the latest release https://github.com/sindresorhus/np/releases/tag/v5.0.0 ?

@itaisteinherz
Copy link
Collaborator

@ntwb Any chance you could take a look at our comments above? 🙃

@fregante
Copy link
Collaborator

fregante commented Feb 3, 2023

Closing due to age and lack of response. Probably still tracked in #421

@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2023
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

No branches or pull requests

4 participants