libgit2 how to get the the status of the current directory?

旧巷老猫 提交于 2019-12-02 16:45:03

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/47255681/libgit2-how-to-get-the-the-status-of-the-current-directory

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