Class GHRef


  • public class GHRef
    extends Object
    Provides information on a Git ref from GitHub.
    Author:
    Michael Clarke
    • Constructor Detail

      • GHRef

        public GHRef()
    • Method Detail

      • getRef

        public String getRef()
        Name of the ref, such as "refs/tags/abc".
        Returns:
        the ref
      • getUrl

        public URL getUrl()
        The API URL of this tag, such as https://api.github.com/repos/jenkinsci/jenkins/git/refs/tags/1.312
        Returns:
        the url
      • getObject

        public GHRef.GHObject getObject()
        The object that this ref points to.
        Returns:
        the object
      • updateTo

        public void updateTo​(String sha)
                      throws IOException
        Updates this ref to the specified commit.
        Parameters:
        sha - The SHA1 value to set this reference to
        Throws:
        IOException - the io exception
      • updateTo

        public void updateTo​(String sha,
                             Boolean force)
                      throws IOException
        Updates this ref to the specified commit.
        Parameters:
        sha - The SHA1 value to set this reference to
        force - Whether or not to force this ref update.
        Throws:
        IOException - the io exception
      • delete

        public void delete()
                    throws IOException
        Deletes this ref from the repository using the GitHub API.
        Throws:
        IOException - the io exception
      • getRoot

        @Deprecated
        public GitHub getRoot()
        Deprecated.
        For access to the GitHub instance, use a local copy instead of pulling it out of objects.
        Get the root GitHub instance for this object.
        Returns:
        the root GitHub instance