Bug 451817 - Clicking "Cancel" in squash commit message dialog still squashes the commits
Summary: Clicking "Cancel" in squash commit message dialog still squashes the commits
Status: REOPENED
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 3.5.2   Edit
Hardware: All Mac OS X
: P3 major with 1 vote (vote)
Target Milestone: 5.7   Edit
Assignee: Simon Muschel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 488447 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-11-17 04:40 EST by Konrad Windszus CLA
Modified: 2022-03-20 09:18 EDT (History)
8 users (show)

See Also:


Attachments
Screenshot of Squash Context Menu (242.89 KB, image/png)
2014-11-23 05:48 EST, Konrad Windszus CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Konrad Windszus CLA 2014-11-17 04:40:40 EST
Clicking "Cancel" or "OK" has the same effect in the Stash dialog being opened in the history view via "Modify->Stash". In both cases the commits are stashed.
That should only happen if one clicks on OK but not in the case one clicks on Cancel.
Comment 1 Robin Stocker CLA 2014-11-22 10:28:41 EST
There is no Modify > Stash menu item. Do you mean the dialog that is shown when clicking Modify > Edit and there are uncommitted changes? If not, please explain the exact steps to reproduce.

With the above, I could reproduce a problem in that clicking cancel there would still open other views, proposed fix:

https://git.eclipse.org/r/36880
Comment 2 Matthias Sohn CLA 2014-11-22 19:44:13 EST
(In reply to Robin Stocker from comment #1)
> There is no Modify > Stash menu item. Do you mean the dialog that is shown
> when clicking Modify > Edit and there are uncommitted changes? If not,
> please explain the exact steps to reproduce.
> 
> With the above, I could reproduce a problem in that clicking cancel there
> would still open other views, proposed fix:
> 
> https://git.eclipse.org/r/36880

merged as 48fd04618e1866775186cbf29bfc55b7c3bdcf10
Comment 3 Konrad Windszus CLA 2014-11-23 05:48:33 EST
Created attachment 248842 [details]
Screenshot of Squash Context Menu

Let me explain more in detail: The attached screenshot shows the context menu I am referring to.
The problem really is the dialog which opens after clicking on Stash allows you to modify the commit message. That one allows to edit the commit messages. Clicking on Cancel here will not cancel the squash operation but will just take the default commit message. So at that point in time I am not able to cancel the operation with the GUI.

That is not really expected from a user's point of view. I would prefer if the dialog for editing the commit message would allow to cancel the actual squash operation.
Comment 4 Björn Michael CLA 2016-01-29 05:41:33 EST
I stumble over this today.
Clicking cancel or hitting Esc wont cancel squash operation and the default commit message will be applied.

# This is a combination of 2 commits.
# The first commit's message is:
... <- first commit msg
# This is the 2nd commit message:
... <- second commit msg

Tested with Egit version is 4.2.0
Comment 5 Thomas Wolf CLA 2016-02-25 13:36:27 EST
*** Bug 488447 has been marked as a duplicate of this bug. ***
Comment 6 Mateusz Matela CLA 2018-01-03 17:57:46 EST
Just bumped into this in 4.9.1.
Comment 7 Simon Muschel CLA 2019-12-18 12:54:16 EST
Bumped into this today. The wording of the cancel button is confusing here, as the dialog is just there to change the commit message. Maybe changing the "Cancel" label to something like "Keep message" or "Skip" would reduce confusion?
Comment 8 Matthias Sohn CLA 2019-12-19 04:12:24 EST
(In reply to Simon Muschel from comment #7)
> Bumped into this today. The wording of the cancel button is confusing here,
> as the dialog is just there to change the commit message. Maybe changing the
> "Cancel" label to something like "Keep message" or "Skip" would reduce
> confusion?

yes
Comment 9 Eclipse Genie CLA 2019-12-19 11:53:18 EST
New Gerrit change created: https://git.eclipse.org/r/154799
Comment 10 Eclipse Genie CLA 2019-12-27 06:28:55 EST
Gerrit change https://git.eclipse.org/r/154799 was merged to [master].
Commit: http://git.eclipse.org/c/egit/egit.git/commit/?id=d2d3cada1c56973e27829990e5d87425469ead9f
Comment 11 Thomas Wolf CLA 2019-12-27 08:25:04 EST
(In reply to Eclipse Genie from comment #10)
> Gerrit change https://git.eclipse.org/r/154799 was merged to [master].
> Commit:
> http://git.eclipse.org/c/egit/egit.git/commit/
> ?id=d2d3cada1c56973e27829990e5d87425469ead9f

Replacing "Cancel" by "Skip" doesn't improve the situation IMO. "Skip" can just as well be misunderstood to mean "skip squashing".
Comment 12 Simon Muschel CLA 2020-01-29 13:15:21 EST
(In reply to Thomas Wolf from comment #11)
> (In reply to Eclipse Genie from comment #10)
> > Gerrit change https://git.eclipse.org/r/154799 was merged to [master].
> > Commit:
> > http://git.eclipse.org/c/egit/egit.git/commit/
> > ?id=d2d3cada1c56973e27829990e5d87425469ead9f
> 
> Replacing "Cancel" by "Skip" doesn't improve the situation IMO. "Skip" can
> just as well be misunderstood to mean "skip squashing".

Would you prefer a different label, or a different solution?
Comment 13 Thomas Wolf CLA 2020-01-29 16:12:39 EST
Either "Cancel", and cancelling the dialog cancels the squash, or no cancel opportunity at all. The first would make sense for direct user-initiated squashing (Modify->Squash), the second would make sense for squashes done in an interactive rebase. The first would, I think, need a change in JGit.
Comment 14 Björn Michael CLA 2020-12-06 01:53:04 EST
Pressing "Cancel" should cancel the squash operation.
Comment 15 Thomas Wolf CLA 2022-03-18 19:37:48 EDT
This label change definitely doesn't improve things. I don't consider this fixed.

The point here is that we have three possible outcomes:

* User edits the message and clicks "Reword": the edited message is taken and
  squash finishes (and further rebase steps possibly run).
* User edits commit message and clicks "Cancel": the edits are discarded,
  squash finishes with the unedited text.
* User wants to abort the whole squash or rebase operation.

The third is missing. I think the best would be to add a third button "Abort". Possibly re-label the "Cancel" button to "Discard Edits", or "Use Original".
Comment 16 Thomas Wolf CLA 2022-03-18 19:45:06 EDT
"Abort" needs a little support in JGit first. JGit must be able to determine from the result of the callback that it is supposed to abort the rebase. (For instance, if it gets back null.)
Comment 17 Thomas Wolf CLA 2022-03-20 09:18:26 EDT
Actually, there is another option for the user: stop the rebase, without performing the commit. That is what C git does if you exit the editor with an error code (:cq! in vim) or an empty message. Using C git, the user can then decide what to do: edit the commit further, commit with a new message, or abort the rebase.

Maybe that's better for the three options in the dialog? "Reword", "Use Original", "Stop Rebase"?

Or give the user four options? "Reword", "Use Original", "Stop Rebase", "Abort"? (We could still distinguish Stop from Abort in JGit, e.g., null result leads to abort, and empty message leads to stop.)