Pergunta

I need to commit all workdir, but I can't find any solution that can adds the subdirectories to the index. I've tried with git_index_add_bypath() but it's seems to not add the tree for the subdirectories. I'm using Qt and the libgit2 for c, because the language binding for Qt seems to not work.

Foi útil?

Solução

There are different ways depending on what you need. "commit all workdir" doesn't convey which one.

If you want to update the version of every file that is tracked, you can loop over the entries in the index and call git_index_add_bypath for each.

For anything else, things get murky, as you may or may not want to take ignore rules into account. The general solution would be to use the status API to see which files have been changed or added and add those to the index according to the result you're looking for (ignore rules, adding new files or not, removing files that aren't in the worktree anymore).

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