Class: Bob::SCM::Git

Inherits:
Abstract show all
Defined in:
lib/bob/scm/git.rb

Instance Attribute Summary

Attributes inherited from Abstract

#branch, #uri

Instance Method Summary collapse

Methods inherited from Abstract

#dir_for, #initialize, #with_commit

Constructor Details

This class inherits a constructor from Bob::SCM::Abstract

Instance Method Details

#headObject



14
15
16
# File 'lib/bob/scm/git.rb', line 14

def head
  `git ls-remote --heads #{uri} #{branch} | cut -f1`.chomp
end

#info(commit) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/bob/scm/git.rb', line 4

def info(commit)
  format = "---%nidentifier: %H%nauthor: %an " +
    "<%ae>%nmessage: >-%n  %s%ncommitted_at: %ci%n"

  dump = YAML.load(`cd #{dir_for(commit)} && git show -s \
    --pretty=format:"#{format}" #{commit}`)

  dump.update("committed_at" => Time.parse(dump["committed_at"]))
end