libgit2/tests/diff
Russell Belfer f554611a27 Improve checks for ignore containment
The diff code was using an "ignored_prefix" directory to track if
a parent directory was ignored that contained untracked files
alongside tracked files. Unfortunately, when negative ignore rules
were used for directories inside ignored parents, the wrong rules
were applied to untracked files inside the negatively ignored
child directories.

This commit moves the logic for ignore containment into the workdir
iterator (which is a better place for it), so the ignored-ness of
a directory is contained in the frame stack during traversal.  This
allows a child directory to override with a negative ignore and yet
still restore the ignored state of the parent when we traverse out
of the child.

Along with this, there are some problems with "directory only"
ignore rules on container directories.  Given "a/*" and "!a/b/c/"
(where the second rule is a directory rule but the first rule is
just a generic prefix rule), then the directory only constraint
was having "a/b/c/d/file" match the first rule and not the second.
This was fixed by having ignore directory-only rules test a rule
against the prefix of a file with LEADINGDIR enabled.

Lastly, spot checks for ignores using `git_ignore_path_is_ignored`
were tested from the top directory down to the bottom to deal with
the containment problem, but this is wrong. We have to test bottom
to top so that negative subdirectory rules will be checked before
parent ignore rules.

This does change the behavior of some existing tests, but it seems
only to bring us more in line with core Git, so I think those
changes are acceptable.
2014-05-06 12:41:26 -07:00
..
binary.c patch: emit binary patches (optionally) 2014-04-22 19:08:21 -05:00
blob.c Get rid of redundant git_diff_options_init fn 2014-05-02 09:21:33 -07:00
diff_helpers.c Remove trace / add git_diff_perfdata struct + api 2014-05-02 09:21:33 -07:00
diff_helpers.h Remove trace / add git_diff_perfdata struct + api 2014-05-02 09:21:33 -07:00
diffiter.c Drop git_patch_to_str 2014-01-22 17:51:32 +01:00
drivers.c Update Javascript userdiff driver and tests 2014-01-27 11:45:06 -08:00
format_email.c Use git_diff_get_stats in example/diff + refactor 2014-04-22 12:33:27 -07:00
index.c Remove converting user error to GIT_EUSER 2013-12-11 10:57:49 -08:00
iterator.c Improve checks for ignore containment 2014-05-06 12:41:26 -07:00
notify.c More improvements to callback return value tests 2013-12-11 11:55:00 -08:00
patch.c patch: emit binary patches (optionally) 2014-04-22 19:08:21 -05:00
pathspec.c Rename tests-clar to tests 2013-11-14 14:05:52 -08:00
rename.c git_checkout_opts -> git_checkout_options 2014-03-06 09:44:51 -08:00
stats.c Use git_diff_get_stats in example/diff + refactor 2014-04-22 12:33:27 -07:00
submodules.c Remove most submodule reloads from tests 2014-04-01 13:24:06 -07:00
tree.c Get rid of redundant git_diff_options_init fn 2014-05-02 09:21:33 -07:00
workdir.c Remove trace / add git_diff_perfdata struct + api 2014-05-02 09:21:33 -07:00