libgit2如何获取当前目录的状态? [英] libgit2 how to get the the status of the current directory?

查看:102
本文介绍了libgit2如何获取当前目录的状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我如何获得单个目录的状态,而不是整个存储库?




  • git_status_list_new 它获取存储库状态,但我只关心位于单个目录中的文件。 / p>


  • git_status_file 它可以获得单一的状态。 b



有没有一种方法可以使用libgit2来获取单个目录的状态?

解决方案

git_status_list_new 接受 git_status_options 结构,其中包含 pathspec 成员控制哪些文件将包含在列表中。您可以使用它来限制您返回的状态为单个目录中的状态。


How can I get the status of a single directory, rather than the whole repository?

I have looked at the following:

  • git_status_list_new which gets the repository status, but I care only about files located in a single directory.

  • git_status_file which gets the status of a single.

Is there a way that I can get the status of a single directory using libgit2?

解决方案

git_status_list_new accepts a git_status_options struct, which contains a pathspec member which controls which files will be included in the list. You can use that to limit your returned statuses to those in a single directory.

这篇关于libgit2如何获取当前目录的状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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