Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Repo
- def head
- Head.current(self)
- end
- end
- class Head < Ref
- # Get the HEAD revision of the repo.
- # +repo+ is the Repo
- # +options+ is a Hash of options
- #
- # Returns Grit::Head (baked)
- def self.current(repo, options = {})
- head = repo.git.fs_read('HEAD').chomp
- if /ref: refs\/heads\/(.*)/.match(head)
- self.new($1, repo.git.rev_parse(options, 'HEAD'))
- end
- end
- end # Head
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement