Skip to content

Instantly share code, notes, and snippets.

@craigrbruce
Last active August 29, 2015 14:15
Show Gist options
  • Save craigrbruce/944c237603b48a2c5e7b to your computer and use it in GitHub Desktop.
Save craigrbruce/944c237603b48a2c5e7b to your computer and use it in GitHub Desktop.
Using LibGit2Sharp without the pain
#r "/Users/craig/Projects/gitsharp/LibGit2Sharp.0.21.0.176/lib/net40/LibGit2Sharp.dll"
open LibGit2Sharp
//plonk the native dll here
System.Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
let printer (c: Commit) =
sprintf "User %s" c.Author.Email |> ignore
let filter = new CommitFilter();
filter.Since <- "Tag1";
filter.Until <- "Tag2";
let repo = new Repository("/Users/craig/Projects/crazy-repo")
repo.Commits.QueryBy(filter) |> Seq.iter printer
//or some other filter
repo.Commits |> Seq.filter (fun x -> x.Committer.Email = "[email protected]") |> Seq.iter printer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment