Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unblock special commit message #7128

Merged
2 commits merged into from
Sep 25, 2019

Conversation

mstv
Copy link
Member

@mstv mstv commented Sep 12, 2019

Fixes #7104
Fixes #6993

Proposed changes

  • add button to enable editing the special commit message of fixup! and squash! commits
  • add/adapt hotkeys for buttons
  • allow Amend commit' for any CommitKind
  • reset CommitKind after commiting without closing FormCommit
  • slightly off topic: add more test cases for empty lines in commit messages (addendum to Retain newlines in commit message #6877)

Screenshots

Before

grafik

After

grafik
(different message font due to different font settings vs. portable build)
grafik

(Intermediate with ToolStripItemButton)

grafik

Before

grafik

After

grafik

Test methodology

  • manual tests

Test environment(s)

  • Git Extensions 3.3.0
  • Build 79dee30
  • Git 2.23.0.windows.1
  • Microsoft Windows NT 10.0.18362.0
  • .NET Framework 4.8.3815.0
  • DPI 96dpi (no scaling)

✒️ I contribute this code under The Developer Certificate of Origin.

@ghost ghost assigned mstv Sep 12, 2019
@pmiossec
Copy link
Member

I like the way the 'preview' button is placed in the screenshots of#7039.

And I think it could be interesting to doi it also for 'Edit special commit message'.

What do you think?

@codecov
Copy link

codecov bot commented Sep 12, 2019

Codecov Report

Merging #7128 into master will increase coverage by 0.01%.
The diff coverage is 56.66%.

@@            Coverage Diff             @@
##           master    #7128      +/-   ##
==========================================
+ Coverage   47.31%   47.32%   +0.01%     
==========================================
  Files         746      746              
  Lines       54475    54486      +11     
  Branches     7140     7140              
==========================================
+ Hits        25775    25788      +13     
- Misses      27279    27283       +4     
+ Partials     1421     1415       -6
Flag Coverage Δ
#production 36.47% <56.66%> (+0.02%) ⬆️
#tests 97.62% <ø> (ø) ⬆️

@mstv
Copy link
Member Author

mstv commented Sep 12, 2019

https://codecov.io/gh/gitextensions/gitextensions/pull/7128/changes does not contain any touched file but many unrelated?!?

@mstv
Copy link
Member Author

mstv commented Sep 12, 2019

I like the way the 'preview' button is placed in the screenshots of#7039.

pro:

  • a little more related to the TextBox

con:

  • The bottom right corner could be too far away, especially if the FormCommit is maximized.
  • I don't like overlays in general because some day, they will hide some text.

@mstv mstv force-pushed the feature/unblock_commit_message branch from 02a6b5f to be597a5 Compare September 14, 2019 12:17
@mstv
Copy link
Member Author

mstv commented Sep 14, 2019

Added hotkeys also for the Reset buttons, @mrexodia.

@mrexodia
Copy link
Contributor

Cool, thanks!

@RussKie
Copy link
Member

RussKie commented Sep 15, 2019

  • add/adapt hotkeys for buttons

I propose this is submitted as its own PR, as it will get merged quickly.

So as this.

  • allow Amend commit' for any CommitKind

Could you please explain why this is a good change?

  • add button to enable editing the special commit message of fixup! and squash! commits
    grafik

I do not disagree with the change, but I am not fond of the proposed implementation.
There is no immediate connection (visual or otherwise) between the textbox and the button.

I think we provide a better user experience by rendering a link label on top of the textbox (z-order wise), e.g. something like the following:
image
The text on the link is up for a discussion (it could be "cancel fixup"?).

@mstv
Copy link
Member Author

mstv commented Sep 15, 2019

allow Amend commit' for any CommitKind

#7104 (comment): "It's a totally valid scenario to turn the latest commit into a fixup! commit."

I think we provide a better user experience by rendering a link label on top of the textbox (z-order wise)

Understood. Can it be activated using a shortcut key?

The text on the link is up for a discussion (it could be "cancel fixup"?).

I'd prefer "Modify this special commit message", perhaps with an addition like "(The warrenty ends here.)". (I know we don't give warrenties and should never do.)
It is not cancelling the fixup: The message will not be changed by clicking. Just CommitKind is switched to Normal in order to store the manually entered commit message on (temporary) close of FormCommit.

