Skip to content

Allow passing of Branch objects to Repository.checkout()#408

Merged
jdavid merged 2 commits intolibgit2:masterfrom
djmattyg007:branches_are_references
Aug 26, 2014
Merged

Allow passing of Branch objects to Repository.checkout()#408
jdavid merged 2 commits intolibgit2:masterfrom
djmattyg007:branches_are_references

Conversation

@djmattyg007
Copy link
Contributor

Currently the Repository.checkout() method checks to see if the refname
parameter is a Reference object with the following check:

if type(refname) is Reference:

This does not allow subclasses of Reference (such as Branch) to be used.

This pull request remedies this issue by changing the check to use
instanceof(), like so:

if instanceof(refname, Reference):

This pull request also adds a new test for this functionality.

Branch inherits from Reference, so there's no reason why we shouldn't be
able to pass a Branch object.
This differs from the only other test which uses a Reference object.
This test only succeeds because of the previous commit.
@jdavid jdavid merged commit 14bcce0 into libgit2:master Aug 26, 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.

2 participants