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

Bug 373099

Summary: [client][status] "Stage All" does not work
Product: [ECD] Orion Reporter: Szymon Brandys <Szymon.Brandys>
Component: GitAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: libingw, tomasz.zarna
Version: 0.5   
Target Milestone: 0.5 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Szymon Brandys CLA 2012-03-02 09:24:32 EST
I checked the "Unstaged" checkbox and clicked "Stage" action. Unstaged/Staged sections were refreshed, but changes did not move to "Staged" section. Staging changes one by one worked.
Comment 1 Susan McCourt CLA 2012-03-02 11:03:21 EST
I've seen this also.
Comment 2 libing wang CLA 2012-03-02 11:42:51 EST
I couldn't reproduce it in Chrome 18.0.1025.45 beta-m.
But in FF 10 I could. 
Kind of strange why it can be browser related.
Comment 3 libing wang CLA 2012-03-02 11:57:44 EST
I pulled the latest code and ran it on my self hosting site.
It worked on FF as well.
I've checked that git-status-table.js hasn't been changed since Feb 21th, which means orion.eclipse.org is running the latest code.
So I guess the running the raw code VS built in code makes the difference.
Comment 4 libing wang CLA 2012-03-02 14:21:46 EST
Finally I found the reason:
It is not related to browser or built version of source at all.
It really depends on where you go to the git status page.
If you go to git status page from your git repo root , then it works all the time.
But if you go from a sub folder, e.g. , then it does not work.
Here is the reason:
In function stageMultipleFiles: function(gitCloneURI, paths , onLoad , onError) in gitClient, it requires the gitCloneURI, which is your current folder. It also requires paths, which your selected files.
In case of a sub folder, the file.Path attribute returned from git status API is relative to the sub folder. Seems that stageMultipleFiles function does not handle this situation.

If I use file.Name as the path, which is always a full path, then stageMultipleFiles works regardless gitCloneURI is sub folder.
Comment 5 libing wang CLA 2012-03-02 14:23:59 EST
Tomasz/Szymon, should I use file.Name for stageMultipleFiles function in gitClient.js?
Comment 6 libing wang CLA 2012-03-02 15:40:15 EST
Fixed with http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=9320c8eacb23fdfeba69fbb288bd512de30aa000.

I don't see the reason not using .Name. Otherwise the issue will affect lot of people staging a group of files.
Tomasz/Szymon, please correct if otherwise.
Comment 7 Susan McCourt CLA 2012-03-03 22:44:20 EST
good catch.  I could never put my finger on when it worked and didn't work.
Comment 8 Szymon Brandys CLA 2012-03-05 09:09:14 EST
(In reply to comment #6)
> Tomasz/Szymon, please correct if otherwise.

The field names in Git Status JSON should be aligned with those in File API. In Git Status we have

{
      "Git": {
        "CommitLocation": "/gitapi/commit/HEAD/file/m/0.5/plugins/z.txt",
        "DiffLocation": "/gitapi/diff/Default/file/m/0.5/plugins/z.txt",
        "IndexLocation": "/gitapi/index/file/m/0.5/plugins/z.txt"
      },
      "Location": "/file/m/0.5/plugins/z.txt",
      "Name": "0.5/plugins/z.txt",
      "Path": "plugins/z.txt"
}
    
and in File API we have:   
    
{
...
      "Length": 0,
      "LocalTimeStamp": 1330954485834,
      "Location": "/file/m/0.5/plugins/z.txt",
      "Name": "z.txt"
}

I would expect "Name" to be just the name of a file (File API). Then "RelativePath" a path relative to the location and "Path" absolute path in the filesystem. Please request this change first in our Git API and then change the UI.

Your fix works for now btw, but the suggested change in Git API will break the UI again.