{"thread":{"id":"51838","subject":"[PATCH] git-gui: convert new/amend commit radiobutton to checketton","startedAt":"2019-09-12T19:44:26Z","lastAt":"2019-09-13T20:19:58Z","messageCount":5,"participants":["Bert Wesarg","Philip Oakley","Pratyush Yadav"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"382253","messageId":"41ebf78fbe8af587c739c08aa6f20cf76c602775.1568317431.git.bert.wesarg@googlemail.com","threadId":"51838","inReplyTo":null,"subject":"[PATCH] git-gui: convert new/amend commit radiobutton to checketton","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2019-09-12T19:44:19Z","receivedAt":"2019-09-12T19:44:26Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Its a bi-state anyway and also safes one line in the menu.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n git-gui.sh          | 36 +++++++++---------------------------\n lib/checkout_op.tcl |  6 +++---\n lib/commit.tcl      |  4 ++--\n lib/index.tcl       |  8 ++++----\n 4 files changed, 18 insertions(+), 36 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 5bc21b8..80a07d5 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -1341,6 +1341,7 @@ set HEAD {}\n set PARENT {}\n set MERGE_HEAD [list]\n set commit_type {}\n+set commit_type_is_amend 0\n set empty_tree {}\n set current_branch {}\n set is_detached 0\n@@ -1348,7 +1349,6 @@ set current_diff_path {}\n set is_3way_diff 0\n set is_submodule_diff 0\n set is_conflict_diff 0\n-set selected_commit_type new\n set diff_empty_count 0\n \n set nullid \"0000000000000000000000000000000000000000\"\n@@ -1435,7 +1435,7 @@ proc PARENT {} {\n }\n \n proc force_amend {} {\n-\tglobal selected_commit_type\n+\tglobal commit_type_is_amend\n \tglobal HEAD PARENT MERGE_HEAD commit_type\n \n \trepository_state newType newHEAD newMERGE_HEAD\n@@ -1444,7 +1444,7 @@ proc force_amend {} {\n \tset MERGE_HEAD $newMERGE_HEAD\n \tset commit_type $newType\n \n-\tset selected_commit_type amend\n+\tset commit_type_is_amend 1\n \tdo_select_commit_type\n }\n \n@@ -2828,19 +2828,10 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {\n \tmenu .mbar.commit\n \n \tif {![is_enabled nocommit]} {\n-\t\t.mbar.commit add radiobutton \\\n-\t\t\t-label [mc \"New Commit\"] \\\n-\t\t\t-command do_select_commit_type \\\n-\t\t\t-variable selected_commit_type \\\n-\t\t\t-value new\n-\t\tlappend disable_on_lock \\\n-\t\t\t[list .mbar.commit entryconf [.mbar.commit index last] -state]\n-\n-\t\t.mbar.commit add radiobutton \\\n+\t\t.mbar.commit add checkbutton \\\n \t\t\t-label [mc \"Amend Last Commit\"] \\\n-\t\t\t-command do_select_commit_type \\\n-\t\t\t-variable selected_commit_type \\\n-\t\t\t-value amend\n+\t\t\t-variable commit_type_is_amend \\\n+\t\t\t-command do_select_commit_type\n \t\tlappend disable_on_lock \\\n \t\t\t[list .mbar.commit entryconf [.mbar.commit index last] -state]\n \n@@ -3313,18 +3304,10 @@ set ui_comm .vpane.lower.commarea.buffer.frame.t\n set ui_coml .vpane.lower.commarea.buffer.header.l\n \n if {![is_enabled nocommit]} {\n-\t${NS}::radiobutton .vpane.lower.commarea.buffer.header.new \\\n-\t\t-text [mc \"New Commit\"] \\\n-\t\t-command do_select_commit_type \\\n-\t\t-variable selected_commit_type \\\n-\t\t-value new\n-\tlappend disable_on_lock \\\n-\t\t[list .vpane.lower.commarea.buffer.header.new conf -state]\n-\t${NS}::radiobutton .vpane.lower.commarea.buffer.header.amend \\\n+\t${NS}::checkbutton .vpane.lower.commarea.buffer.header.amend \\\n \t\t-text [mc \"Amend Last Commit\"] \\\n-\t\t-command do_select_commit_type \\\n-\t\t-variable selected_commit_type \\\n-\t\t-value amend\n+\t\t-variable commit_type_is_amend \\\n+\t\t-command do_select_commit_type\n \tlappend disable_on_lock \\\n \t\t[list .vpane.lower.commarea.buffer.header.amend conf -state]\n }\n@@ -3349,7 +3332,6 @@ pack $ui_coml -side left -fill x\n \n if {![is_enabled nocommit]} {\n \tpack .vpane.lower.commarea.buffer.header.amend -side right\n-\tpack .vpane.lower.commarea.buffer.header.new -side right\n }\n \n textframe .vpane.lower.commarea.buffer.frame\ndiff --git a/lib/checkout_op.tcl b/lib/checkout_op.tcl\nindex 9e7412c..a522829 100644\n--- a/lib/checkout_op.tcl\n+++ b/lib/checkout_op.tcl\n@@ -389,7 +389,7 @@ $err\n }\n \n method _after_readtree {} {\n-\tglobal selected_commit_type commit_type HEAD MERGE_HEAD PARENT\n+\tglobal commit_type HEAD MERGE_HEAD PARENT\n \tglobal current_branch is_detached\n \tglobal ui_comm\n \n@@ -490,12 +490,12 @@ method _update_repo_state {} {\n \t#    amend mode our file lists are accurate and we can avoid\n \t#    the rescan.\n \t#\n-\tglobal selected_commit_type commit_type HEAD MERGE_HEAD PARENT\n+\tglobal commit_type_is_amend commit_type HEAD MERGE_HEAD PARENT\n \tglobal ui_comm\n \n \tunlock_index\n \tset name [_name $this]\n-\tset selected_commit_type new\n+\tset commit_type_is_amend 0\n \tif {[string match amend* $commit_type]} {\n \t\t$ui_comm delete 0.0 end\n \t\t$ui_comm edit reset\ndiff --git a/lib/commit.tcl b/lib/commit.tcl\nindex 83620b7..384f18f 100644\n--- a/lib/commit.tcl\n+++ b/lib/commit.tcl\n@@ -327,7 +327,7 @@ proc commit_writetree {curHEAD msg_p} {\n proc commit_committree {fd_wt curHEAD msg_p} {\n \tglobal HEAD PARENT MERGE_HEAD commit_type commit_author\n \tglobal current_branch\n-\tglobal ui_comm selected_commit_type\n+\tglobal ui_comm commit_type_is_amend\n \tglobal file_states selected_paths rescan_active\n \tglobal repo_config\n \tglobal env\n@@ -461,8 +461,8 @@ A rescan will be automatically started now.\n \n \t# -- Update in memory status\n \t#\n-\tset selected_commit_type new\n \tset commit_type normal\n+\tset commit_type_is_amend 0\n \tset HEAD $cmt_id\n \tset PARENT $cmt_id\n \tset MERGE_HEAD [list]\ndiff --git a/lib/index.tcl b/lib/index.tcl\nindex b588db1..e07b7a3 100644\n--- a/lib/index.tcl\n+++ b/lib/index.tcl\n@@ -466,19 +466,19 @@ proc do_revert_selection {} {\n }\n \n proc do_select_commit_type {} {\n-\tglobal commit_type selected_commit_type\n+\tglobal commit_type commit_type_is_amend\n \n-\tif {$selected_commit_type eq {new}\n+\tif {$commit_type_is_amend == 0\n \t\t&& [string match amend* $commit_type]} {\n \t\tcreate_new_commit\n-\t} elseif {$selected_commit_type eq {amend}\n+\t} elseif {$commit_type_is_amend == 1\n \t\t&& ![string match amend* $commit_type]} {\n \t\tload_last_commit\n \n \t\t# The amend request was rejected...\n \t\t#\n \t\tif {![string match amend* $commit_type]} {\n-\t\t\tset selected_commit_type new\n+\t\t\tset commit_type_is_amend 0\n \t\t}\n \t}\n }\n-- \n2.21.0.789.ga095d9d866\n\n"},{"id":"382274","messageId":"b3f1cd2b-7462-89fd-ff2d-9e53da286027@iee.email","threadId":"51838","inReplyTo":"41ebf78fbe8af587c739c08aa6f20cf76c602775.1568317431.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH] git-gui: convert new/amend commit radiobutton to checketton","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2019-09-12T22:15:59Z","receivedAt":"2019-09-12T22:16:02Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 12/09/2019 20:44, Bert Wesarg wrote:\n> Its a bi-state anyway and also safes one line in the menu.\ns/safes/saves/  ?\n\n>\n> Signed-off-by: Bert Wesarg<bert.wesarg@googlemail.com>\n> ---\nPhilip\n"},{"id":"382283","messageId":"a2026a3d310f90b70a191e2c24106d600195d2b1.1568354429.git.bert.wesarg@googlemail.com","threadId":"51838","inReplyTo":"b3f1cd2b-7462-89fd-ff2d-9e53da286027@iee.email","subject":"[PATCH] git-gui: convert new/amend commit radiobutton to checketton","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2019-09-13T06:02:30Z","receivedAt":"2019-09-13T06:02:36Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Its a bi-state anyway and also saves one line in the menu.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n git-gui.sh          | 36 +++++++++---------------------------\n lib/checkout_op.tcl |  6 +++---\n lib/commit.tcl      |  4 ++--\n lib/index.tcl       |  8 ++++----\n 4 files changed, 18 insertions(+), 36 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 5bc21b8..80a07d5 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -1341,6 +1341,7 @@ set HEAD {}\n set PARENT {}\n set MERGE_HEAD [list]\n set commit_type {}\n+set commit_type_is_amend 0\n set empty_tree {}\n set current_branch {}\n set is_detached 0\n@@ -1348,7 +1349,6 @@ set current_diff_path {}\n set is_3way_diff 0\n set is_submodule_diff 0\n set is_conflict_diff 0\n-set selected_commit_type new\n set diff_empty_count 0\n \n set nullid \"0000000000000000000000000000000000000000\"\n@@ -1435,7 +1435,7 @@ proc PARENT {} {\n }\n \n proc force_amend {} {\n-\tglobal selected_commit_type\n+\tglobal commit_type_is_amend\n \tglobal HEAD PARENT MERGE_HEAD commit_type\n \n \trepository_state newType newHEAD newMERGE_HEAD\n@@ -1444,7 +1444,7 @@ proc force_amend {} {\n \tset MERGE_HEAD $newMERGE_HEAD\n \tset commit_type $newType\n \n-\tset selected_commit_type amend\n+\tset commit_type_is_amend 1\n \tdo_select_commit_type\n }\n \n@@ -2828,19 +2828,10 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {\n \tmenu .mbar.commit\n \n \tif {![is_enabled nocommit]} {\n-\t\t.mbar.commit add radiobutton \\\n-\t\t\t-label [mc \"New Commit\"] \\\n-\t\t\t-command do_select_commit_type \\\n-\t\t\t-variable selected_commit_type \\\n-\t\t\t-value new\n-\t\tlappend disable_on_lock \\\n-\t\t\t[list .mbar.commit entryconf [.mbar.commit index last] -state]\n-\n-\t\t.mbar.commit add radiobutton \\\n+\t\t.mbar.commit add checkbutton \\\n \t\t\t-label [mc \"Amend Last Commit\"] \\\n-\t\t\t-command do_select_commit_type \\\n-\t\t\t-variable selected_commit_type \\\n-\t\t\t-value amend\n+\t\t\t-variable commit_type_is_amend \\\n+\t\t\t-command do_select_commit_type\n \t\tlappend disable_on_lock \\\n \t\t\t[list .mbar.commit entryconf [.mbar.commit index last] -state]\n \n@@ -3313,18 +3304,10 @@ set ui_comm .vpane.lower.commarea.buffer.frame.t\n set ui_coml .vpane.lower.commarea.buffer.header.l\n \n if {![is_enabled nocommit]} {\n-\t${NS}::radiobutton .vpane.lower.commarea.buffer.header.new \\\n-\t\t-text [mc \"New Commit\"] \\\n-\t\t-command do_select_commit_type \\\n-\t\t-variable selected_commit_type \\\n-\t\t-value new\n-\tlappend disable_on_lock \\\n-\t\t[list .vpane.lower.commarea.buffer.header.new conf -state]\n-\t${NS}::radiobutton .vpane.lower.commarea.buffer.header.amend \\\n+\t${NS}::checkbutton .vpane.lower.commarea.buffer.header.amend \\\n \t\t-text [mc \"Amend Last Commit\"] \\\n-\t\t-command do_select_commit_type \\\n-\t\t-variable selected_commit_type \\\n-\t\t-value amend\n+\t\t-variable commit_type_is_amend \\\n+\t\t-command do_select_commit_type\n \tlappend disable_on_lock \\\n \t\t[list .vpane.lower.commarea.buffer.header.amend conf -state]\n }\n@@ -3349,7 +3332,6 @@ pack $ui_coml -side left -fill x\n \n if {![is_enabled nocommit]} {\n \tpack .vpane.lower.commarea.buffer.header.amend -side right\n-\tpack .vpane.lower.commarea.buffer.header.new -side right\n }\n \n textframe .vpane.lower.commarea.buffer.frame\ndiff --git a/lib/checkout_op.tcl b/lib/checkout_op.tcl\nindex 9e7412c..a522829 100644\n--- a/lib/checkout_op.tcl\n+++ b/lib/checkout_op.tcl\n@@ -389,7 +389,7 @@ $err\n }\n \n method _after_readtree {} {\n-\tglobal selected_commit_type commit_type HEAD MERGE_HEAD PARENT\n+\tglobal commit_type HEAD MERGE_HEAD PARENT\n \tglobal current_branch is_detached\n \tglobal ui_comm\n \n@@ -490,12 +490,12 @@ method _update_repo_state {} {\n \t#    amend mode our file lists are accurate and we can avoid\n \t#    the rescan.\n \t#\n-\tglobal selected_commit_type commit_type HEAD MERGE_HEAD PARENT\n+\tglobal commit_type_is_amend commit_type HEAD MERGE_HEAD PARENT\n \tglobal ui_comm\n \n \tunlock_index\n \tset name [_name $this]\n-\tset selected_commit_type new\n+\tset commit_type_is_amend 0\n \tif {[string match amend* $commit_type]} {\n \t\t$ui_comm delete 0.0 end\n \t\t$ui_comm edit reset\ndiff --git a/lib/commit.tcl b/lib/commit.tcl\nindex 83620b7..384f18f 100644\n--- a/lib/commit.tcl\n+++ b/lib/commit.tcl\n@@ -327,7 +327,7 @@ proc commit_writetree {curHEAD msg_p} {\n proc commit_committree {fd_wt curHEAD msg_p} {\n \tglobal HEAD PARENT MERGE_HEAD commit_type commit_author\n \tglobal current_branch\n-\tglobal ui_comm selected_commit_type\n+\tglobal ui_comm commit_type_is_amend\n \tglobal file_states selected_paths rescan_active\n \tglobal repo_config\n \tglobal env\n@@ -461,8 +461,8 @@ A rescan will be automatically started now.\n \n \t# -- Update in memory status\n \t#\n-\tset selected_commit_type new\n \tset commit_type normal\n+\tset commit_type_is_amend 0\n \tset HEAD $cmt_id\n \tset PARENT $cmt_id\n \tset MERGE_HEAD [list]\ndiff --git a/lib/index.tcl b/lib/index.tcl\nindex b588db1..e07b7a3 100644\n--- a/lib/index.tcl\n+++ b/lib/index.tcl\n@@ -466,19 +466,19 @@ proc do_revert_selection {} {\n }\n \n proc do_select_commit_type {} {\n-\tglobal commit_type selected_commit_type\n+\tglobal commit_type commit_type_is_amend\n \n-\tif {$selected_commit_type eq {new}\n+\tif {$commit_type_is_amend == 0\n \t\t&& [string match amend* $commit_type]} {\n \t\tcreate_new_commit\n-\t} elseif {$selected_commit_type eq {amend}\n+\t} elseif {$commit_type_is_amend == 1\n \t\t&& ![string match amend* $commit_type]} {\n \t\tload_last_commit\n \n \t\t# The amend request was rejected...\n \t\t#\n \t\tif {![string match amend* $commit_type]} {\n-\t\t\tset selected_commit_type new\n+\t\t\tset commit_type_is_amend 0\n \t\t}\n \t}\n }\n-- \n2.21.0.789.ga095d9d866\n\n"},{"id":"382324","messageId":"20190913194911.3vwki4wa4jd3capr@yadavpratyush.com","threadId":"51838","inReplyTo":"a2026a3d310f90b70a191e2c24106d600195d2b1.1568354429.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH] git-gui: convert new/amend commit radiobutton to checketton","fromName":"Pratyush Yadav","fromEmail":"me@yadavpratyush.com","sentAt":"2019-09-13T19:49:11Z","receivedAt":"2019-09-13T19:49:16Z","isPatch":true,"sender":{"key":"me@yadavpratyush.com","avatar":"https://avatars.githubusercontent.com/u/8817931?v=4"},"body":"You missed fixing the typo in the subject. s/checketton/checkbutton/. \nBut no need to send a re-roll for that. I can fix it locally.\n\nOther than that, LGTM. Thanks, will queue.\n\nOn 13/09/19 08:02AM, Bert Wesarg wrote:\n> Its a bi-state anyway and also saves one line in the menu.\n> \n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n-- \nRegards,\nPratyush Yadav\n"},{"id":"382330","messageId":"CAKPyHN0pSpX6-5TTNZWNshMKa2Bfj3_tujn=HbLNSzBmeRfrYw@mail.gmail.com","threadId":"51838","inReplyTo":"20190913194911.3vwki4wa4jd3capr@yadavpratyush.com","subject":"Re: [PATCH] git-gui: convert new/amend commit radiobutton to checketton","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2019-09-13T20:19:45Z","receivedAt":"2019-09-13T20:19:58Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Fri, Sep 13, 2019 at 9:49 PM Pratyush Yadav <me@yadavpratyush.com> wrote:\n>\n> You missed fixing the typo in the subject. s/checketton/checkbutton/.\n> But no need to send a re-roll for that. I can fix it locally.\n\nthanks, I also fixed that locally, but again, it slipped thru in the\npatch mail. Still don't know why this happened.\n\nBest,\nBert\n\n>\n> Other than that, LGTM. Thanks, will queue.\n>\n> On 13/09/19 08:02AM, Bert Wesarg wrote:\n> > Its a bi-state anyway and also saves one line in the menu.\n> >\n> > Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>\n> --\n> Regards,\n> Pratyush Yadav\n"}]}