Using libgit2 I am trying to run git_checkout_tree on all files in my working tree while skipping some specific files. Filling the git_checkout_options checkout_opts like so
char* p[2]= {"*", "!myFile.dat"};
checkout_opts.paths.strings = p;
checkout_opts.paths.count = 2;
does still checkout myFile.dat (which is located in the repository root). I tried to stick to the .gitignore pattern syntax. I've compiled libgit2 and tried to get my head around the code base. I see that wildmatch.c defines a NEGATE_CLASS '!' and a NEGATE_CLASS '^'. Using ^myFile.dat doesn't work, unfortunately. Is pattern negation not supported in libgit2 or am I doing something wrong?
From issue 2263, a sparse-checkout is not yet supported with libgit2.
As a result, a git_checkout_tree
might not support the recent wildmatch (replacing fnmatch in PR 5110 a year ago, June 2019).
No negative path is tested in tests/checkout/tree.c
.