Skip to content

Instantly share code, notes, and snippets.

@kolo
Created October 9, 2014 13:07
Show Gist options
  • Save kolo/614786f752358430c66d to your computer and use it in GitHub Desktop.
Save kolo/614786f752358430c66d to your computer and use it in GitHub Desktop.
module Builds::Git
def self.check_sha(sha, treeish)
Dir.chdir(Settings.git.path) do
out = `git log #{treeish} | grep #{sha}`
if out.strip.empty?
out = `git rev-list --cherry-mark master...#{treeish} | grep '#{sha}'`
if out.strip == "=#{sha}"
return true
elsif out.strip.empty?
out = `git rev-list --cherry-mark TM...#{treeish} | grep '#{sha}'`
if out.strip == "=#{sha}"
return true
end
end
else
return true
end
false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment