Advertisement
Guest User

Untitled

a guest
May 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.42 KB | None | 0 0
  1. class Repo
  2.    def head
  3.       Head.current(self)
  4.    end
  5. end
  6.  
  7. class Head < Ref
  8.  # Get the HEAD revision of the repo.
  9.  #   +repo+ is the Repo
  10.  #   +options+ is a Hash of options
  11.  #
  12.  # Returns Grit::Head (baked)
  13.  def self.current(repo, options = {})
  14.    head = repo.git.fs_read('HEAD').chomp
  15.    if /ref: refs\/heads\/(.*)/.match(head)
  16.      self.new($1, repo.git.rev_parse(options, 'HEAD'))
  17.    end
  18.  end
  19. end # Head
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement