git-gui: consolidate naming conventions

A few variables in this file use camelCase, while the overall standard
is snake_case. A consistent naming scheme will improve readability of
future changes. To avoid mixing naming changes with semantic changes,
this commit contains only naming changes.

Signed-off-by: Jonathan Gilbert <JonathanG@iQmetrix.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
This commit is contained in:
Jonathan Gilbert 2019-12-01 02:28:31 +00:00 committed by Pratyush Yadav
parent b524f6b399
commit 29a9366052

View File

@ -56,15 +56,15 @@ proc _close_updateindex {fd after} {
uplevel #0 $after uplevel #0 $after
} }
proc update_indexinfo {msg pathList after} { proc update_indexinfo {msg path_list after} {
global update_index_cp global update_index_cp
if {![lock_index update]} return if {![lock_index update]} return
set update_index_cp 0 set update_index_cp 0
set pathList [lsort $pathList] set path_list [lsort $path_list]
set totalCnt [llength $pathList] set total_cnt [llength $path_list]
set batch [expr {int($totalCnt * .01) + 1}] set batch [expr {int($total_cnt * .01) + 1}]
if {$batch > 25} {set batch 25} if {$batch > 25} {set batch 25}
$::main_status start $msg [mc "files"] $::main_status start $msg [mc "files"]
@ -78,26 +78,26 @@ proc update_indexinfo {msg pathList after} {
fileevent $fd writable [list \ fileevent $fd writable [list \
write_update_indexinfo \ write_update_indexinfo \
$fd \ $fd \
$pathList \ $path_list \
$totalCnt \ $total_cnt \
$batch \ $batch \
$after \ $after \
] ]
} }
proc write_update_indexinfo {fd pathList totalCnt batch after} { proc write_update_indexinfo {fd path_list total_cnt batch after} {
global update_index_cp global update_index_cp
global file_states current_diff_path global file_states current_diff_path
if {$update_index_cp >= $totalCnt} { if {$update_index_cp >= $total_cnt} {
_close_updateindex $fd $after _close_updateindex $fd $after
return return
} }
for {set i $batch} \ for {set i $batch} \
{$update_index_cp < $totalCnt && $i > 0} \ {$update_index_cp < $total_cnt && $i > 0} \
{incr i -1} { {incr i -1} {
set path [lindex $pathList $update_index_cp] set path [lindex $path_list $update_index_cp]
incr update_index_cp incr update_index_cp
set s $file_states($path) set s $file_states($path)
@ -119,18 +119,18 @@ proc write_update_indexinfo {fd pathList totalCnt batch after} {
display_file $path $new display_file $path $new
} }
$::main_status update $update_index_cp $totalCnt $::main_status update $update_index_cp $total_cnt
} }
proc update_index {msg pathList after} { proc update_index {msg path_list after} {
global update_index_cp global update_index_cp
if {![lock_index update]} return if {![lock_index update]} return
set update_index_cp 0 set update_index_cp 0
set pathList [lsort $pathList] set path_list [lsort $path_list]
set totalCnt [llength $pathList] set total_cnt [llength $path_list]
set batch [expr {int($totalCnt * .01) + 1}] set batch [expr {int($total_cnt * .01) + 1}]
if {$batch > 25} {set batch 25} if {$batch > 25} {set batch 25}
$::main_status start $msg [mc "files"] $::main_status start $msg [mc "files"]
@ -144,26 +144,26 @@ proc update_index {msg pathList after} {
fileevent $fd writable [list \ fileevent $fd writable [list \
write_update_index \ write_update_index \
$fd \ $fd \
$pathList \ $path_list \
$totalCnt \ $total_cnt \
$batch \ $batch \
$after \ $after \
] ]
} }
proc write_update_index {fd pathList totalCnt batch after} { proc write_update_index {fd path_list total_cnt batch after} {
global update_index_cp global update_index_cp
global file_states current_diff_path global file_states current_diff_path
if {$update_index_cp >= $totalCnt} { if {$update_index_cp >= $total_cnt} {
_close_updateindex $fd $after _close_updateindex $fd $after
return return
} }
for {set i $batch} \ for {set i $batch} \
{$update_index_cp < $totalCnt && $i > 0} \ {$update_index_cp < $total_cnt && $i > 0} \
{incr i -1} { {incr i -1} {
set path [lindex $pathList $update_index_cp] set path [lindex $path_list $update_index_cp]
incr update_index_cp incr update_index_cp
switch -glob -- [lindex $file_states($path) 0] { switch -glob -- [lindex $file_states($path) 0] {
@ -190,18 +190,18 @@ proc write_update_index {fd pathList totalCnt batch after} {
display_file $path $new display_file $path $new
} }
$::main_status update $update_index_cp $totalCnt $::main_status update $update_index_cp $total_cnt
} }
proc checkout_index {msg pathList after} { proc checkout_index {msg path_list after} {
global update_index_cp global update_index_cp
if {![lock_index update]} return if {![lock_index update]} return
set update_index_cp 0 set update_index_cp 0
set pathList [lsort $pathList] set path_list [lsort $path_list]
set totalCnt [llength $pathList] set total_cnt [llength $path_list]
set batch [expr {int($totalCnt * .01) + 1}] set batch [expr {int($total_cnt * .01) + 1}]
if {$batch > 25} {set batch 25} if {$batch > 25} {set batch 25}
$::main_status start $msg [mc "files"] $::main_status start $msg [mc "files"]
@ -221,26 +221,26 @@ proc checkout_index {msg pathList after} {
fileevent $fd writable [list \ fileevent $fd writable [list \
write_checkout_index \ write_checkout_index \
$fd \ $fd \
$pathList \ $path_list \
$totalCnt \ $total_cnt \
$batch \ $batch \
$after \ $after \
] ]
} }
proc write_checkout_index {fd pathList totalCnt batch after} { proc write_checkout_index {fd path_list total_cnt batch after} {
global update_index_cp global update_index_cp
global file_states current_diff_path global file_states current_diff_path
if {$update_index_cp >= $totalCnt} { if {$update_index_cp >= $total_cnt} {
_close_updateindex $fd $after _close_updateindex $fd $after
return return
} }
for {set i $batch} \ for {set i $batch} \
{$update_index_cp < $totalCnt && $i > 0} \ {$update_index_cp < $total_cnt && $i > 0} \
{incr i -1} { {incr i -1} {
set path [lindex $pathList $update_index_cp] set path [lindex $path_list $update_index_cp]
incr update_index_cp incr update_index_cp
switch -glob -- [lindex $file_states($path) 0] { switch -glob -- [lindex $file_states($path) 0] {
U? {continue} U? {continue}
@ -253,7 +253,7 @@ proc write_checkout_index {fd pathList totalCnt batch after} {
} }
} }
$::main_status update $update_index_cp $totalCnt $::main_status update $update_index_cp $total_cnt
} }
proc unstage_helper {txt paths} { proc unstage_helper {txt paths} {
@ -261,7 +261,7 @@ proc unstage_helper {txt paths} {
if {![lock_index begin-update]} return if {![lock_index begin-update]} return
set pathList [list] set path_list [list]
set after {} set after {}
foreach path $paths { foreach path $paths {
switch -glob -- [lindex $file_states($path) 0] { switch -glob -- [lindex $file_states($path) 0] {
@ -269,19 +269,19 @@ proc unstage_helper {txt paths} {
M? - M? -
T? - T? -
D? { D? {
lappend pathList $path lappend path_list $path
if {$path eq $current_diff_path} { if {$path eq $current_diff_path} {
set after {reshow_diff;} set after {reshow_diff;}
} }
} }
} }
} }
if {$pathList eq {}} { if {$path_list eq {}} {
unlock_index unlock_index
} else { } else {
update_indexinfo \ update_indexinfo \
$txt \ $txt \
$pathList \ $path_list \
[concat $after [list ui_ready]] [concat $after [list ui_ready]]
} }
} }
@ -305,7 +305,7 @@ proc add_helper {txt paths} {
if {![lock_index begin-update]} return if {![lock_index begin-update]} return
set pathList [list] set path_list [list]
set after {} set after {}
foreach path $paths { foreach path $paths {
switch -glob -- [lindex $file_states($path) 0] { switch -glob -- [lindex $file_states($path) 0] {
@ -321,19 +321,19 @@ proc add_helper {txt paths} {
?M - ?M -
?D - ?D -
?T { ?T {
lappend pathList $path lappend path_list $path
if {$path eq $current_diff_path} { if {$path eq $current_diff_path} {
set after {reshow_diff;} set after {reshow_diff;}
} }
} }
} }
} }
if {$pathList eq {}} { if {$path_list eq {}} {
unlock_index unlock_index
} else { } else {
update_index \ update_index \
$txt \ $txt \
$pathList \ $path_list \
[concat $after {ui_status [mc "Ready to commit."]}] [concat $after {ui_status [mc "Ready to commit."]}]
} }
} }
@ -393,7 +393,7 @@ proc revert_helper {txt paths} {
if {![lock_index begin-update]} return if {![lock_index begin-update]} return
set pathList [list] set path_list [list]
set after {} set after {}
foreach path $paths { foreach path $paths {
switch -glob -- [lindex $file_states($path) 0] { switch -glob -- [lindex $file_states($path) 0] {
@ -401,7 +401,7 @@ proc revert_helper {txt paths} {
?M - ?M -
?T - ?T -
?D { ?D {
lappend pathList $path lappend path_list $path
if {$path eq $current_diff_path} { if {$path eq $current_diff_path} {
set after {reshow_diff;} set after {reshow_diff;}
} }
@ -420,12 +420,12 @@ proc revert_helper {txt paths} {
# as they have quite complex plural-form rules. Unfortunately, # as they have quite complex plural-form rules. Unfortunately,
# msgcat doesn't seem to support that kind of string translation. # msgcat doesn't seem to support that kind of string translation.
# #
set n [llength $pathList] set n [llength $path_list]
if {$n == 0} { if {$n == 0} {
unlock_index unlock_index
return return
} elseif {$n == 1} { } elseif {$n == 1} {
set query [mc "Revert changes in file %s?" [short_path [lindex $pathList]]] set query [mc "Revert changes in file %s?" [short_path [lindex $path_list]]]
} else { } else {
set query [mc "Revert changes in these %i files?" $n] set query [mc "Revert changes in these %i files?" $n]
} }
@ -444,7 +444,7 @@ proc revert_helper {txt paths} {
if {$reply == 1} { if {$reply == 1} {
checkout_index \ checkout_index \
$txt \ $txt \
$pathList \ $path_list \
[concat $after [list ui_ready]] [concat $after [list ui_ready]]
} else { } else {
unlock_index unlock_index