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

Can't release from branch that is tracking non-origin remote #608

Closed
rchl opened this issue Feb 27, 2020 · 12 comments
Closed

Can't release from branch that is tracking non-origin remote #608

rchl opened this issue Feb 27, 2020 · 12 comments

Comments

@rchl
Copy link
Contributor

rchl commented Feb 27, 2020

I have a master branch configured like so:

[branch "master"]
	remote = upstream
	merge = refs/heads/master
	rebase = true

When I try to release from that branch, it fails with:

ERROR fatal: You are pushing to remote 'origin', which is not the upstream of
your current branch 'master', without telling me what to push
to update which remote branch.

So the code is explicitly trying to push (see here) to origin remote which is not the remote the branch is tracking. I know I can configure remote with git.pushRepo but doing that would be wrong as that would affect every developer on the project and there is no guarantee they have set up their git repo the same way.

Since release-it already (by default) enforces that branch is tracking upstream branch, I don't see why it's explicitly passing upstream in this case. I think it would be enough to just invoke git push alone.

@webpro
Copy link
Collaborator

webpro commented Feb 27, 2020

You can do --git.pushRepo=upstream (and not store this as config).

I forgot why the explicit origin is there, maybe it can be removed indeed, as it's the default anyway.

@rchl
Copy link
Contributor Author

rchl commented Feb 27, 2020

I've created PR #609 with a suggested change.
Not 100% sure that the logic is correct...

@webpro
Copy link
Collaborator

webpro commented Mar 2, 2020

This is now in release-it@13.0.0-beta.0, please let me know how this works for you (note that there are some breaking changes).

@webpro webpro closed this as completed Mar 2, 2020
@rchl
Copy link
Contributor Author

rchl commented Mar 3, 2020

Thank you, I'll check as soon as I have some meaningful changes to release in my project.

@rchl
Copy link
Contributor Author

rchl commented Mar 4, 2020

With release-it@13.0.0-beta.1 getting:

yarn run v1.22.0                                                                                                                                                                   
$ release-it                                                                                                                                                                       
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '../config/release-it.json'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Users/me/workspace/nuxt/nuxt-i18n/node_modules/release-it/lib/config.js:8:23)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Need to add templates and config to package.json files array. And remove conf.

@webpro
Copy link
Collaborator

webpro commented Mar 4, 2020

Thanks, it's in release-it@beta (13.0.0-beta.2) now.

@rchl
Copy link
Contributor Author

rchl commented Mar 4, 2020

I have another issue. Getting this output:

🚀 Let's release nuxt-i18n (currently at 6.6.0)

...

? Commit (chore: release %s)? (Y/n) 

Not how the release version is missing on last line. It works with latest 12:

🚀 Let's release nuxt-i18n (currently at 6.6.0)

...

? Commit (chore: release 6.6.1)? (Y/n) 

@webpro
Copy link
Collaborator

webpro commented Mar 4, 2020

Yes, the %s is old syntax, removed in v13. You should replace it with ${version}

@rchl
Copy link
Contributor Author

rchl commented Mar 4, 2020

Sorry, my bad.

@rchl
Copy link
Contributor Author

rchl commented Mar 4, 2020

I also need to think about some related fix for getRemoteUrl in GitBase.js. It also should default to tracking branch rather than origin...

@webpro
Copy link
Collaborator

webpro commented Mar 4, 2020

Ah indeed, forgot about that. Doesn't seem trivial. Maybe we can parse output like this:

❯ git status -sb
## master...origin/master

@rchl
Copy link
Contributor Author

rchl commented Mar 4, 2020

Created #614

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 a pull request may close this issue.

2 participants