Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Branch upstream configuration #1450

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

Merged
merged 3 commits into from
Apr 11, 2013
Merged

Conversation

carlosmn
Copy link
Member

First rename git_branch_tracking to git_branch_upstream to use clearer nomenclature and then add set_upstream and unset_upstream to let the user manage the upstream configuration without needing to care how the configuration is written.

For set_upstream I kept going back and forth between passing a {remote, refname} pair and the upstream branch directly. Given the unfortunate complexity of getting the pair, I went with "whatever git_branch_lookup will do something with" which should give the least surprising result for a given string.

I'm still not quite sure whether the split-up version of git_branch_remote_name should return the remote name or the remote directly, as we then have to load it again in set_upstream.

The term 'tracking' is overloaded. Help distinguish what we mean by
using 'upstream' for this part of the library.
@nulltoken
Copy link
Member

👍

if ((ret = remote_name(&buf, repo, refname)) < 0)
return ret;

if (buffer) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, one shouldn't wrap single statements in braces

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is a left-over

Return the size we'd need to write to instead of simply an
error. Split the function into two to be used later by the upstream
configuration functions.
*
* @return 0 or an error code
*/
GIT_EXTERN(int) git_branch_unset_upstream(git_reference *branch);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather see this implemented as git_branch_set_upstream(branch, NULL). Can you make it happen? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Add functions to set and unset the upstream configuration to
complement the getter we already have.
@vmg
Copy link
Member

vmg commented Apr 11, 2013

Magnificient.

vmg pushed a commit that referenced this pull request Apr 11, 2013
@vmg vmg merged commit ea8bac3 into libgit2:development Apr 11, 2013
phatblat pushed a commit to phatblat/libgit2 that referenced this pull request Sep 13, 2014
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.

3 participants