Bug 407607 - Add presentation options to Git Staging view
Summary: Add presentation options to Git Staging view
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All Windows 7
: P3 minor (vote)
Target Milestone: 3.1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2013-05-08 20:34 EDT by Steve Elsemore CLA
Modified: 2013-08-14 08:31 EDT (History)
2 users (show)

See Also:


Attachments
screenshot staging view compressed layout, problems marked in red (92.84 KB, image/png)
2013-05-10 18:50 EDT, Matthias Sohn CLA
no flags Details
screenshot staging view tree layout, problems marked in red (126.00 KB, image/png)
2013-05-10 18:51 EDT, Matthias Sohn CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Elsemore CLA 2013-05-08 20:34:45 EDT
In the headers of the "Unstaged Changes" and "Staged Changes" areas, include buttons to choose the presentation mode.  Choices include "Flat" (current behavior), "Tree" (hierarchical) and "Compressed".  Also include Expand/Collapse All buttons (enabled when "Flat" is not selected).

I will submit a patch for review.
Comment 1 Steve Elsemore CLA 2013-05-10 09:15:48 EDT
Patch ready for review:

https://git.eclipse.org/r/12676
Comment 2 Matthias Sohn CLA 2013-05-10 18:48:58 EDT
compressed mode:
- top level files (directly under repository root) aren't sorted properly

tree mode:
- wrong tree structure if changes are done in different 2nd level folders under the same top level folder

I will attach screenshots for these problems here

both in compressed and tree mode refreshing the view closes all folders, would be nice if opening state would be preserved across refresh
Comment 3 Matthias Sohn CLA 2013-05-10 18:50:45 EDT
Created attachment 230804 [details]
screenshot staging view compressed layout, problems marked in red
Comment 4 Matthias Sohn CLA 2013-05-10 18:51:11 EDT
Created attachment 230805 [details]
screenshot staging view tree layout, problems marked in red
Comment 5 Steve Elsemore CLA 2013-05-10 19:57:03 EDT
Thanks for trying this out.  I will look into the wrong tree structure problem.

Regarding the sorting problem, isn't this the same way that the same files would be sorted in the current Staging View, without the patch? (Upper case preceding lower case)
Comment 6 Steve Elsemore CLA 2013-05-11 13:27:53 EDT
I've pushed changes that fix the tree structure problem, and preserve tree expansion state across refresh.  I haven't yet done anything about the sorting of top level files because I'm not sure what behavior you'd like to see.  Currently, in tree or compressed mode, the top level files appear after all the folders, which is typical sorting behavior.  The sorting is case sensitive, with upper case preceding lower case, which is consistent with the way the files are sorted in the 3.0 version of the Git Staging view, without any of my changes.  Would you prefer that they be sorted without regard to case?  Or am I missing the actual problem that you're describing?
Thanks,
Steve
Comment 7 Robin Stocker CLA 2013-07-12 12:03:15 EDT
Some feedback from trying it out:

* When the mode is "Flat", could we remove the + and - buttons instead of disabling them? They don't have any purpose then and clutter the UI.

* When using compressed mode and you have two folders say "a/b" with file "1", and "a/b/c" with file "2", and you stage "a/b", "a/b/c" is also staged. It's also the case for the "Replace ..." actions. I know the reason for this (we just call AddCommand with the selection), but I already see the bug reports coming in about this. Maybe we need to special-case this and iterate over the tree elements?

* A mix between tree and compressed view could also be interesting. So that projects are displayed at the top, and then below them the compressed folders. This would not necessarily have to be a new mode.

* When the top section title is updated, it changes to "Staged Changes" (instead of "Unstaged Changes").

* The tree nodes have no "Show In" menu, that could be useful.

Other than that, I think this will be a nice addition :).
Comment 8 Steve Elsemore CLA 2013-07-18 12:53:16 EDT
Thanks for feedback.  Comments inline.

