拉动后LibGit2Sharp获取存储库更改 [英] LibGit2Sharp get repository changes after pull

查看:144
本文介绍了拉动后LibGit2Sharp获取存储库更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. 哪些文件已被移动
  2. $

    如何在使用libgit2sharp进行git-pull后获得以下信息: b $ b

  3. 创建了哪些文件

  4. 哪些文件已被删除

git-pull请求它自己完美地工作:

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

我已经看过 Pull - 方法,但这似乎并不包含所需的信息。



非常感谢!

解决方案 MergeResult 类型公开了一个 Commit 属性,当合并时它不为null成功。

为了找出哪些文件已经改变,只需要使用 repo.Diff.Compare()方法将此 Commit 与其第一个父项进行比较。


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!

解决方案

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.

这篇关于拉动后LibGit2Sharp获取存储库更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