Bug 437209 - Don't throw exception if file changes between commit and merge
Summary: Don't throw exception if file changes between commit and merge
Status: NEW
Alias: None
Product: PTP
Classification: Tools
Component: RDT.sync (show other bugs)
Version: 8.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-11 12:34 EDT by Roland Schulz CLA
Modified: 2015-08-20 11:59 EDT (History)
2 users (show)

See Also:


Attachments
Merge error message (12.21 KB, image/png)
2014-06-12 11:42 EDT, John Eblen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Schulz CLA 2014-06-11 12:34:42 EDT
It is possible that sync throws an exception about dirty workspace:
- make remote changes
- make conflicting local changes (sync if auto-sync isn't on)
- make another local change after local commit has finished but before merge

I haven't yet tried to produce the error. Might be tricky to get the timing right. But based on reading the code this should be possible.
Comment 1 John Eblen CLA 2014-06-12 11:42:02 EDT
I was able to produce the error as follows:

1) Turn auto-sync off. This makes it easier to time correctly.
2) Make conflicting local and remote changes to a certain file.
3) For timing, the remote should have significant lag (not localhost, for example).
4) Edit the same file (cannot be a different file) but do not save the changes.
5) Show the progress view
6) Sync
7) When sync starts doing remote operations (remote commit or fetch), save the file.

This produces the attached error dialog and the below stack trace. (At least the error message is clear.)

The user can recover by undoing the second changes and sync'ing again.


org.eclipse.ptp.rdt.sync.core.exceptions.RemoteSyncException: Merge failed for the following files (modified during sync?):
Brancher.cpp
	at org.eclipse.ptp.internal.rdt.sync.git.core.GitSyncService.doSyncRL(GitSyncService.java:701)
	at org.eclipse.ptp.internal.rdt.sync.git.core.GitSyncService.doSync(GitSyncService.java:604)
	at org.eclipse.ptp.internal.rdt.sync.git.core.GitSyncService.synchronize(GitSyncService.java:506)
	at org.eclipse.ptp.rdt.sync.core.SyncManager$SynchronizeJob.run(SyncManager.java:80)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
!SUBENTRY 1 org.eclipse.ptp.rdt.sync.git.core 4 0 2014-06-12 11:16:32.276
!MESSAGE Merge failed for the following files (modified during sync?):
Brancher.cpp
Comment 2 John Eblen CLA 2014-06-12 11:42:49 EDT
Created attachment 244193 [details]
Merge error message
Comment 3 Joao Antunes CLA 2015-08-20 07:19:38 EDT
PTP is great, but this makes it unusable, +1 for making it ignore these kinds of sync errors, because a normal use case that makes PTP unusable is the following:

In your GIT rep you have configuration file samples, e.g. something.conf.sample in the configuration folder, and ignore the usual *conf that may contain sensitive information.

If you simply copy the samples to the .conf in the remote side to run the app, you will never be able to sync the whole project again!!

Is there any workaround for this meanwhile?
Comment 4 Joao Antunes CLA 2015-08-20 07:20:57 EDT
FYI: This also happens in PTP 9.0
Comment 5 Joao Antunes CLA 2015-08-20 07:34:28 EDT
An easy workaround seems to be filtering out those files.

Allowing to Import to the exclusion list the files already in .gitignore could help with this task.

OFF TOPIC:
Meanwhile, after i did this workaround, I get stuck on an enternally refreshing external folder, which makes things really slow.. any idea on this one?
Comment 6 John Eblen CLA 2015-08-20 11:59:10 EDT
I'm not clear on how the problem you describe is related to this particular bug. Please file an enhancement request for any specific feature that you would like to see to better support projects that use Git. (Bug 472647 is a good example of such a request.)

In general, synchronizing files related to version control can cause problems, so it can be a good idea to filter those.

Sorry, no ideas about the constantly refreshing folder. Feel free to file a bug, though.