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

Bug 517690

Summary: Stash REST API gives ambiguous errors when handling PUT requests
Product: [ECD] Orion Reporter: Remy Suen <remy.suen>
Component: NodeAssignee: Remy Suen <remy.suen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 15.0   
Hardware: All   
OS: All   
Whiteboard:

Description Remy Suen CLA 2017-06-02 04:59:06 EDT
1. Launch your server pointing at Git repository. So if you have /blah/blah/.git, then start Orion pointing at /blah/blah

$ node server.js -w /blah/blah/

2. Make sure your /blah/blah Git repository doesn't have anything in the stash.

$ git stash drop

3. 

$ curl -X  PUT "http://localhost:8081/gitapi/stash/abc/file/orionode"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    58  100    58    0     0    743      0 --:--:-- --:--:-- --:--:--   935{"Severity":"Error","Message":"Number index is required."}

4. Put something in the stash.

$ echo "a" > a.txt
$ git stash
$ curl -X  PUT "http://localhost:8081/gitapi/stash/abc/file/orionode"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    58  100    58    0     0   3625      0 --:--:-- --:--:-- --:--:--  3625{"Severity":"Error","Message":"Number index is required."}
Comment 1 Remy Suen CLA 2017-06-02 05:03:25 EDT
Fix pushed to master.

https://github.com/eclipse/orion.client/commit/891d7bd0697c1b00ba2870a9e7b268ebac311929

If the user tries to apply something from the stash when the stash is actually empty...

{"Severity":"Error","Message":"Failed to apply stashed changes due to an empty stash."}

If the user tries to apply something from the stash but it doesn't exist in the stash and the stash is not empty...

{"Severity":"Error","Message":"Invalid stash reference abc."}