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

Bug 349225

Summary: [client][git] Unable to stage file deletion
Product: [ECD] Orion Reporter: John Arthorne <john.arthorne>
Component: ClientAssignee: Tomasz Zarna <tomasz.zarna>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: simon_kaegi, Szymon.Brandys
Version: 0.2Flags: Szymon.Brandys: review+
Target Milestone: 0.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Potential fix none

Description John Arthorne CLA 2011-06-13 15:40:22 EDT
0.2 RC1

I have an outgoing file deletion, but I cannot stage it from the Git Status page. I get this error message:

Unable to load /gitapi/index/file/e/doc/org.eclipse.orion.doc.isv/WikiDoc/Orion/Server_API/File_API/File-API.html status:500

In the console I can see this JSON error response:

{"Severity":"Error","Message":"Failed to process an operation on index for file/e/doc/org.eclipse.orion.doc.isv/WikiDoc/Orion/Server_API/File_API/File-API.html","HttpCode":500,"Code":0}
Comment 1 John Arthorne CLA 2011-06-13 15:43:27 EDT
By setting a breakpoint on the server I am able to see the underlying exception:

java.util.NoSuchElementException
	at java.util.HashMap$HashIterator.nextEntry(HashMap.java:796)
	at java.util.HashMap$EntryIterator.next(HashMap.java:834)
	at java.util.HashMap$EntryIterator.next(HashMap.java:832)
	at org.eclipse.orion.server.git.servlets.GitIndexHandlerV1.handleRequest(GitIndexHandlerV1.java:61)
	at org.eclipse.orion.server.git.servlets.GitIndexHandlerV1.handleRequest(GitIndexHandlerV1.java:1)
	at org.eclipse.orion.server.git.servlets.GitHandlerV1.handleRequest(GitHandlerV1.java:63)
	at org.eclipse.orion.server.git.servlets.GitHandlerV1.handleRequest(GitHandlerV1.java:1)
	at org.eclipse.orion.server.git.servlets.ServletGitHandler.handleRequest(ServletGitHandler.java:49)
	at org.eclipse.orion.server.git.servlets.ServletGitHandler.handleRequest(ServletGitHandler.java:1)
	at org.eclipse.orion.server.git.servlets.GitServlet.doGet(GitServlet.java:39)
	at org.eclipse.orion.server.git.servlets.GitServlet.doPut(GitServlet.java:52)
Comment 2 John Arthorne CLA 2011-06-13 15:51:30 EDT
The problem is that GitUtils#getGitDirsInParents stops traversing if the file does not exist. However in this case I want to process a deleted file that still has a valid git repository as a parent.
Comment 3 John Arthorne CLA 2011-06-13 15:52:37 EDT
Created attachment 197920 [details]
Potential fix
Comment 4 John Arthorne CLA 2011-06-13 15:53:00 EDT
Please consider for RC2
Comment 5 Simon Kaegi CLA 2011-06-13 16:39:22 EDT
+1 for RC2 - did not review it though.
Comment 6 Tomasz Zarna CLA 2011-06-14 06:53:22 EDT
Thanks for the patch John, I added tests verifying the fix.