Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 436224 - Unable to view diff for stashed commits
Summary: Unable to view diff for stashed commits
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 3.3.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.5   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 381701 (view as bug list)
Depends on:
Blocks: 420936
  Show dependency tree
 
Reported: 2014-05-30 03:21 EDT by Robert Munteanu CLA
Modified: 2014-06-28 00:41 EDT (History)
5 users (show)

See Also:


Attachments
screenshot of commit editor when opening a stashed commit (38.91 KB, image/png)
2014-05-30 03:25 EDT, Robert Munteanu CLA
no flags Details
Proposed redesign for stash commit viewer (72.75 KB, image/png)
2014-06-05 08:43 EDT, Andreas Hermann CLA
no flags Details
Current commit viewer (95.44 KB, image/png)
2014-06-05 08:44 EDT, Andreas Hermann CLA
no flags Details
Inconsistent decorators in stash view compared to staging view (178.51 KB, image/png)
2014-06-08 18:14 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 Robert Munteanu CLA 2014-05-30 03:21:41 EDT
When I stash some changes I'd like to preview them before applying back, or just knowing whether it's safe to drop them. Unfortunately that's not possible, since the commit editor has no 'Diff' tab and double-clicking on a changed file pops up a dialog which says "This is a merge commit with more than once ancestor".

With the cgit CLI, I can use git show or git stash show -p. With EGit, there is no such possibility.
Comment 1 Robert Munteanu CLA 2014-05-30 03:25:01 EDT
Created attachment 243707 [details]
screenshot of commit editor when opening a stashed commit
Comment 2 Andreas Hermann CLA 2014-06-05 08:43:21 EDT
Created attachment 243990 [details]
Proposed redesign for stash commit viewer
Comment 3 Andreas Hermann CLA 2014-06-05 08:44:15 EDT
Created attachment 243991 [details]
Current commit viewer
Comment 4 Matthias Sohn CLA 2014-06-08 18:13:56 EDT
comments for https://git.eclipse.org/r/#/c/28037/2

nice improvement :-)

Good idea to mimic staging view to display stash details. Though a few things should be fixed to make the stash view more consistent with the staging view:
- The git decorators in the stash commit viewer don't match the corresponding decorators shown by staging view before creating the stash. I think this should be fixed, see the attached screenshot
- The sort order of files shown in stash commit viewer doesn't match the sort order shown in staging view, see screenshot.
- Double click on a file in the staging view opens a compare view, double clicking a file in stash view doesn't but opens the file version. I think this should be fixed so that stash view also shows compare view, add a context menu to allow opening the file version.
- The list of parents shown in the stash commit viewer could indicate what's the content of each of them, instead of showing
 
 Parent: <commitId1>
 Parent: <commitId2>
 Parent: <commitId3>

we could show:

 Previous version: <commitId1>
 Index: <commitId2>
 Untracked: <commitId3>
Comment 5 Matthias Sohn CLA 2014-06-08 18:14:51 EDT
Created attachment 244071 [details]
Inconsistent decorators in stash view compared to staging view
Comment 6 Robin Stocker CLA 2014-06-10 09:03:10 EDT
(In reply to Matthias Sohn from comment #4)
> comments for https://git.eclipse.org/r/#/c/28037/2
> 
> nice improvement :-)

Yes :).

> Good idea to mimic staging view to display stash details. Though a few
> things should be fixed to make the stash view more consistent with the
> staging view:
> - The git decorators in the stash commit viewer don't match the
> corresponding decorators shown by staging view before creating the stash. I
> think this should be fixed, see the attached screenshot

Do we really want these to match? In the current version, it looks like the stash commit viewer uses the same decorations as the file diff table in the history view and in the normal commit viewer, which is a good thing.

Would you want to change the display in the history view and commit viewer as well, or just add a special case for stash commits?

> - The list of parents shown in the stash commit viewer could indicate what's
> the content of each of them

+1.

Some other comments:

- The Diff tab could show the combined diff for now (like git stash show -p)
- I think showing author/committer date would be useful ("When did I stash these changes again?")
Comment 7 Robin Stocker CLA 2014-06-10 09:07:13 EDT
*** Bug 381701 has been marked as a duplicate of this bug. ***
Comment 8 Robin Stocker CLA 2014-06-10 09:08:56 EDT
With this in place, bug 420936 (stashes in toolbar) can be nicely implemented, marked this as dependency.
Comment 9 Matthias Sohn CLA 2014-06-10 09:46:54 EDT
(In reply to Robin Stocker from comment #6)
> (In reply to Matthias Sohn from comment #4)
> > comments for https://git.eclipse.org/r/#/c/28037/2
> > 
> > nice improvement :-)
> 
> Yes :).
> 
> > Good idea to mimic staging view to display stash details. Though a few
> > things should be fixed to make the stash view more consistent with the
> > staging view:
> > - The git decorators in the stash commit viewer don't match the
> > corresponding decorators shown by staging view before creating the stash. I
> > think this should be fixed, see the attached screenshot
> 
> Do we really want these to match? In the current version, it looks like the
> stash commit viewer uses the same decorations as the file diff table in the
> history view and in the normal commit viewer, which is a good thing.
> 
> Would you want to change the display in the history view and commit viewer
> as well, or just add a special case for stash commits?

you are right, I didn't consider that this would create inconsistencies with
other views, so I withdraw my proposal to make the decorators match those shown in the staging view
Comment 10 Andreas Hermann CLA 2014-06-12 12:34:01 EDT
Thanks for constructive feedback!
I have already implemented some of your suggestions, but I am not yet ready to upload a new patch.

C-Git doesn't include untracked files in the stash diff.
I would suggest to include those nevertheless in the diff tab.
Comment 11 Andreas Hermann CLA 2014-06-19 06:44:51 EDT
Please review the latest changeset.
These changes are included:
- commit parent labels named HEAD, Indexed and Untracked.
- unstaged changes are sorted by path
- double click on file compares with previous version
- diff tab content
- save/restore of the view state on application restart
Comment 12 Matthias Sohn CLA 2014-06-26 04:51:09 EDT
merged as 30c5a5545c56d8b4cf93ccdfa76cb1b4756a2901
Comment 13 Markus Keller CLA 2014-06-26 08:08:37 EDT
/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties line 1738 has a ' too much at the end:

StashDropCommand_stashCommitNotFound=No stash commit found with id=''{0}'''
Comment 14 Robin Stocker CLA 2014-06-28 00:41:07 EDT
(In reply to Markus Keller from comment #13)
> /org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties line
> 1738 has a ' too much at the end:
> 
> StashDropCommand_stashCommitNotFound=No stash commit found with id=''{0}'''

Thanks, fixed in eb1d6167c6f180eae819457d80e74e16063b6877.