@RussKie
Copy link
Member

RussKie commented Sep 15, 2019

Understood. Can it be activated using a shortcut key?

I would think it can.
https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.label.usemnemonic?view=netframework-4.8#System_Windows_Forms_Label_UseMnemonic

I'd prefer "Modify this special commit message", perhaps with an addition like "(The warrenty ends here.)".

We can have a tooltip that warns users (e.g. "do it at your own risk" kind of thing)

@mstv
Copy link
Member Author

mstv commented Sep 16, 2019

Fiddled around with [Link]Label without success. As I explained above, we need a button-like control, not a label which controls only the focus - the documentation (which I read too late) states:
"Pressing ALT + the mnemonic character sets the focus to the control that follows the Label in the tab order."
BTW: The VS 2019 Designer does not understand FormCommit completely. And it did not allow to place [Link]Label in the area of the message editor.
grafik

@RussKie
Copy link
Member

RussKie commented Sep 16, 2019 via email

@RussKie RussKie changed the title Unblock special commit message WIP: Unblock special commit message Sep 17, 2019
@ghost ghost added this to the 3.3 milestone Sep 17, 2019
@RussKie RussKie removed this from the 3.3 milestone Sep 17, 2019
@mstv
Copy link
Member Author

mstv commented Sep 17, 2019

I turned the ToolStripItemButton into a Label, into a LinkLabel and finally into a Button in dedicated commits.
I think this is a good compromise:
grafik

TODO:

  • make ToolTip translatable:
    The TranslationApp seems to ignore ToolTips. Must I really create a TranslationString by hand?
  • Does it look OK with a dark theme?
  • squash

@gerhardol
Copy link
Member

Does it look OK with a dark theme?

