git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 9/9] gitk: default select reset hard in dialog

From
JLJens Lideström <jens@lidestrom.se>
Date
Jun 28, 2023, 07:16 UTC
Message-ID
<b2e0d8fa1b54d9dbc6a0831d53acb85f@lidestrom.se>
In-Reply-To
<e74cc1b3-8459-101f-4613-17df0f5d69e3@kdbg.org>
> I would prefer to keep the default at "mixed" mode, set the focus on 
> the
> radio button to make it easy to switch to "hard" mode by hitting the
> Down arrow key, and then make it so that Enter triggers the OK button.

That indeed sounds better! Safer but still convenient. I'll change the solution to this.

I noticed that some dialogues have a key bind to close with success using Enter.

/Jens
On 2023-06-28 07:46, Johannes Sixt wrote:
Show 47 quoted lines
> Am 27.06.23 um 16:41 schrieb Jens Lidestrom via GitGitGadget:
>> From: Jens Lidestrom <jens@lidestrom.se>
>> 
>> Reset hard is dangerous but also the most common reset type, and not
>> having it pre-selected in the dialog is annoying to users.
> 
> I agree that the operation of the Reset dialog is clumsy before this
> series. However, this patch together with the previous patch turns it
> into a foot gun. It becomes far too easy to destroy uncommitted work.
> 
> I would prefer to keep the default at "mixed" mode, set the focus on 
> the
> radio button to make it easy to switch to "hard" mode by hitting the
> Down arrow key, and then make it so that Enter triggers the OK button.
> 
>> It is also less dangerous in the GUI where there is a confirmation
>> dialog. Also, dangling commits remain in the GUI and can be recovered.
> 
> The problem with "hard" mode are not the commits. The real danger is
> that it blows away uncommitted changes. Besides of that, I do not
> consider this UI a confirmation dialog.
> 
> -- Hannes
> 
>> 
>> Signed-off-by: Jens Lidestrom <jens@lidestrom.se>
>> ---
>>  gitk-git/gitk | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/gitk-git/gitk b/gitk-git/gitk
>> index 9d93053e360..5b0a0ea46be 100755
>> --- a/gitk-git/gitk
>> +++ b/gitk-git/gitk
>> @@ -9906,7 +9906,9 @@ proc resethead {reset_target_id} {
>>          [mc "Reset branch %s to %s?" $mainhead [commit_name 
>> $reset_target_id 1]]
>>      pack $w.m -side top -fill x -padx 20 -pady 20
>>      ${NS}::labelframe $w.f -text [mc "Reset type:"]
>> -    set resettype mixed
>> +    # Reset hard is dangerous but also the most common reset type, 
>> and not
>> +    # having it pre-selected in the dialog is annoying to users.
>> +    set resettype hard
>>      ${NS}::radiobutton $w.f.soft -value soft -variable resettype \
>>          -text [mc "Soft: Leave working tree and index untouched"]
>>      grid $w.f.soft -sticky w
Previous: Johannes SixtNext: Jens Lideström
Message 17 of 42 in “gitk: improve keyboard support”
  1. 0/9 gitk: improve keyboard supportJens Lidestrom via GitGitGadget, Jun 27, 2023
  2. 1/9 gitk: add procedures to get commit info from selected rowJens Lidestrom via GitGitGadget, Jun 27, 2023
  3. 2/9 gitk: use term "current branch" in guiJens Lidestrom via GitGitGadget, Jun 27, 2023
  4. 3/9 gitk: add keyboard bind for resetJens Lidestrom via GitGitGadget, Jun 27, 2023
  5. 4/9 gitk: show branch name in reset dialogJens Lidestrom via GitGitGadget, Jun 27, 2023
  6. 5/9 gitk: add keyboard bind for checkoutJens Lidestrom via GitGitGadget, Jun 27, 2023
  7. Jens LideströmJul 2, 2023
  8. 6/9 gitk: add keyboard bind for create and remove branchJens Lidestrom via GitGitGadget, Jun 27, 2023
  9. Johannes SixtJun 28, 2023
  10. Jens LideströmJun 28, 2023
  11. Johannes SixtJun 28, 2023
  12. Jens LideströmJul 2, 2023
  13. 7/9 gitk: add keyboard bind to cherry-pickJens Lidestrom via GitGitGadget, Jun 27, 2023
  14. 8/9 gitk: focus ok button in reset dialogJens Lidestrom via GitGitGadget, Jun 27, 2023
  15. 9/9 gitk: default select reset hard in dialogJens Lidestrom via GitGitGadget, Jun 27, 2023
  16. Johannes SixtJun 28, 2023
  17. Jens LideströmJun 28, 2023
  18. Jens LideströmJul 2, 2023
  19. Johannes SixtJun 28, 2023
  20. Jens LideströmJun 28, 2023
  21. Jens LideströmJun 28, 2023
  22. Johannes SixtJun 28, 2023
  23. Jens LideströmJul 2, 2023
  24. 00/10 gitk: improve keyboard supportJens Lidestrom via GitGitGadget, Jul 3, 2023
  25. 01/10 gitk: add procedures to get commit info from selected rowJens Lidestrom via GitGitGadget, Jul 3, 2023
  26. 02/10 gitk: use term "current branch" in guiJens Lidestrom via GitGitGadget, Jul 3, 2023
  27. 03/10 gitk: add keyboard bind for reset commandJens Lidestrom via GitGitGadget, Jul 3, 2023
  28. 04/10 gitk: show branch name in reset dialogJens Lidestrom via GitGitGadget, Jul 3, 2023
  29. 06/10 gitk: add keyboard bind for remove branch commandJens Lidestrom via GitGitGadget, Jul 3, 2023
  30. Johannes SixtJul 5, 2023
  31. Jens LideströmJul 8, 2023
  32. 05/10 gitk: add keyboard bind for checkout commandJens Lidestrom via GitGitGadget, Jul 3, 2023
  33. Johannes SixtJul 5, 2023
  34. Jens LideströmJul 8, 2023
  35. 07/10 gitk: add keyboard bind for cherry-pick commandJens Lidestrom via GitGitGadget, Jul 3, 2023
  36. Johannes SixtJul 5, 2023
  37. Jens LideströmJul 8, 2023
  38. 08/10 gitk: add keyboard bind for create branch commandJens Lidestrom via GitGitGadget, Jul 3, 2023
  39. Johannes SixtJul 5, 2023
  40. 09/10 gitk: improve keyboard convenience in reset dialogJens Lidestrom via GitGitGadget, Jul 3, 2023
  41. Johannes SixtJul 5, 2023
  42. 10/10 gitk: allow checkout of remote branchJens Lidestrom via GitGitGadget, Jul 3, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.