Pergunta

It looks like git_index_get_bypath and git_status_foreach_ext (with GIT_STATUS_SHOW_INDEX_ONLY) are just different ways of reading the index. What are the differences, and why would I use one vs. the other?

Foi útil?

Solução

git_index_get_bypath lets you look up a particular entry a given index.

git_status_foreach_ext does a status check, which is a comparison between the worktree, the index and HEAD and iterates over the results of that comparison calling the passed function. With that flag, it would skip the worktree in that comparison.

Which one to use depends on what you're looking for: a particular entry in the index or a list of differences between the index and HEAD.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top