Bug 411808 - Team subscriber does not report synchinfo properly for modified resource
Summary: Team subscriber does not report synchinfo properly for modified resource
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-27 13:20 EDT by Jeff Johnston CLA
Modified: 2013-06-27 13:20 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Johnston CLA 2013-06-27 13:20:52 EDT
The Eclipse ChangeLog plug-in uses the Team Subscriber to collect out-of-sync information for the project ChangeLog file so it can populate the clipboard with all changes saved to that file.  This allows a user to copy the ChangeLog entry to a commit message or an e-mail.  The code uses the Team APIs and should work under egit as well as any other Team provider such as CVS.

This is not working in 3.0.0.  The calling sequence is as follows where the IResource is the ChangeLog IFile:

RepositoryProvider r = RepositoryProvider.getProvider(project);
if (r == null) {
   return;
}
SyncInfoSet set = new SyncInfoSet();
Subscriber s = r.getSubscriber();
s.collectOutOfSync(resources, IResource.DEPTH_ZERO, set, monitor);
SyncInfo[] infos = set.getSyncInfos();

The collectOutOfSync() call is ending up in:

GitResourceVariantTree.fetchvariant(IResource resource)

for the ChangeLog IFile.  The cachedata does not have a reference to the ChangeLog file and so fetchvariant returns null.

Later, the collectOutOfSync() call attempts to calculate the kind of change in GitSyncInfo.calculateKind() but since the remote resource is null, it returns IN_SYNC which is not true in this case.  Egit itself has marked the file as changed in the Project Explorer and from the command line, it also recognizes a diff has occurred.

bash $ git diff
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/ChangeLog b/changel
index 2269b8b..7da98b3 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/ChangeLog
+++ b/changelog/org.eclipse.linuxtools.changelog.core/ChangeLog
@@ -1,3 +1,7 @@
+2013-06-26  Jeff Johnston  <jjohnstn@redhat.com>
+
+       * plugin.properties: 
+
 2012-06-08  Jeff Johnston  <jjohnstn@redhat.com>
 
        * pom.xml: Bump version to 2.8.0.
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/plugin.properties b
index 9e15727..165ef42 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/plugin.properties
+++ b/changelog/org.eclipse.linuxtools.changelog.core/plugin.properties
@@ -17,6 +17,7 @@ prepSVNChangeLog=Prepare ChangeLog
 insertCLEntry=Insert ChangeLog entry
 insertCLEntryDesc=Insert a ChangeLog entry
 prefTitle=ChangeLog
+testing=yes
 
 Bundle-Name = ChangeLog Core Functionality
 category.description = Changelog key bindings

The code is only searching for the one file and should find the diff.

I had this work once in debugging and assumed originally it might be a timing issue whereby some job was running in a separate thread.  I did not locate said timing issue in the path I traced, but perhaps at least it indicates that the cachedata collection has some issue since I saw a few other files in the tree there that were not actually modified nor files that show up in a git status.  No idea why they were cached.