Bug 399982 - Unable to resolve delete modify conflict using egit
Summary: Unable to resolve delete modify conflict using egit
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 2.2   Edit
Hardware: PC Windows 7
: P3 major with 4 votes (vote)
Target Milestone: 5.12   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 457054 457116 460474 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-02-05 09:33 EST by Mario Zagar CLA
Modified: 2021-04-13 02:18 EDT (History)
11 users (show)

See Also:


Attachments
repo in merge conflict - local delete vs remote modify (14.28 KB, application/zip)
2017-08-28 16:25 EDT, Vlad Gheorghe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Zagar CLA 2013-02-05 09:33:56 EST
Repro:
1. local branch contains modified file 'file1'
2. merge master branch - master branch contains deleted 'file1' (this is the latest and wanted change - file1 actually should be deleted)
3. 'file1' is shown as conflicted in unstaged file list in git staging view
4. righ click 'file1' -> merge tool
result: empty merge window is displayed
expected: some kind of notification that "local file exists, but 'they' deleted it" and a way for me to choose if I want to keep or delete the file.

Note: If I drag 'file1' to staged file area, then file will not be deleted but my copy will be preserved and I will overwrite deleted file change and put the delete file back which is not what I want.

Generally I do not know how to see what kind of conflict I have in egit for specific file.
Comment 1 Mario Zagar CLA 2013-02-05 09:36:53 EST
Using egit 2.2, eclipse platform 3.8.1 (sts 3.1.0)
Comment 2 Sebastien Arod CLA 2016-04-18 05:58:38 EDT
Any update on this?

The only solution I found is to:
* Use the command line with "git rm"
* Then refresh in egit and continue
Comment 3 Vlad Gheorghe CLA 2017-08-28 16:25:21 EDT
Created attachment 269999 [details]
repo in merge conflict - local delete vs remote modify

4.8.0.201706111038-r

Bug still present.

Also symmetric case ( local delete vs remote modified ) cannot be solved by deletion.


The UI for "replace with ours/theirs" should be adapted so that the respective change can also be a deletion.


I remember that on a previous egit version, in a similar merge conflict state, deleting the conflicting path in Project Explorer would also stage the deletion - thus being a workaround.
I cannot reproduce this behaviour with current egit.
Comment 4 Matthias Sohn CLA 2017-08-29 04:17:25 EDT
(In reply to Vlad Gheorghe from comment #3)
> I remember that on a previous egit version, in a similar merge conflict
> state, deleting the conflicting path in Project Explorer would also stage
> the deletion - thus being a workaround.
> I cannot reproduce this behaviour with current egit.

you can enable automatic staging of deletions in 
Preferences > Team > Git > Committing > Automatically stage files being deleted
Comment 5 Vlad Gheorghe CLA 2017-08-29 19:17:46 EDT
(In reply to Matthias Sohn from comment #4)
> you can enable automatic staging of deletions in 
> Preferences > Team > Git > Committing > Automatically stage files being
> deleted

I confirm that enabling this feature allows solving the conflict to "delete" by deleting the conflicting file from the Project Explorer.

Maybe should be enabled by default ?

There is an usability issue though, in that, as OP notices, it is hard to understand from the UI that this is a delete/modify conflict:
- staging context menu "Replace with ours/theirs" - is misleading
   - should be adapted
   - chosing the deleted side (ours/theirs) has currently no effect
- Merge tool - shows an empty pane for the deleted side
  - should maybe explicitly state that the side is deleted
- Merge tool does not allow resolution to 'deleted'
Comment 6 Matthias Sohn CLA 2017-08-30 02:40:43 EDT
EGit should be improved to support delete/modify conflicts. Auto-staging deletions is a workaround but not a proper solution. Users should be able to explicitly resolve such conflicts.
Comment 7 Vasili Gulevich CLA 2018-05-24 10:01:10 EDT
Automatic staging does not work for files that are not in Eclipse Resource model.

Consider following repository structure:
- plugin1 // Eclipse project
- plugin2 // Eclipse project
- pom.xml // composite Maven project

Root directory of such repository has no .project file and is not represented in workspace.

On deletion conflict, user has to:
 - import this folder
 - delete file from Project Explorer to activate auto staging
 - delete project from workspace (without deleting its content on filesystem, to keep plugins intact)
 - delete redundant .project file
Comment 8 Guillermo López CLA 2021-02-01 17:21:01 EST
Hi, I've just faced this bug and already found that it has been identified long time ago but not yet resolved. Even when there might be workarounds and I do not consider it a very serious issue, I believe it would be very nice should we have it working the "right way" so I'd like to help and contribute to get it resolved.

If anyone is able to provide some guidance I'll be happy to give it a try and look into it.
Comment 9 Eclipse Genie CLA 2021-04-03 13:34:05 EDT
New Gerrit change created: https://git.eclipse.org/r/c/egit/egit/+/178812
Comment 10 Thomas Wolf CLA 2021-04-03 16:54:07 EDT
*** Bug 460474 has been marked as a duplicate of this bug. ***
Comment 13 Thomas Wolf CLA 2021-04-13 02:18:33 EDT
*** Bug 457116 has been marked as a duplicate of this bug. ***
Comment 14 Thomas Wolf CLA 2021-04-13 02:18:58 EDT
*** Bug 457054 has been marked as a duplicate of this bug. ***