1
最後にユーザーがマシンからプッシュしたときからコミットをすべて表示したいとします。libgit2sharpは最後のプッシュ以降すべてのコミットを取得します
using (var repo = new Repository(repositoryDirectory))
{
var c = repo.Lookup<Commit>(shaHashOfCommit);
// Let's only consider the refs that lead to this commit...
var refs = repo.Refs.ReachableFrom(new []{c});
//...and create a filter that will retrieve all the commits...
var cf = new CommitFilter
{
Since = refs, // ...reachable from all those refs...
Until = c // ...until this commit is met
};
var cs = repo.Commits.QueryBy(cf);
foreach (var co in cs)
{
Console.WriteLine("{0}: {1}", co.Id.ToString(7), co.MessageShort);
}
}
私は別のポストからこのコードを得たが、私は最後のプッシュの日付以降にコミットを得るためにそれを修正する方法がわからないです。