Skip to content

Conversation

@swsnr
Copy link
Contributor

@swsnr swsnr commented Nov 3, 2019

Wrap git_branch_upstream_name and git_branch_upstream_remote which retrieve the configured upstream remote and branch, but do not attempt to resolve them, so unlike Branch::upstream these functions don't fail if the branch has a configured upstream which doesn't exist. This way we can detect "gone" branches, i.e. branches whose upstream got deleted on the remote and was subsequently pruned by git fetch.

I don't know whether I put the functions in the correct place, and I'm not sure how to test these; I'm happy to amend this pull request if you would review it and give me directions.

Closes GH-469

@swsnr swsnr changed the title Add support for remotes of branch_upstream_name Add support for remotes of branches Nov 3, 2019
@alexcrichton
Copy link
Member

Thanks! I wonder if it'd be better though here to return the Buf directly instead of forcing a utf-8 check and extra allocation?

@swsnr
Copy link
Contributor Author

swsnr commented Nov 5, 2019

I don’t know. For my purpose either is fine, but I don’t think I know Rust and Git so well as to make a general choice. I’d like to leave this to you, but I’m happy to update my pull request accordingly 🙂

@alexcrichton
Copy link
Member

Ah ok, in that case yeah let's switch to returning Buf directly!

@swsnr
Copy link
Contributor Author

swsnr commented Nov 5, 2019

@alexcrichton Thanks for the feedback; I'll do that soon :)

Wrap git_branch_upstream_name and git_branch_upstream_remote which
retrieve the configured upstream remote and branch, but do not attempt
to resolve them, i.e. these functions don't fail if the configured
upstream doesn't exist.

Closes GH-469
@swsnr
Copy link
Contributor Author

swsnr commented Nov 5, 2019

@alexcrichton Done :)

@alexcrichton alexcrichton merged commit 6b8063e into rust-lang:master Nov 5, 2019
@alexcrichton
Copy link
Member

👍

@swsnr
Copy link
Contributor Author

swsnr commented Nov 5, 2019

Many thanks for merging so quickly 🙏. And thanks for this great library!

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.

Support getting remotes of branches

2 participants