在git_repository_open()的上下文中,“ git仓库文件夹”和“现有工作目录”之间有什么区别?

德米特里(Dmitri Shuralyov)

git_repository_open文档说:

'path'参数必须指向git存储库文件夹或现有的工作目录。

“现有工作目录”到底是什么意思?可以使用任何子文件夹吗?详细的解释或示例将非常有帮助。

德米特里(Dmitri Shuralyov)

在freenode上的#libgit2中由cmn_回答:

<cmn_> shurcooL: you're right, I was thinking of git_repository_discover() <cmn_> which *will* take any of those paths and give you the right one <cmn_> shurcooL: what you usually call a "git repository" is two things, the gitdir and the worktree; the worktree is where you files live (and the top-level has the .git), and the gitdir is where git stores its data <cmn_> what it's telling you is that if you have someproject/ and someproject/.git you can pass either of those paths and libgit2 will load the repository; the former being the worktree/workdir and the latter the repository

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章