-
Notifications
You must be signed in to change notification settings - Fork 103
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
fix: respect pushDefault config option #329
base: master
Are you sure you want to change the base?
Conversation
I'm a bit confused, so had a look at the
What does
It feels like a can of worm has opened up since the introduction of the two remotes (upstream/pushRemote). 😅 update:Nevermind. I found this in Magit. Let's stick with how you've prioritized them ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests are failing (cargo test
).
It's also possible to add a test like (in src/tests/push.rs
):
#[test]
fn push_doesnt_prompt_for_remote_when_default_set() {
let ctx = TestContext::setup_clone();
run(ctx.dir.path(), &["git", "checkout", "-b", "new-branch"]);
commit(ctx.dir.path(), "new-file", "");
run(
ctx.dir.path(),
&["git", "config", "remote.pushDefault", "origin"],
);
snapshot!(ctx, "Pp<enter>");
}
if config.get_string(&push_default_cfg).is_ok() { | ||
Ok(push_default_cfg) | ||
} else { | ||
Err("Neither pushRemote nor push.default is configured".into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err("Neither pushRemote nor push.default is configured".into()) | |
Err("Neither branch.<name>.pushRemote nor remote.pushDefault is configured".into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
push.default is something else (Defaults to "simple" etc.)
This fixes #322 , so that if no remote to push to is set, the default option set by
Is used instead.