-
-
Notifications
You must be signed in to change notification settings - Fork 574
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
Get default push remote from configuration #2156
Get default push remote from configuration #2156
Conversation
In addition to https://git-scm.com/docs/git-config#Documentation/git-config.txt-branchltnamegtremote |
looks good! yeah we should really try to get a unittest on this. i think local remotes to push to should work with libgit. so we can probably just simulate this that way. |
4ff0db9
to
907caf1
Compare
I’ve updated the PR. |
@cruessler what's the status here? can this be merged? is it ready in your opinion? if not what TODOs do you still see? |
I found a way to start testing this PR. I’ll add a testing-related TODO list to the initial post soon-ish. The function I added is pretty solid I think, what’s left to do is wire it up in the right places and make sure all combinations of config values work as expected. I didn‘t leave a more high-level comment related to the overall progress, thinking that my last comment was sufficient. Now I see that was not the case. :-) |
e97cde3
to
34e7b6f
Compare
@extrawurst I updated the PR. I think it’s now ready for testing! I tested different configurations for pushing and did not encounter any issues. I don’t have a good feeling for what I might have accidentally broken, so my testing was focused on pushing. |
Also, there is now a bit of duplication, but I thought we could address it in the future, once we now this is the way to go. |
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.
I would add back the test_default_remote_inconclusive()
test. Since the one that you added checks for push defaults and not for the inconclusive case for fetch repos. Apart from that, it look good. 👍
Thanks for the review, I restored the original test. |
I updated this PR’s description to reflect the fact that this only tackles getting push configuration yet. Given what I’ve learned about the subject, adding something similar for pull configuration should be rather straight-forward. I think it makes sense to create a follow-up PR, but I’ll be equally happy to add more functionality in this PR. |
No let’s wrap this one up and make a follow up for pull. Can you create that @cruessler ? |
@cruessler please add a changelog entry and then we are good to go |
Will do, I’m aiming for sometime this weekend. |
Done. (I didn’t find a specific issue this PR fixes, there’s one for pulling which I’ll link to in the follow-up PR.) |
This PR is in response to #1093. It changes how GitUI gets the remote to push to. It does not change how it gets the remote to pull from, so it doesn’t directly address #1093, but it is a first step towards making the code paths for getting push and pull configuration independent.
It changes the following:
get_default_remote_for_push_in_repo
which reads git configuration related to remote repositories. It first readsbranch.<name>.pushRemote
, thenremote.pushDefault
, thenbranch.<name>.remote
. This is according to the docs.I followed the checklist:
make check
without errorsTest push behavior in status tab:
branch.<>.pushRemote
is setremote.pushDefault
is setbranch.<>.remote
is set