I am using LibGit2Sharp. How can I invoke the git diff
command with the following parameters?
git diff --name-status origin/master...HEAD
I know, that git diff A...B
is equivalent to git diff $(git-merge-base A B) B
.
I found a solution to do this. You can do it in this way:
1) Get two commits common ancestor.
2) Get diff between trees.
var baseCommit = repo.ObjectDatabase.FindMergeBase(repo.Branches["origin/master"].Tip, repo.Head.Tip);
var diff = repo.Diff.Compare<TreeChanges>(baseCommit.Tree, repo.Head.Tip.Tree);