| Summary: | [server] /git/diff REST API does not give any diff on staged files | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | libing wang <libingw> |
| Component: | Client | Assignee: | Tomasz Zarna <tomasz.zarna> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 0.2 | ||
| Target Milestone: | 0.2 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 338225 | ||
|
Description
libing wang
I was hoping I will get away with not providing "git diff --cached" as least until I finish bug 338203 ;) But on the other hand, I'm happy someone is using the API, so I'm switching to this task. btw, I don't think this is a real "blocker"[1] it's more a bug blocking bug 338225 from being fully functional. Anyway, I'm on it. [1] https://bugs.eclipse.org/bugs/page.cgi?id=fields.html#bug_severity To make the 2 levels of diff clear , I would like to give the following use case and flow from a user's perspective. 1."fileA" is already in my local repo and has one line content "line1\n". 2. I add the second line so that the content is "line1\nline2\n" 3. Now I go to the git status page I should see "fileA" listed in the unstaged area. 4.I click on "fileA" , I can see the diff is "line1\nline2\n" VS "line1\n". 5.I use "git add fileA" 6.Go to git status page and refresh , now I see "fileA" i nthe staged area. 7.I click on "fileA" , I should stille see the diff as "line1\nline2\n" VS "line1\n". 8. I changed "fileA" again by adding "line3" , now the file content is "line1\nline2\nline3\n". 9.Go to git status page and refresh , now I see "fileA" in both staged and unstaged area. 10. I click on fileA in the unstaged area , I should see the diff as "line1\nline2\nline3\n" VS "line1\nline2\n". I assume , the git/index will give me "line1\nline2\n" in step 7. I am wondering if we need another API git/HEAD to get "line1\n" because the diff in step 7 is "index VS HEAD". Fixed with 67b050dbe57015704f682e70bfb3bbd1b8364626. /git/status will now return different /git/diff URI for staged files (changed and removed). If you follow that link you will get the same result as "git diff --cached -- {path}" in a git CLI would return.
I'm going back to bug 338203. One of the things I'm gonna implement there is an ability to retrieve a file content for a given commit.
|