Skip to content

Instantly share code, notes, and snippets.

@azenla
Created October 10, 2017 16:30
Show Gist options
  • Save azenla/f8cd9addecad4eee43820a390d13fb94 to your computer and use it in GitHub Desktop.
Save azenla/f8cd9addecad4eee43820a390d13fb94 to your computer and use it in GitHub Desktop.
with raw_commit_texts as (
select "hash", encode("content", 'escape') as info from "git.objects" where type = 1
),
commits as (
select
"hash",
(regexp_match("info", 'tree ([^\s]+)'))[1] as tree,
(regexp_match("info", 'parent ([^\s]+)'))[1] as parent,
(regexp_match("info", 'author ([^\n]+)'))[1] as author,
(regexp_match("info", 'committer ([^\n]+)'))[1] as committer,
(regexp_match("info", '\n\n(.*)'))[1] as message
from raw_commit_texts
)
select * from commits limit 50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment