-
Notifications
You must be signed in to change notification settings - Fork 533
#531 add API to get default branch #532
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
Conversation
87cfbc3
to
f88a0c5
Compare
@CAMOBAP thank you for the PR. The default branch of the remote seems like it should be a property of a Remote object. If it were, I would like to get the remote's default branch by doing this: or: or (as a bonus) without having to have a local repository: What do you think of this design? |
@jcouball sounds reasonable to me |
Signed-off-by: Alexande B <abobrikovich@gmail.com>
f6a5cb2
to
f243744
Compare
@jcouball done |
Very useful feature indeed, was going to mention the |
@CAMOBAP $ irb -I lib
2.7.5 :001 > require 'git'
=> true
2.7.5 :002 > Git.remote_default_branch('https://github.com/ruby-git/ruby-git')
Traceback (most recent call last):
1: from /Users/couballj/SynologyDrive/Documents/Projects/ruby-git-clean/https:/github.com/ruby-git/ruby-git
ArgumentError (path does not exist)
2.7.5 :003 > I have this implemented with tests, so if you remove Git.remote_default_branch and it's test from this PR, I accept it and then follow with a separate PR for that. 2.7.5 :002 > Git.remote_default_branch('https://github.com/ruby-git/ruby-git')
=> "master"
2.7.5 :003 > Git.remote_default_branch('https://github.com/rspec/rspec-core')
=> "main" Also, it seems like |
Closing this PR in favor of #571 |
Your checklist for this pull request
🚨Please review the guidelines for contributing to this repository.
Description
#531 solution based on https://stackoverflow.com/a/44750379/902217
Open questions:
origin
is used for remote, maybe there is a better alternative