Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 351065

Summary: Replace With... Commit doesn't delete added (untracked) files and folders
Product: [Technology] EGit Reporter: sam <s.marshall>
Component: CoreAssignee: Project Inbox <egit.core-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r, robin.rosenberg
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description sam CLA 2011-07-04 06:28:06 EDT
Build Identifier:  I20110613-1736

If you select a folder in the Navigator view and do 'Replace With... Commit' and select a commit, I would expect it to make the selected folder the same as it is in the commit you selected.

In fact, while modified files are correctly replaced with the version from the commit, if your current branch contains added files within new folders, then these folders and files remain in place.

(Note: I am not sure whether there is anything special about folders or it doesn't remove added files at all.)

Reproducible: Always

Steps to Reproduce:
1. In an existing Git project, create a new temporary branch for testing and check it out. (E.g. temporary branch 'temp' off main branch 'master'.)

2. Find a folder within the project. E.g. 'src'. Add a subfolder to this e.g. 'src/new'. Add a file e.g. src/new/newfile.txt. Type junk in the file. Save it and commit the change to the temp branch.

3. Using the Navigator view, select the 'src' folder. Right click. Choose 'Replace with / Commit', OK the warning, and select the commit that corresponds to the master branch.

Expected result:
- The file 'newfile.txt' and the folder 'new.txt' are deleted from the workspace (and if this change is committed, they would then also be deleted from the temp branch of the repository).

Actual result:
- The file 'newfile.txt' and the folder are not deleted and remain in place. (I.e. nothing happens.)
Comment 1 Markus Keller CLA 2012-06-13 10:30:55 EDT
+1. See also bug 354437.
Comment 2 Robin Rosenberg CLA 2013-01-01 10:03:17 EST
I think for safety we should not do that. Delete from staging view for now.

There will also most likely be a clean command in the next release.
Watch for https://git.eclipse.org/r/#/c/5345/ to be submitted.