LibGit2Sharp get repository changes after pull

夙愿已清 提交于 2019-12-11 10:25:01

问题


How can i get the following information after a git-pull with libgit2sharp:

  1. Which files has been moved
  2. Which files has been created
  3. Which files has been deleted

The git-pull request it self works perfectly:

var result = repo.Network.Pull(new LibGit2Sharp.Signature("admin", "mail@......net", new DateTimeOffset(DateTime.Now)), options);

I already looked at the result of the Pull-Method, but this seems not to contain the needed information.

Thank you very much!


回答1:


The MergeResult type exposes a Commit property which is not null when the merge was successful.

In order to find out what files have changed, one just have to leverage the repo.Diff.Compare() method to compare this Commit with its first parent.



来源:https://stackoverflow.com/questions/30758362/libgit2sharp-get-repository-changes-after-pull

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!