libgit2/libgit2 — pull request #1121 by Quintus (2012-12-06 15:29:48+00:00)
Title: git_checkout_tree() always adds files to working tree even if not requested

Hi there,

the docs for `git_checkout_tree()` state this:

~~~~~~~~~~~~~~
* By default, checkout is not allowed to modify any files. Anything
* needing a change would be considered a conflict.
[...]
* GIT_CHECKOUT_UPDATE_MISSING means checkout can create a missing file
* that exists in the index and does not exist in the working directory.
~~~~~~~~~~~~~~

Source: https://github.com/libgit2/libgit2/blob/development/include/git2/checkout.h#L37

Calling `git_checkout_tree()`with only the minimal argument of `GIT_CHECKOUT_DEFAULT` and not specifying `GIT_CHECKOUT_UPDATE_MISSING` at all however always adds files not present in the working directory, but in the checked-out tree to the working tree without any way to prevent this.

This pull request defines a single failing testcase that demonstrates the behaviour. If this is really a bug and not some kind of misunderstanding, I can try my hands on it to fix it (but no guarantee I can work it out).

Valete,
Marvin