Last active
January 4, 2016 07:28
-
-
Save ryanbillingsley/8588542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def building_commit | |
i = 0 | |
body = "tree #{@tree} | |
parent #{@parent} | |
author CTF user <me@example.com> #{@timestamp} +0000 | |
committer CTF user <me@example.com> #{@timestamp} +0000 | |
Give me a Gitcoin #{i}" | |
header = "commit #{body.length}\0" | |
store = header + body | |
sha1 = Digest::SHA1.hexdigest(store) | |
sha1 | |
end | |
def git_commit | |
i = 0 | |
body = "tree #{@tree} | |
parent #{@parent} | |
author CTF user <me@example.com> #{@timestamp} +0000 | |
committer CTF user <me@example.com> #{@timestamp} +0000 | |
Give me a Gitcoin #{i}" | |
sha1 = `git hash-object -t commit --stdin <<< "#{body}"` | |
sha1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment