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

cannot pull with rebase: You have unstaged changes. #515

Open
gabormagyar opened this issue Sep 12, 2022 · 5 comments
Open

cannot pull with rebase: You have unstaged changes. #515

gabormagyar opened this issue Sep 12, 2022 · 5 comments
Labels
bug Something isn't working waiting for feedback

Comments

@gabormagyar
Copy link
Contributor

Describe the bug

The error:

➤ YN0001: │ Error: Executing 'git pull --rebase --no-verify origin' failed with code: 128

error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.

This happens after monodeploy's yarn install step, which shouldn't change any files that aren't explicitly committed (changelog, package.json, yarn.lock). However in this instance monodeploy's yarn install renamed the two typescript patch files in yarn cache:

Screenshot 2022-09-12 at 12 26 01

If I run yarn install manually the files change back to what they were originally.

I believe this happens because of a mismatch between yarn versions. The install that monodeploy runs creates different TS patches to the one I run. This means monodeploy fails on the changed files when it tries to push.

Updating monodeploy to the latest version fixes the issue.

Please investigate further and figure out what could be done to make the failure easier to understand and fix. Hopefully this could be detected earlier on with a clear error message. Also the publish already happened at this point, so only the commit and push is what fails, which causes an inconsistent state for the package.

Please edit the issue title accordingly (or close).

Environment:

  • Monodeploy Version: 3.0.2
  • Yarn Version: 3.2.3
    • Yarn module linker: pnp
  • Node Version: v16.17.0
  • Git Version: 2.33.1

Full(er) log:

➜ yarn monodeploy 
➤ YN0000: ┌ Determine New Versions
[...]
➤ YN0000: └ Completed
➤ YN0000: ┌ Determine Git Tags
➤ YN0000: └ Completed
➤ YN0000: ┌ Generating Changeset
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetching Workspace Information
➤ YN0000: └ Completed
➤ YN0000: ┌ Updating Changelog
[...]
➤ YN0000: └ Completed
➤ YN0000: ┌ Patching Package Manifests
➤ YN0000: └ Completed
➤ YN0000: ┌ Publishing Packages
[...]
➤ YN0000: │ [Publish] 'package-name' published.
➤ YN0000: └ Completed in 20s 43ms
➤ YN0000: ┌ Updating Project State
➤ YN0000: │ ┌ Resolution step
[...]
➤ YN0000: │ └ Completed in 0s 264ms
➤ YN0000: │ ┌ Fetch step
➤ YN0013: │ │ typescript@patch:typescript@npm%3A4.6.4#~builtin<compat/typescript>::version=4.6.4&hash=7ad353 can't be found in the cache and will be fetched from the disk
➤ YN0013: │ │ typescript@patch:typescript@npm%3A4.7.3#~builtin<compat/typescript>::version=4.7.3&hash=7ad353 can't be found in the cache and will be fetched from the disk
➤ YN0019: │ │ typescript-patch-363d50fa2f-1cb434fbc6.zip appears to be unused - removing
➤ YN0019: │ │ typescript-patch-410f671920-137d18a77f.zip appears to be unused - removing
➤ YN0000: │ └ Completed in 0s 521ms
➤ YN0000: │ ┌ Link step
[...]
➤ YN0000: │ │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: │ └ Completed
➤ YN0000: └ Completed in 1s 53ms
➤ YN0000: ┌ Committing Changes
➤ YN0000: │ [Tag] @package-name@3.10.0
➤ YN0001: │ Error: Executing 'git pull --rebase --no-verify origin' failed with code: 128

error: cannot pull with rebase: You have unstaged changes.
error: please commit or stash them.

    at [...]
➤ YN0000: └ Completed in 0s 309ms
➤ YN0000: ┌ Cleaning Up
➤ YN0000: └ Completed
➤ YN0000: Failed with errors in 25s 411ms
Error: Monodeploy failed
@noahnu noahnu added the bug Something isn't working label Sep 12, 2022
@noahnu
Copy link
Contributor

noahnu commented Sep 12, 2022

This happens because of a bad release of @yarnpkg/plugin-compat. There's typically a way to force the version using a yarn resolution but we can also fix it from within monodeploy directly. I'll take a look.

For reference, this has happened before: https://discord.com/channels/226791405589233664/654372321225605128/924411017746866236

@noahnu
Copy link
Contributor

noahnu commented Sep 12, 2022

I believe yarn 3.2.3 is bundled with plugin-compat 3.1.5 but I'm guessing you have 3.1.4 installed. You can verify this by running yarn info -AR @yarnpkg/plugin-compat. If this is the case, then to fix this, in your project run:

 yarn up @yarnpkg/plugin-compat -R

@gabormagyar
Copy link
Contributor Author

Similar issues keep happening from time to time with monodeploy updates. I think it should be much clearer in the docs or even in the command output what versions of yarn a certain version of monodeploy is compatible with.

@noahnu
Copy link
Contributor

noahnu commented Dec 13, 2022

I have a few ideas to fix this, just need to find some time (and my open source focus right now is on wrapping up the next major version of my syrupy python project -- will come back to solve this once that's done). I'm thinking of offering a yarn plugin version of monodeploy so we have consistent versions of the yarn packages.

The version inconsistency is ultimately an issue with how yarn releases updates, so there's an opportunity to fix this upstream as well.

@noahnu
Copy link
Contributor

noahnu commented Mar 31, 2024

Monodeploy has been forked under a new name Monoweave. I've copied your issue over and will address it in the monoweave project.

monoweave/monoweave#81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for feedback
Projects
None yet
Development

No branches or pull requests

2 participants