Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.