Skip to content

how to get reference information from repository.head #203

Closed

Description

@alexband

Repository.head return a Commit object. could it also include the reference type, if head pointed to a ref name like refs/heads/master ?

Activity

  1. cholin commented on Apr 8, 2013

    @cholin

    Since Repository.revparse_single('HEAD') returns as well a commit object we could change Repository.head to return the reference instead. This is what the libgit2 function does as well. @jdavid or @esc what do you think?

  2. esc commented on Apr 8, 2013

    @esc
    Contributor

    Is there any other way to obtain the reference?

  3. jdavid commented on Apr 8, 2013

    @jdavid
    Member

    I like the proposition of @cholin, but since it changes the API it should go to the next branch, and only land in master after a release.

    @alexband @esc To get the resolved head reference you can type:

    head = repo.get_reference('HEAD').resolve()
    
  4. alexband commented on Apr 8, 2013

    @alexband
    Author

    @jdavid did you mean

    head = repo.lookup_reference('HEAD').resolve()

    I'll give try. Thank you all. And I think @cholin 's proposal sounds good

  5. alexband commented on Apr 17, 2013

    @alexband
    Author

    @jdavid bravo! mucho gracias

  6. added a commit that references this issue on Apr 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions