A Head is a named reference to a Commit. Every Head instance contains a name and a Commit object.
r = Grit::Repo.new("/path/to/repo") h = r.heads.first h.name # => "master" h.commit # => #<Grit::Commit "1c09f116cbc2cb4100fb6935bb162daa4723f455"> h.commit.id # => "1c09f116cbc2cb4100fb6935bb162daa4723f455"
Get the HEAD revision of the repo.
+repo+ is the Repo +options+ is a Hash of options
Returns Grit::Head (baked)
# File lib/grit/ref.rb, line 63 def self.current(repo, options = {}) head = repo.git.fs_read('HEAD').chomp if /ref: refs\/heads\/(.*)/.match(head) id = repo.git.rev_parse(options, 'HEAD') commit = Commit.create(repo, :id => id) self.new($1, commit) end end
Generated with the Darkfish Rdoc Generator 2.