* [PATCH] git-gui: convert new/amend commit radiobutton to checketton
@ 2019-09-12 19:44 Bert Wesarg
2019-09-12 22:15 ` Philip Oakley
0 siblings, 1 reply; 5+ messages in thread
From: Bert Wesarg @ 2019-09-12 19:44 UTC (permalink / raw)
To: git; +Cc: Bert Wesarg, Pratyush Yadav, Birger Skogeng Pedersen
Its a bi-state anyway and also safes one line in the menu.
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
git-gui.sh | 36 +++++++++---------------------------
lib/checkout_op.tcl | 6 +++---
lib/commit.tcl | 4 ++--
lib/index.tcl | 8 ++++----
4 files changed, 18 insertions(+), 36 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index 5bc21b8..80a07d5 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1341,6 +1341,7 @@ set HEAD {}
set PARENT {}
set MERGE_HEAD [list]
set commit_type {}
+set commit_type_is_amend 0
set empty_tree {}
set current_branch {}
set is_detached 0
@@ -1348,7 +1349,6 @@ set current_diff_path {}
set is_3way_diff 0
set is_submodule_diff 0
set is_conflict_diff 0
-set selected_commit_type new
set diff_empty_count 0
set nullid "0000000000000000000000000000000000000000"
@@ -1435,7 +1435,7 @@ proc PARENT {} {
}
proc force_amend {} {
- global selected_commit_type
+ global commit_type_is_amend
global HEAD PARENT MERGE_HEAD commit_type
repository_state newType newHEAD newMERGE_HEAD
@@ -1444,7 +1444,7 @@ proc force_amend {} {
set MERGE_HEAD $newMERGE_HEAD
set commit_type $newType
- set selected_commit_type amend
+ set commit_type_is_amend 1
do_select_commit_type
}
@@ -2828,19 +2828,10 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
menu .mbar.commit
if {![is_enabled nocommit]} {
- .mbar.commit add radiobutton \
- -label [mc "New Commit"] \
- -command do_select_commit_type \
- -variable selected_commit_type \
- -value new
- lappend disable_on_lock \
- [list .mbar.commit entryconf [.mbar.commit index last] -state]
-
- .mbar.commit add radiobutton \
+ .mbar.commit add checkbutton \
-label [mc "Amend Last Commit"] \
- -command do_select_commit_type \
- -variable selected_commit_type \
- -value amend
+ -variable commit_type_is_amend \
+ -command do_select_commit_type
lappend disable_on_lock \
[list .mbar.commit entryconf [.mbar.commit index last] -state]
@@ -3313,18 +3304,10 @@ set ui_comm .vpane.lower.commarea.buffer.frame.t
set ui_coml .vpane.lower.commarea.buffer.header.l
if {![is_enabled nocommit]} {
- ${NS}::radiobutton .vpane.lower.commarea.buffer.header.new \
- -text [mc "New Commit"] \
- -command do_select_commit_type \
- -variable selected_commit_type \
- -value new
- lappend disable_on_lock \
- [list .vpane.lower.commarea.buffer.header.new conf -state]
- ${NS}::radiobutton .vpane.lower.commarea.buffer.header.amend \
+ ${NS}::checkbutton .vpane.lower.commarea.buffer.header.amend \
-text [mc "Amend Last Commit"] \
- -command do_select_commit_type \
- -variable selected_commit_type \
- -value amend
+ -variable commit_type_is_amend \
+ -command do_select_commit_type
lappend disable_on_lock \
[list .vpane.lower.commarea.buffer.header.amend conf -state]
}
@@ -3349,7 +3332,6 @@ pack $ui_coml -side left -fill x
if {![is_enabled nocommit]} {
pack .vpane.lower.commarea.buffer.header.amend -side right
- pack .vpane.lower.commarea.buffer.header.new -side right
}
textframe .vpane.lower.commarea.buffer.frame
diff --git a/lib/checkout_op.tcl b/lib/checkout_op.tcl
index 9e7412c..a522829 100644
--- a/lib/checkout_op.tcl
+++ b/lib/checkout_op.tcl
@@ -389,7 +389,7 @@ $err
}
method _after_readtree {} {
- global selected_commit_type commit_type HEAD MERGE_HEAD PARENT
+ global commit_type HEAD MERGE_HEAD PARENT
global current_branch is_detached
global ui_comm
@@ -490,12 +490,12 @@ method _update_repo_state {} {
# amend mode our file lists are accurate and we can avoid
# the rescan.
#
- global selected_commit_type commit_type HEAD MERGE_HEAD PARENT
+ global commit_type_is_amend commit_type HEAD MERGE_HEAD PARENT
global ui_comm
unlock_index
set name [_name $this]
- set selected_commit_type new
+ set commit_type_is_amend 0
if {[string match amend* $commit_type]} {
$ui_comm delete 0.0 end
$ui_comm edit reset
diff --git a/lib/commit.tcl b/lib/commit.tcl
index 83620b7..384f18f 100644
--- a/lib/commit.tcl
+++ b/lib/commit.tcl
@@ -327,7 +327,7 @@ proc commit_writetree {curHEAD msg_p} {
proc commit_committree {fd_wt curHEAD msg_p} {
global HEAD PARENT MERGE_HEAD commit_type commit_author
global current_branch
- global ui_comm selected_commit_type
+ global ui_comm commit_type_is_amend
global file_states selected_paths rescan_active
global repo_config
global env
@@ -461,8 +461,8 @@ A rescan will be automatically started now.
# -- Update in memory status
#
- set selected_commit_type new
set commit_type normal
+ set commit_type_is_amend 0
set HEAD $cmt_id
set PARENT $cmt_id
set MERGE_HEAD [list]
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]} {
load_last_commit
# The amend request was rejected...
#
if {![string match amend* $commit_type]} {
- set selected_commit_type new
+ set commit_type_is_amend 0
}
}
}
--
2.21.0.789.ga095d9d866
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] git-gui: convert new/amend commit radiobutton to checketton
2019-09-12 19:44 [PATCH] git-gui: convert new/amend commit radiobutton to checketton Bert Wesarg
@ 2019-09-12 22:15 ` Philip Oakley
2019-09-13 6:02 ` Bert Wesarg
0 siblings, 1 reply; 5+ messages in thread
From: Philip Oakley @ 2019-09-12 22:15 UTC (permalink / raw)
To: Bert Wesarg, git; +Cc: Pratyush Yadav, Birger Skogeng Pedersen
On 12/09/2019 20:44, Bert Wesarg wrote:
> Its a bi-state anyway and also safes one line in the menu.
s/safes/saves/ ?
>
> Signed-off-by: Bert Wesarg<bert.wesarg@googlemail.com>
> ---
Philip
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] git-gui: convert new/amend commit radiobutton to checketton
2019-09-12 22:15 ` Philip Oakley
@ 2019-09-13 6:02 ` Bert Wesarg
2019-09-13 19:49 ` Pratyush Yadav
0 siblings, 1 reply; 5+ messages in thread
From: Bert Wesarg @ 2019-09-13 6:02 UTC (permalink / raw)
To: git; +Cc: Bert Wesarg, Pratyush Yadav, Birger Skogeng Pedersen, Philip Oakley
Its a bi-state anyway and also saves one line in the menu.
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
git-gui.sh | 36 +++++++++---------------------------
lib/checkout_op.tcl | 6 +++---
lib/commit.tcl | 4 ++--
lib/index.tcl | 8 ++++----
4 files changed, 18 insertions(+), 36 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index 5bc21b8..80a07d5 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -1341,6 +1341,7 @@ set HEAD {}
set PARENT {}
set MERGE_HEAD [list]
set commit_type {}
+set commit_type_is_amend 0
set empty_tree {}
set current_branch {}
set is_detached 0
@@ -1348,7 +1349,6 @@ set current_diff_path {}
set is_3way_diff 0
set is_submodule_diff 0
set is_conflict_diff 0
-set selected_commit_type new
set diff_empty_count 0
set nullid "0000000000000000000000000000000000000000"
@@ -1435,7 +1435,7 @@ proc PARENT {} {
}
proc force_amend {} {
- global selected_commit_type
+ global commit_type_is_amend
global HEAD PARENT MERGE_HEAD commit_type
repository_state newType newHEAD newMERGE_HEAD
@@ -1444,7 +1444,7 @@ proc force_amend {} {
set MERGE_HEAD $newMERGE_HEAD
set commit_type $newType
- set selected_commit_type amend
+ set commit_type_is_amend 1
do_select_commit_type
}
@@ -2828,19 +2828,10 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
menu .mbar.commit
if {![is_enabled nocommit]} {
- .mbar.commit add radiobutton \
- -label [mc "New Commit"] \
- -command do_select_commit_type \
- -variable selected_commit_type \
- -value new
- lappend disable_on_lock \
- [list .mbar.commit entryconf [.mbar.commit index last] -state]
-
- .mbar.commit add radiobutton \
+ .mbar.commit add checkbutton \
-label [mc "Amend Last Commit"] \
- -command do_select_commit_type \
- -variable selected_commit_type \
- -value amend
+ -variable commit_type_is_amend \
+ -command do_select_commit_type
lappend disable_on_lock \
[list .mbar.commit entryconf [.mbar.commit index last] -state]
@@ -3313,18 +3304,10 @@ set ui_comm .vpane.lower.commarea.buffer.frame.t
set ui_coml .vpane.lower.commarea.buffer.header.l
if {![is_enabled nocommit]} {
- ${NS}::radiobutton .vpane.lower.commarea.buffer.header.new \
- -text [mc "New Commit"] \
- -command do_select_commit_type \
- -variable selected_commit_type \
- -value new
- lappend disable_on_lock \
- [list .vpane.lower.commarea.buffer.header.new conf -state]
- ${NS}::radiobutton .vpane.lower.commarea.buffer.header.amend \
+ ${NS}::checkbutton .vpane.lower.commarea.buffer.header.amend \
-text [mc "Amend Last Commit"] \
- -command do_select_commit_type \
- -variable selected_commit_type \
- -value amend
+ -variable commit_type_is_amend \
+ -command do_select_commit_type
lappend disable_on_lock \
[list .vpane.lower.commarea.buffer.header.amend conf -state]
}
@@ -3349,7 +3332,6 @@ pack $ui_coml -side left -fill x
if {![is_enabled nocommit]} {
pack .vpane.lower.commarea.buffer.header.amend -side right
- pack .vpane.lower.commarea.buffer.header.new -side right
}
textframe .vpane.lower.commarea.buffer.frame
diff --git a/lib/checkout_op.tcl b/lib/checkout_op.tcl
index 9e7412c..a522829 100644
--- a/lib/checkout_op.tcl
+++ b/lib/checkout_op.tcl
@@ -389,7 +389,7 @@ $err
}
method _after_readtree {} {
- global selected_commit_type commit_type HEAD MERGE_HEAD PARENT
+ global commit_type HEAD MERGE_HEAD PARENT
global current_branch is_detached
global ui_comm
@@ -490,12 +490,12 @@ method _update_repo_state {} {
# amend mode our file lists are accurate and we can avoid
# the rescan.
#
- global selected_commit_type commit_type HEAD MERGE_HEAD PARENT
+ global commit_type_is_amend commit_type HEAD MERGE_HEAD PARENT
global ui_comm
unlock_index
set name [_name $this]
- set selected_commit_type new
+ set commit_type_is_amend 0
if {[string match amend* $commit_type]} {
$ui_comm delete 0.0 end
$ui_comm edit reset
diff --git a/lib/commit.tcl b/lib/commit.tcl
index 83620b7..384f18f 100644
--- a/lib/commit.tcl
+++ b/lib/commit.tcl
@@ -327,7 +327,7 @@ proc commit_writetree {curHEAD msg_p} {
proc commit_committree {fd_wt curHEAD msg_p} {
global HEAD PARENT MERGE_HEAD commit_type commit_author
global current_branch
- global ui_comm selected_commit_type
+ global ui_comm commit_type_is_amend
global file_states selected_paths rescan_active
global repo_config
global env
@@ -461,8 +461,8 @@ A rescan will be automatically started now.
# -- Update in memory status
#
- set selected_commit_type new
set commit_type normal
+ set commit_type_is_amend 0
set HEAD $cmt_id
set PARENT $cmt_id
set MERGE_HEAD [list]
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]} {
load_last_commit
# The amend request was rejected...
#
if {![string match amend* $commit_type]} {
- set selected_commit_type new
+ set commit_type_is_amend 0
}
}
}
--
2.21.0.789.ga095d9d866
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] git-gui: convert new/amend commit radiobutton to checketton
2019-09-13 6:02 ` Bert Wesarg
@ 2019-09-13 19:49 ` Pratyush Yadav
2019-09-13 20:19 ` Bert Wesarg
0 siblings, 1 reply; 5+ messages in thread
From: Pratyush Yadav @ 2019-09-13 19:49 UTC (permalink / raw)
To: Bert Wesarg; +Cc: git, Birger Skogeng Pedersen, Philip Oakley
You missed fixing the typo in the subject. s/checketton/checkbutton/.
But no need to send a re-roll for that. I can fix it locally.
Other than that, LGTM. Thanks, will queue.
On 13/09/19 08:02AM, Bert Wesarg wrote:
> Its a bi-state anyway and also saves one line in the menu.
>
> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] git-gui: convert new/amend commit radiobutton to checketton
2019-09-13 19:49 ` Pratyush Yadav
@ 2019-09-13 20:19 ` Bert Wesarg
0 siblings, 0 replies; 5+ messages in thread
From: Bert Wesarg @ 2019-09-13 20:19 UTC (permalink / raw)
To: Pratyush Yadav; +Cc: Git Mailing List, Birger Skogeng Pedersen, Philip Oakley
On Fri, Sep 13, 2019 at 9:49 PM Pratyush Yadav <me@yadavpratyush.com> wrote:
>
> You missed fixing the typo in the subject. s/checketton/checkbutton/.
> But no need to send a re-roll for that. I can fix it locally.
thanks, I also fixed that locally, but again, it slipped thru in the
patch mail. Still don't know why this happened.
Best,
Bert
>
> Other than that, LGTM. Thanks, will queue.
>
> On 13/09/19 08:02AM, Bert Wesarg wrote:
> > Its a bi-state anyway and also saves one line in the menu.
> >
> > Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
>
> --
> Regards,
> Pratyush Yadav
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-09-13 20:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-12 19:44 [PATCH] git-gui: convert new/amend commit radiobutton to checketton Bert Wesarg
2019-09-12 22:15 ` Philip Oakley
2019-09-13 6:02 ` Bert Wesarg
2019-09-13 19:49 ` Pratyush Yadav
2019-09-13 20:19 ` Bert Wesarg
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).