Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
看起来git_index_get_bypath和git_status_foreach_ext(with GIT_STATUS_SHOW_INDEX_ONLY) 只是读取索引的不同方式。有什么区别,为什么我要使用一个与另一个?
git_index_get_bypath
git_status_foreach_ext
GIT_STATUS_SHOW_INDEX_ONLY
git_index_get_bypath让您查找给定索引的特定条目。
git_status_foreach_ext进行状态检查,这是工作树、索引之间的比较,HEAD并迭代调用传递函数的比较结果。使用该标志,它将跳过该比较中的工作树。
HEAD
使用哪一个取决于您要查找的内容:索引中的特定条目或索引和HEAD.