It is simple to test with high contrast dark theme (nothing looks OK, But the button should be visible.
To install a real dark system the only simple way is to use WindowsBlinds. Paid app, but have a trial.
#6651 (comment)

@mdonatas
Copy link
Contributor

Food for thought. From UX perspective it seems weird to make a text-area read only and then place a button to make it editable... for what reason exactly? There is no explanation and adding an explanation would only dig this hole deeper.
Git users know that there is nothing special with fixup! and squash! they are just guidelines for interactive rebase to automate reordering rows.
If someone is going to do interactive rebase they are supposedly git savvy enough to know what they are doing and then we really just need a "heads up" UX signalling that this is a commit message with some special meaning. So something like this seems to hit the right balance:
image

#KeepItSimple :)

@RussKie
Copy link
Member

RussKie commented Sep 19, 2019

I like a different perspective, thanks @mdonatas.

Will a commit be treated as a fixup if the text changed though?

@gerhardol
Copy link
Member

Will a commit be treated as a fixup if the text changed though?

The subject after fixup must match.
If you change it is something else, which is what the issue is about.

As the button is implemented, I prefer the guidence it provides but I do not have a strong preference.

@mdonatas
Copy link
Contributor

The subject must match. But that's the same if you are using git from the shell. If the user didn't know that subjects must match, this would be a good learning experience when the lines wouldn't get reordered in an interactive rebase. After all no harm is done at all.

offtopic
IMO there are way too many guard rails on by default already. For instance git embraces commit graph modifications with rebase and amending, there is even a saying rebase makes it look as if you did everything perfect the first time but GE scares you with dialogs about history rewrite which is one of the pillar features of git. And sadly very few go to change these settings.
I recommend GE to everyone because it exposes git features in GUI form without interpretations or restrictions as closely as possible meaning GE embraces git as opposed to crippling it. I am voting with both hands for continuing to embrace git as one of the GE pillar features. 🕊

@pmiossec
Copy link
Member

GE scares you with dialogs about history rewrite which is one of the pillar features of git.

The perfect thing would have been to display this message only when the commit has been already pushed.

At least we could update the warning message to explain that.

@RussKie

This comment has been minimized.

@RussKie
Copy link
Member

RussKie commented Sep 19, 2019

The perfect thing would have been to display this message only when the commit has been already pushed.

How do you see it implemented?

@RussKie
Copy link
Member

RussKie commented Sep 19, 2019

The subject must match.

If subject must match to the dot, it is not quite unreasonable to make the textbox readonly to indicate it to the user that it isn't something they should be changing.
However to allow the use-case where a user may change their mind and do another type of commit (i.e. not a fixup), we need to make the textbox editable.

If we leave the textbox editable for the special types of commits (i.e. fixup) our users may be left confused, change text and then wonder why they didn't get a fixup commit they wanted.

I'm speaking from first-hand experience where I had/have to teach engineers (including smart senior level devs and architects) about these git commands, and a lot of time I need(ed) to hold their hands with git. The same way others held my hand when I was learning git.

@mrexodia
Copy link
Contributor

mrexodia commented Sep 19, 2019 via email

@gerhardol

This comment has been minimized.

@RussKie

This comment has been minimized.

@RussKie
Copy link
Member

RussKie commented Sep 19, 2019 via email

@pmiossec
Copy link
Member

I also don't remember but perhaps #3745 could help. Especially, #3745 (comment)

@mstv mstv force-pushed the feature/unblock_commit_message branch from ad1b999 to f163cc3 Compare September 19, 2019 23:15
@mstv mstv changed the title WIP: Unblock special commit message Unblock special commit message Sep 19, 2019
@mstv
Copy link
Member Author

mstv commented Sep 19, 2019

Added tooltip translation and squashed.

GitUI/CommandsDialogs/FormCommit.cs Outdated Show resolved Hide resolved
GitUI/CommandsDialogs/FormCommit.Designer.cs Outdated Show resolved Hide resolved
GitUI/CommandsDialogs/FormCommit.cs Outdated Show resolved Hide resolved
GitUI/CommandsDialogs/FormCommit.cs Outdated Show resolved Hide resolved
GitUI/CommandsDialogs/FormCommit.cs Outdated Show resolved Hide resolved
GitUI/CommandsDialogs/FormCommit.Designer.cs Outdated Show resolved Hide resolved
@RussKie RussKie added the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Sep 22, 2019
@ghost ghost removed the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Sep 22, 2019
Copy link
Member

@RussKie RussKie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

GitUI/CommandsDialogs/FormCommit.cs Outdated Show resolved Hide resolved
GitUI/CommandsDialogs/FormCommit.cs Outdated Show resolved Hide resolved
@RussKie RussKie added 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity and removed 👓 status: needs review labels Sep 25, 2019
@mstv mstv force-pushed the feature/unblock_commit_message branch from 63871ae to e41e88a Compare September 25, 2019 19:12
@ghost ghost removed the 📭 needs: author feedback More info/confirmation awaited from OP; issues typically get closed after 30 days of inactivity label Sep 25, 2019
@ghost
Copy link

ghost commented Sep 25, 2019

Hello @mstv!

Because this pull request has the status: auto merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 26d98ea into gitextensions:master Sep 25, 2019
@mstv
Copy link
Member Author

mstv commented Sep 25, 2019

Sorry for merging too early, I expected that the msftbot was configured to wait for at least one approval.
@RussKie, can the msftbot's default behavior be configured? Or must I always type something like
merge 1 day after approval by @RussKie or after two approvals

@RussKie
Copy link
Member

RussKie commented Sep 26, 2019

Yes, you need to write something like "@msftbot merge if @desired_user_name approves"
Have a look at bot's guide

@mstv
Copy link
Member Author

mstv commented Sep 26, 2019

Have a look at bot's guide

I had; and I had the hope the instantly handled "status: auto merge" could be tamed - by the repo admin at least.
When you used it, it wrote something like you had reset its configuration. That's why I thought the default behavior could be configured.
Perhaps it can be added to the PR template.

@mstv mstv deleted the feature/unblock_commit_message branch September 26, 2019 18:17
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants