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

Re: [PATCH 1/2] git-gui: convert new/amend commit radiobutton to checketton

From
Pratyush Yadav <me@yadavpratyush.com>
Date
Sep 13, 2019, 17:14 UTC
Message-ID
<20190913171413.ofdlnwpavh6lp7l2@yadavpratyush.com>
In-Reply-To
<CAKPyHN1YNWbZoJNTnGN4_Du+3Scf0bEpAYJyR_mB8X2fkfAwLg@mail.gmail.com>
On 12/09/19 09:35PM, Bert Wesarg wrote:
Show 38 quoted lines
> On Wed, Sep 11, 2019 at 10:15 PM Pratyush Yadav <me@yadavpratyush.com> wrote:
> >
> > Typo in the subject. s/checketton/checkbutton/
> >
> > On 05/09/19 10:09PM, Bert Wesarg wrote:
> > > diff --git a/lib/index.tcl b/lib/index.tcl
> > > index b588db1..e07b7a3 100644
> > > --- a/lib/index.tcl
> > > +++ b/lib/index.tcl
> > > @@ -466,19 +466,19 @@ proc do_revert_selection {} {
> > >  }
> > >
> > >  proc do_select_commit_type {} {
> > > -     global commit_type selected_commit_type
> > > +     global commit_type commit_type_is_amend
> > >
> > > -     if {$selected_commit_type eq {new}
> > > +     if {$commit_type_is_amend == 0
> > >               && [string match amend* $commit_type]} {
> > >               create_new_commit
> > > -     } elseif {$selected_commit_type eq {amend}
> > > +     } elseif {$commit_type_is_amend == 1
> > >               && ![string match amend* $commit_type]} {
> >
> > Not exactly related to your change, but shouldn't these "string match
> > amend*" in the two ifs be assertions instead of checks? If
> > $commit_type_is_amend == 0, then $commit_type should _always_ be amend*,
> > and if $commit_type_is_amend == 1, then $commit_type should _never_ be
> > amend*.
> >
> 
> AFAIU this now is, that the former 'selected_commit_type' was also
> used as a request for the commit type, you set it to the desired one,
> than call do_select_commit_type, it will than check if a state change
> actually happen, and if it was to request an amend, which may also
> fail, it goes back to !amend.
> 
> Thus its not an assert.

Thanks for explaining. While I'm not the biggest fan of this design, let's just keep it this way for now.

-- 
Regards,
Pratyush Yadav
Previous: Bert WesargNext: Bert Wesarg
Message 23 of 24 in “git-gui: convert new/amend commit radiobutton to checketton”
  1. 1/2 git-gui: convert new/amend commit radiobutton to checkettonBert Wesarg, Sep 5, 2019
  2. 2/2 git-gui: add hotkey to toggle "Amend Last Commit" check button/menuBert Wesarg, Sep 5, 2019
  3. Pratyush YadavSep 11, 2019
  4. Birger Skogeng PedersenSep 12, 2019
  5. Pratyush YadavSep 12, 2019
  6. git-gui: add hotkey to toggle "Amend Last Commit"Birger Skogeng Pedersen, Sep 12, 2019
  7. Pratyush YadavSep 13, 2019
  8. git-gui: add hotkey to toggle "Amend Last Commit"Birger Skogeng Pedersen, Sep 13, 2019
  9. Birger Skogeng PedersenSep 13, 2019
  10. Pratyush YadavSep 13, 2019
  11. Birger Skogeng PedersenSep 14, 2019
  12. git-gui: add hotkey to toggle "Amend Last Commit"Birger Skogeng Pedersen, Sep 14, 2019
  13. Pratyush YadavSep 14, 2019
  14. Birger Skogeng PedersenSep 16, 2019
  15. Marc BranchaudSep 12, 2019
  16. Philip OakleySep 12, 2019
  17. Birger Skogeng PedersenSep 13, 2019
  18. Marc BranchaudSep 13, 2019
  19. Pratyush YadavSep 13, 2019
  20. Pratyush YadavSep 5, 2019
  21. Pratyush YadavSep 11, 2019
  22. Bert WesargSep 12, 2019
  23. Pratyush YadavSep 13, 2019
  24. Bert WesargSep 12, 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.