FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

make checkoutBranch works with branches that lives outside of refs/heads by AsoSunag · Pull Request #891 · nodegit/nodegit · GitHub

Repository navigation

make checkoutBranch works with branches that lives outside of refs/heads - #891

Merged
johnhaley81 merged 3 commits into
nodegit:masterfrom
AsoSunag:master
Feb 29, 2016
Merged

johnhaley81 merged 3 commits into
nodegit:masterfrom
AsoSunag:master

Conversation

AsoSunag commented Feb 3, 2016

Copy link
Copy Markdown
Contributor

And avoid trying to call a method on a boolean when isBranch() is false.

Copy link
Copy Markdown
Collaborator

So I could be wrong but I'm pretty sure that anything that exists outside of refs/heads is, according to git, not a branch. So this function is doing what it is supposed to be doing. I definitely see the use case for this though.

Let's abstract this out to checkoutRef and then make another method that's called checkoutBranch that has the old functionality. Maybe have checkoutBranch confirm that the ref is indeed a branch before calling checkoutRef and then rejecting if it isn't.

AsoSunag commented Feb 4, 2016

Copy link
Copy Markdown
Contributor Author

Hello,

Yes you're right, I did that for remotes. It is good idea to have a checkoutRef and a checkoutBranch. The only thing that is bothering me with that is that when using checkoutRef with a non branch reference we will still use getBranchCommit. So we could keep one method checkoutBranch checking if it is a branch or a remote or we can have two methods.

What do you think is the best?

Copy link
Copy Markdown
Collaborator

Repository#getBranchCommit just calls Repository#getReferenceCommit so we can replace that call with Repository#getReferenceCommit

AsoSunag commented Feb 5, 2016

Copy link
Copy Markdown
Contributor Author

ah ok I'll do that then.

Copy link
Copy Markdown
Collaborator

LGTM Thanks @AsoSunag

johnhaley81 added a commit that referenced this pull request Feb 29, 2016
make checkoutBranch works with branches that lives outside of refs/heads
johnhaley81 merged commit 4a8cf95 into nodegit:master Feb 29, 2016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

2 participants


Back | FazBrowse Home | New Git URL