]> git.proxmox.com Git - libgit2.git/commit - tests/libgit2/diff/diff_helpers.h
Fix some diff ignores and submodule dirty workdir
authorRussell Belfer <rb@github.com>
Tue, 26 Mar 2013 06:58:40 +0000 (23:58 -0700)
committerRussell Belfer <rb@github.com>
Tue, 26 Mar 2013 06:58:40 +0000 (23:58 -0700)
commitccfa68055cbd7cdc0baa99af8ce5c0bbcca19254
tree2eece976fc48a2d98bc1394ba309b3298210e2ec
parent37ee70fab4e6dcf35afc08c0edbe9f101d4abf2d
Fix some diff ignores and submodule dirty workdir

This started out trying to look at the problems from issue #1425
and gradually grew to a broader set of fixes.  There are two core
things fixed here:

1. When you had an ignore like "/bin" which is rooted at the top
   of your tree, instead of immediately adding the "bin/" entry
   as an ignored item in the diff, we were returning all of the
   direct descendants of the directory as ignored items.  This
   changes things to immediately ignore the directory.  Note that
   this effects the behavior in test_status_ignore__subdirectories
   so that we no longer exactly match core gits ignore behavior,
   but the new behavior probably makes more sense (i.e. we now
   will include an ignored directory inside an untracked directory
   that we previously would have left off).
2. When a submodule only contained working directory changes, the
   diff code was always considering it unmodified which was just
   an outright bug. The HEAD SHA of the submodule matches the SHA
   in the parent repo index, and since the SHAs matches, the diff
   code was overwriting the actual status with UNMODIFIED.

These fixes broke existing tests test_diff_workdir__submodules and
test_status_ignore__subdirectories but looking it over, I actually
think the new results are correct and the old results were wrong.
@nulltoken had actually commented on the subdirectory ignore issue
previously.

I also included in the tests some debugging versions of the
shared iteration callback routines that print status or diff
information.  These aren't used actively in the tests, but can be
quickly swapped in to test code to give a better picture of what
is being scanned in some of the complex test scenarios.
src/diff.c
tests-clar/diff/diff_helpers.c
tests-clar/diff/diff_helpers.h
tests-clar/diff/workdir.c
tests-clar/status/ignore.c
tests-clar/status/status_helpers.c
tests-clar/status/status_helpers.h
tests-clar/status/submodules.c