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

publish: Ensure pulls happen to the correct branch #920

Conversation

kaushalmodi
Copy link
Contributor

@kaushalmodi kaushalmodi commented May 23, 2021

If a user has set the default branch to anything other than "master",
'nimble publish' fails.

This commit fixes that by ensuring that the git pull followed by git
init happens to the default branch used by upstream https://github.com/nim-lang/packages.

For example, if the user has this in their ~/.gitconfig:

[init]
	defaultBranch = main

nimble publish fails with this error:

error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/kaushalmodi/packages'

I have confirmed that after this commit, that error gets resolved. The critical change in this commit fixing this issue if ensuring that we first check out the default branch in user's git repo if the default branch != repo's default branch ("master").

@kaushalmodi kaushalmodi force-pushed the ensure-pulls-happen-to-correct-branch branch 2 times, most recently from 904f42d to c498453 Compare May 23, 2021 17:01
@kaushalmodi
Copy link
Contributor Author

kaushalmodi commented May 23, 2021

Note that a better way to do this would be to do git init --initial-branch="master" but that would fail if the user is using git older than 2.28.0.

If a user has set the default branch to anything other than "master",
'nimble publish' fails.

This commit fixes that by ensuring that the git pull followed by git
init happens to the default branch used by upstream https://github.com/nim-lang/packages.
@kaushalmodi kaushalmodi force-pushed the ensure-pulls-happen-to-correct-branch branch from c498453 to fa0ff71 Compare May 23, 2021 18:16
@narimiran narimiran merged commit 752f88e into nim-lang:master May 24, 2021
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.

None yet

3 participants