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

Re: [PATCH 2/3] git-gui: Add the ability to revert selected lines

From
Pratyush Yadav <me@yadavpratyush.com>
Date
Aug 21, 2019, 21:48 UTC
Message-ID
<20190821214829.2dzat2quo3h2s3z2@localhost.localdomain>
In-Reply-To
<93095b5a-6e15-ce4a-eb9b-22f9528312e1@kdbg.org>
On 20/08/19 11:19PM, Johannes Sixt wrote:
Show 16 quoted lines
> Am 20.08.19 um 21:29 schrieb Pratyush Yadav:
> > On 20/08/19 09:21PM, Johannes Sixt wrote:
> >> Please don't do this. This confirmation dialog is unacceptable in my
> >> workflow. I use reversals of hunks and lines frequently, almost like a
> >> secondary code editor. My safety net is the undo function of the IDE,
> >> which works across reloads that are triggered by these external edits.
> >> These confirmations get in the way.
> >  
> > But not everyone uses an IDE. I use vim and it does not have any such 
> > undo feature that works across reloads. Not one I'm aware of anyway. It 
> > is absolutely necessary IMO to ask the user for confirmation before 
> > deleting their work, unless we have a built in safety net.
> 
> But you have a safety net built-in: Commit the work, then do the
> reversals in amend-mode. Now you can recover old state to your heart's
> content. That's recommended anyway if stuff is potentially precious.

I suppose we disagree on this. I feel very uncomfortable removing the prompt by default, because it is pretty easy to mis-click revert instead of stage, and all of a sudden lots of your work is gone. It is a pretty common workflow to make some changes, stage some hunks in one commit and then some others in the next. Not everyone (including me) will first commit changes, then amend them, especially if they are not that big or complicated. Accidentally deleting your work, no matter how small, because of a misclick sucks.

So, I feel strongly in favor of keeping the prompt on by default. I will add a config option to disable it for people who are willing to accept misclicks. That keeps both sides of the argument happy. You just have to disable it once in your global config and you're good to go.

Show 7 quoted lines
> > So how about adding a config option that allows you to disable the 
> > confirmation dialog? Sounds like a reasonable compromise to me.
> 
> That's always an option. Needless to say that I'd prefer it off by
> default; I don't need three safety nets.
> 
> -- Hannes
-- 
Regards,
Pratyush Yadav
Previous: Johannes SixtNext: Johannes Schindelin
Message 7 of 49 in “git-gui: Add ability to revert selected hunks and lines”
  1. 0/3 git-gui: Add ability to revert selected hunks and linesPratyush Yadav, Aug 19, 2019
  2. 1/3 git-gui: Move revert confirmation dialog creation to separate functionPratyush Yadav, Aug 19, 2019
  3. 2/3 git-gui: Add the ability to revert selected linesPratyush Yadav, Aug 19, 2019
  4. Johannes SixtAug 20, 2019
  5. Pratyush YadavAug 20, 2019
  6. Johannes SixtAug 20, 2019
  7. Pratyush YadavAug 21, 2019
  8. Johannes SchindelinAug 23, 2019
  9. Junio C HamanoAug 23, 2019
  10. Pratyush YadavAug 23, 2019
  11. Johannes SixtAug 23, 2019
  12. 3/3 git-gui: Add the ability to revert selected hunkPratyush Yadav, Aug 19, 2019
  13. Junio C HamanoAug 20, 2019
  14. Pratyush YadavAug 20, 2019
  15. Bert WesargAug 21, 2019
  16. Pratyush YadavAug 21, 2019
  17. 0/4 git-gui: Add ability to revert selected hunks and linesPratyush Yadav, Aug 22, 2019
  18. 1/4 git-gui: Move revert confirmation dialog creation to separate functionPratyush Yadav, Aug 22, 2019
  19. 2/4 git-gui: Add option to disable the revert confirmation promptPratyush Yadav, Aug 22, 2019
  20. 3/4 git-gui: Add the ability to revert selected linesPratyush Yadav, Aug 22, 2019
  21. Bert WesargAug 23, 2019
  22. Pratyush YadavAug 23, 2019
  23. 4/4 git-gui: Add the ability to revert selected hunkPratyush Yadav, Aug 22, 2019
  24. Junio C HamanoAug 22, 2019
  25. Pratyush YadavAug 22, 2019
  26. Bert WesargAug 23, 2019
  27. Junio C HamanoAug 23, 2019
  28. Pratyush YadavAug 23, 2019
  29. David AguilarAug 23, 2019
  30. Bert WesargAug 24, 2019
  31. Bert WesargAug 24, 2019
  32. David AguilarAug 24, 2019
  33. Johannes SixtAug 24, 2019
  34. 0/4 git-gui: Add ability to revert selected hunks and linesPratyush Yadav, Aug 28, 2019
  35. 1/4 git-gui: allow reverting selected linesPratyush Yadav, Aug 28, 2019
  36. 2/4 git-gui: allow reverting selected hunkPratyush Yadav, Aug 28, 2019
  37. 3/4 git-gui: return early when patch fails to applyPratyush Yadav, Aug 28, 2019
  38. 4/4 git-gui: allow undoing last revertPratyush Yadav, Aug 28, 2019
  39. Bert WesargOct 21, 2019
  40. Pratyush YadavOct 21, 2019
  41. Bert WesargOct 22, 2019
  42. Pratyush YadavOct 23, 2019
  43. Johannes SixtOct 21, 2019
  44. Bert WesargOct 22, 2019
  45. Pratyush YadavOct 23, 2019
  46. Pratyush YadavSep 10, 2019
  47. Johannes SixtSep 10, 2019
  48. Bert WesargSep 12, 2019
  49. Pratyush YadavAug 25, 2019

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.