Skip to content

Instantly share code, notes, and snippets.

@robertpi
Created October 15, 2015 09:07
Show Gist options
  • Save robertpi/ca439deebf3149eb6b0d to your computer and use it in GitHub Desktop.
Save robertpi/ca439deebf3149eb6b0d to your computer and use it in GitHub Desktop.
let walkCommits (hash: Hash, count) =
printfn "%s %s %s" objectsDir hash.DirectoryName hash.FileName
let objectPath = Path.Combine(objectsDir, hash.DirectoryName, hash.FileName)
printfn "objectPath: %s" objectPath
let gitObject = GitObject.ParseFile objectPath
match gitObject with
| Commit (_, commit) ->
match commit.Parent with
| Some (hash) when count < 10 ->
Some(commit, (hash, (count + 1)))
| Some (_)
| None -> None
| _ -> failwithf "Unexpected object type: %A" gitObject
Seq.unfold walkCommits (headHash, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment