Fix synchronize with deleted resources
commitf46237a20462b5451035c2a83e6177e2e7682cfd
authorThomas Wolf <thomas.wolf@paranor.ch>
Thu, 11 May 2017 20:17:54 +0000 (11 22:17 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Sat, 13 May 2017 17:41:09 +0000 (13 19:41 +0200)
tree028e3848f5e895930d20ae33b5a616e05f83300d
parentfe77e2e9e8b22ac451410d3816ee339b995a155a
Fix synchronize with deleted resources

ResourceVariantTreeSubscriber.members() must return *all* resources
known to the subscriber, whether they exist in the "workspace" or not.

Otherwise resources that were deleted will be missed.

Git is a bit special in that we don't want to report .gitignored
resources, and untracked resources only if the user so wishes. Thus
our logic is a bit different and governed basically by what our 3-way
diff cache contains, but in any case we must include files
that only exist in the remote (i.e., in those caches).

Furthermore, isSupervised() must also work for IContainers, not just
for files. That was limited in commit 3fa9329 [1] to files to prevent
folders showing up with wrong markers. However, this kind of fix is
just plain wrong -- the new test could never work with that. But if
we re-consider folders as supervised, they'll show up as modified even
when they have no changes below. Our cache should contain IN_SYNC
entries for such folders. ThreeWayDifFEntry.scan() produces MODIFIED
entries, though.

Since I'm unsure about the interactions between scans with path
filters to partially update the EGit synchronization caches, I have
not touched that scan--it would be non-trivial to make it produce
IN_SYNC entries anyway, and then the cache update logic would probably
also have to be non-trivially adapted.

Instead I've chosen to perform a top-down check in GitSyncInfo and
return IN_SYNC for any folder that does not contain at least one file
that is itself not IN_SYNC.

[1] Ib25bf43721ef4cc87dba33aa01909e50a4cbef48; bug 324604

Bug: 516426
Change-Id: Ia12309f52e5140ff058b4fee17b9c7d48d435290
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.egit.core.test/src/org/eclipse/egit/core/synchronize/GitSubscriberResourceMappingContextTest.java
org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitResourceVariantTreeSubscriber.java
org.eclipse.egit.core/src/org/eclipse/egit/core/synchronize/GitSyncInfo.java