(In reply to comment #7)
> Some feedback from trying it out:
> 
> * When the mode is "Flat", could we remove the + and - buttons instead of
> disabling them? They don't have any purpose then and clutter the UI.

Done with latest patch set.

> * When using compressed mode and you have two folders say "a/b" with file "1",
> and "a/b/c" with file "2", and you stage "a/b", "a/b/c" is also staged. It's
> also the case for the "Replace ..." actions. I know the reason for this (we just
> call AddCommand with the selection), but I already see the bug reports coming in
> about this. Maybe we need to special-case this and iterate over the tree
> elements?

Will come back to this one soon.

> * A mix between tree and compressed view could also be interesting. So that
> projects are displayed at the top, and then below them the compressed folders.
> This would not necessarily have to be a new mode.

I'm not sure about this one.  When I'm working with a single project, as I often am, this seems to just add an unnecessary level to the tree hierarchy.

> * When the top section title is updated, it changes to "Staged Changes" (instead
> of "Unstaged Changes").

Done with latest patch set.

> * The tree nodes have no "Show In" menu, that could be useful.

Done with latest patch set.

> Other than that, I think this will be a nice addition :).
Comment 9 Robin Stocker CLA 2013-07-19 08:29:54 EDT
(In reply to comment #8)
> > * When using compressed mode and you have two folders say "a/b" with file "1",
> > and "a/b/c" with file "2", and you stage "a/b", "a/b/c" is also staged. It's
> > also the case for the "Replace ..." actions. I know the reason for this (we just
> > call AddCommand with the selection), but I already see the bug reports coming in
> > about this. Maybe we need to special-case this and iterate over the tree
> > elements?
> 
> Will come back to this one soon.
> 
> > * A mix between tree and compressed view could also be interesting. So that
> > projects are displayed at the top, and then below them the compressed folders.
> > This would not necessarily have to be a new mode.
> 
> I'm not sure about this one.  When I'm working with a single project, as I
> often am, this seems to just add an unnecessary level to the tree hierarchy.

Maybe we chould change "Compressed" to be hierarchical but still compress the folders. Say we have the following files in the view:

org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java

How about showing them in a tree form, but compressing folders which only have one folder as children, like so:

* org.eclipse.jgit/src/org/eclipse/jgit
  * api
    * AddCommand.java
    * RmCommand.java
  * internal
    * JGitText.java

It's compact and does not have the problem of not being hierarchical (for Stage/Unstage). In case the files are all in the same folder, it's equivalent to the current "Compressed" presentation. In the above example, it uses one more vertical item, but does not repeat the "org.eclipse.jgit/src/org/eclipse/jgit" path twice.

What do you think?

By the way, the Java > Appearance preference for this call it "Fold empty packages in hierarchical layout in Package and Project Explorer".
Comment 10 Steve Elsemore CLA 2013-07-19 09:15:23 EDT
(In reply to comment #7)

> * When using compressed mode and you have two folders say "a/b" with file
> "1", and "a/b/c" with file "2", and you stage "a/b", "a/b/c" is also staged.
> It's also the case for the "Replace ..." actions. I know the reason for this
> (we just call AddCommand with the selection), but I already see the bug
> reports coming in about this. Maybe we need to special-case this and iterate
> over the tree elements?

Done in latest patch set.
Comment 11 Robin Stocker CLA 2013-07-29 18:42:07 EDT
Implementation of the idea from comment 9 here:

https://git.eclipse.org/r/14952

Steve, could you try it out and give feedback? It currently replaces the "compressed" mode . Maybe it should better replace the "tree" mode instead. Or be a new mode? Hmm, 4 modes seems a bit much.
Comment 12 Steve Elsemore CLA 2013-07-30 06:14:23 EDT
(In reply to comment #11)
> Implementation of the idea from comment 9 here:
> 
> https://git.eclipse.org/r/14952
> 
> Steve, could you try it out and give feedback? It currently replaces the
> "compressed" mode . Maybe it should better replace the "tree" mode instead.
> Or be a new mode? Hmm, 4 modes seems a bit much.

In general, I prefer this new compressed mode to the previous compressed mode.  I agree that 4 modes is too much, and replacing the previous compressed mode is the right approach.  A few things I noticed:

1.  Files in the working directory root should probably show up after all the compressed folders, the way they do in tree mode, which is consistent with Eclipse resource views.  Also, I haven't figured out how to reproduce this consistently, but I'm sometimes seeing these root files listed twice, once as a root tree node, and once under a folder node that has no text (this is the one that should not show).

2.  It would be nice if we could improve the preservation of expansion state when items are moved between Unstaged/Staged.  For example, suppose you have the following unstaged chages:

* org.eclipse.jgit/src/org/eclipse/jgit
  * api
    * AddCommand.java
    * RmCommand.java
  * internal
    * JGitText.java

Now drag the api folder to Staged Changes.

The internal folder collapses into org.eclipse.jgit/src/org/eclipse/jgit/internal and remains expanded, which is good.  In the Staged section, it would be nice if  org.eclipse/jgit/src/org/eclipse/jgit/api was expanded.

Now expand the api folder in the Staged section and then drag it back to Unstaged.  Now org.eclipse.jgit/src/org/eclipse/jgit is collapsed.  It would be nicer if it fully expanded in this case.
Comment 13 Robin Stocker CLA 2013-08-05 09:30:15 EDT
(In reply to comment #12)
> (In reply to comment #11)
> > Implementation of the idea from comment 9 here:
> > 
> > https://git.eclipse.org/r/14952
> > 
> > Steve, could you try it out and give feedback? It currently replaces the
> > "compressed" mode . Maybe it should better replace the "tree" mode instead.
> > Or be a new mode? Hmm, 4 modes seems a bit much.
> 
> In general, I prefer this new compressed mode to the previous compressed
> mode.  I agree that 4 modes is too much, and replacing the previous
> compressed mode is the right approach.  A few things I noticed:

Is it ok if I work on this by modifying your change, so that we have just 1 change? I'll add myself as "Also-by".

> 1.  Files in the working directory root should probably show up after all
> the compressed folders, the way they do in tree mode, which is consistent
> with Eclipse resource views.  Also, I haven't figured out how to reproduce
> this consistently, but I'm sometimes seeing these root files listed twice,
> once as a root tree node, and once under a folder node that has no text
> (this is the one that should not show).

Thanks, will fix.

> 2.  It would be nice if we could improve the preservation of expansion state
> when items are moved between Unstaged/Staged.  For example, suppose you have
> the following unstaged chages:
> 
> * org.eclipse.jgit/src/org/eclipse/jgit
>   * api
>     * AddCommand.java
>     * RmCommand.java
>   * internal
>     * JGitText.java
> 
> Now drag the api folder to Staged Changes.
> 
> The internal folder collapses into
> org.eclipse.jgit/src/org/eclipse/jgit/internal and remains expanded, which
> is good.  In the Staged section, it would be nice if 
> org.eclipse/jgit/src/org/eclipse/jgit/api was expanded.
> 
> Now expand the api folder in the Staged section and then drag it back to
> Unstaged.  Now org.eclipse.jgit/src/org/eclipse/jgit is collapsed.  It would
> be nicer if it fully expanded in this case.

Thanks. I agree, will look into it.
Comment 14 Steve Elsemore CLA 2013-08-05 09:57:54 EDT
> Is it ok if I work on this by modifying your change, so that we have just 1
> change? I'll add myself as "Also-by".

Yes, that would be great, thanks.
Comment 15 Robin Stocker CLA 2013-08-05 17:19:33 EDT
Ok, working on it (first problem fixed, now coming to second one).

I'm thinking we should also rename "Compressed" now, as it doesn't work like before, right?

The Package Explorer uses "Flat" and "Hierarchical" as presentation modes. The problem is, what would our compressed mode be named, "Compact Hierarchical"?

The Search view uses "List" and "Tree". Maybe we could use "List", "Tree" and "Compact Tree"?
Comment 16 Steve Elsemore CLA 2013-08-06 07:57:51 EDT
> The Search view uses "List" and "Tree". Maybe we could use "List", "Tree"
> and "Compact Tree"?

+1
Comment 17 Robin Stocker CLA 2013-08-06 16:43:45 EDT
Ok, second problem is also fixed and pushed as new path set to original change:

https://git.eclipse.org/r/12676

Please test/review.
Comment 18 Matthias Sohn CLA 2013-08-10 20:46:08 EDT
merged as 1ef79b6d9abed44ee7facf4c665f608d85cb67cd
Comment 19 Robin Stocker CLA 2013-08-14 08:31:07 EDT
Small follow-up to also expand new nodes when the user selected "Expand All":

https://git.eclipse.org/r/15462