Class: Tracker::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/pivotal-git-tracker/git.rb

Instance Method Summary collapse

Instance Method Details

#contains?(message, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
# File 'lib/pivotal-git-tracker/git.rb', line 3

def contains?(message, options = {})
  branch = options.fetch(:branch, 'HEAD')
  remote_branch = options[:remote_branch]
  result = `git log #{[remote_branch, branch].compact.join('..')} --grep='#{message}'`
  result.length > 0
end

#latest_log(options = {}) ⇒ Object



10
11
12
13
14
15
# File 'lib/pivotal-git-tracker/git.rb', line 10

def latest_log(options = {})
  branch = options.fetch(:branch, 'HEAD')
  remote_branch = options[:remote_branch]
  commits = `git log -n 50 #{[remote_branch, branch].compact.join('..')} --grep='#' --oneline`
  commits.scan(/#([0-9]{9})/).flatten
end