@matheusbsbs / matheus-bagliano / commits / 29a9366052
Fork 0

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>

Jonathan Gilbert committed Dec 1, 2019 at 02:28 UTC 29a9366052d50926bc4426b8540493652cba0766
1 file changed +46 -46
lib/index.tcl
+46 -46
@@ -56,15 +56,15 @@ proc _close_updateindex {fd after} {
56 uplevel #0 $after
57 }
58
59 -proc update_indexinfo {msg pathList after} {
59 +proc update_indexinfo {msg path_list after} {
60 global update_index_cp
61
62 if {![lock_index update]} return
63
64 set update_index_cp 0
65 - set pathList [lsort $pathList]
66 - set totalCnt [llength $pathList]
67 - set batch [expr {int($totalCnt * .01) + 1}]
65 + set path_list [lsort $path_list]
66 + set total_cnt [llength $path_list]
67 + set batch [expr {int($total_cnt * .01) + 1}]
68 if {$batch > 25} {set batch 25}
69
70 $::main_status start $msg [mc "files"]
@@ -78,26 +78,26 @@ proc update_indexinfo {msg pathList after} {
78 fileevent $fd writable [list \
79 write_update_indexinfo \
80 $fd \
81 - $pathList \
82 - $totalCnt \
81 + $path_list \
82 + $total_cnt \
83 $batch \
84 $after \
85 ]
86 }
87
88 -proc write_update_indexinfo {fd pathList totalCnt batch after} {
88 +proc write_update_indexinfo {fd path_list total_cnt batch after} {
89 global update_index_cp
90 global file_states current_diff_path
91
92 - if {$update_index_cp >= $totalCnt} {
92 + if {$update_index_cp >= $total_cnt} {
93 _close_updateindex $fd $after
94 return
95 }
96
97 for {set i $batch} \
98 - {$update_index_cp < $totalCnt && $i > 0} \
98 + {$update_index_cp < $total_cnt && $i > 0} \
99 {incr i -1} {
100 - set path [lindex $pathList $update_index_cp]
100 + set path [lindex $path_list $update_index_cp]
101 incr update_index_cp
102
103 set s $file_states($path)
@@ -119,18 +119,18 @@ proc write_update_indexinfo {fd pathList totalCnt batch after} {
119 display_file $path $new
120 }
121
122 - $::main_status update $update_index_cp $totalCnt
122 + $::main_status update $update_index_cp $total_cnt
123 }
124
125 -proc update_index {msg pathList after} {
125 +proc update_index {msg path_list after} {
126 global update_index_cp
127
128 if {![lock_index update]} return
129
130 set update_index_cp 0
131 - set pathList [lsort $pathList]
132 - set totalCnt [llength $pathList]
133 - set batch [expr {int($totalCnt * .01) + 1}]
131 + set path_list [lsort $path_list]
132 + set total_cnt [llength $path_list]
133 + set batch [expr {int($total_cnt * .01) + 1}]
134 if {$batch > 25} {set batch 25}
135
136 $::main_status start $msg [mc "files"]
@@ -144,26 +144,26 @@ proc update_index {msg pathList after} {
144 fileevent $fd writable [list \
145 write_update_index \
146 $fd \
147 - $pathList \
148 - $totalCnt \
147 + $path_list \
148 + $total_cnt \
149 $batch \
150 $after \
151 ]
152 }
153
154 -proc write_update_index {fd pathList totalCnt batch after} {
154 +proc write_update_index {fd path_list total_cnt batch after} {
155 global update_index_cp
156 global file_states current_diff_path
157
158 - if {$update_index_cp >= $totalCnt} {
158 + if {$update_index_cp >= $total_cnt} {
159 _close_updateindex $fd $after
160 return
161 }
162
163 for {set i $batch} \
164 - {$update_index_cp < $totalCnt && $i > 0} \
164 + {$update_index_cp < $total_cnt && $i > 0} \
165 {incr i -1} {
166 - set path [lindex $pathList $update_index_cp]
166 + set path [lindex $path_list $update_index_cp]
167 incr update_index_cp
168
169 switch -glob -- [lindex $file_states($path) 0] {
@@ -190,18 +190,18 @@ proc write_update_index {fd pathList totalCnt batch after} {
190 display_file $path $new
191 }
192
193 - $::main_status update $update_index_cp $totalCnt
193 + $::main_status update $update_index_cp $total_cnt
194 }
195
196 -proc checkout_index {msg pathList after} {
196 +proc checkout_index {msg path_list after} {
197 global update_index_cp
198
199 if {![lock_index update]} return
200
201 set update_index_cp 0
202 - set pathList [lsort $pathList]
203 - set totalCnt [llength $pathList]
204 - set batch [expr {int($totalCnt * .01) + 1}]
202 + set path_list [lsort $path_list]
203 + set total_cnt [llength $path_list]
204 + set batch [expr {int($total_cnt * .01) + 1}]
205 if {$batch > 25} {set batch 25}
206
207 $::main_status start $msg [mc "files"]
@@ -221,26 +221,26 @@ proc checkout_index {msg pathList after} {
221 fileevent $fd writable [list \
222 write_checkout_index \
223 $fd \
224 - $pathList \
225 - $totalCnt \
224 + $path_list \
225 + $total_cnt \
226 $batch \
227 $after \
228 ]
229 }
230
231 -proc write_checkout_index {fd pathList totalCnt batch after} {
231 +proc write_checkout_index {fd path_list total_cnt batch after} {
232 global update_index_cp
233 global file_states current_diff_path
234
235 - if {$update_index_cp >= $totalCnt} {
235 + if {$update_index_cp >= $total_cnt} {
236 _close_updateindex $fd $after
237 return
238 }
239
240 for {set i $batch} \
241 - {$update_index_cp < $totalCnt && $i > 0} \
241 + {$update_index_cp < $total_cnt && $i > 0} \
242 {incr i -1} {
243 - set path [lindex $pathList $update_index_cp]
243 + set path [lindex $path_list $update_index_cp]
244 incr update_index_cp
245 switch -glob -- [lindex $file_states($path) 0] {
246 U? {continue}
@@ -253,7 +253,7 @@ proc write_checkout_index {fd pathList totalCnt batch after} {
253 }
254 }
255
256 - $::main_status update $update_index_cp $totalCnt
256 + $::main_status update $update_index_cp $total_cnt
257 }
258
259 proc unstage_helper {txt paths} {
@@ -261,7 +261,7 @@ proc unstage_helper {txt paths} {
261
262 if {![lock_index begin-update]} return
263
264 - set pathList [list]
264 + set path_list [list]
265 set after {}
266 foreach path $paths {
267 switch -glob -- [lindex $file_states($path) 0] {
@@ -269,19 +269,19 @@ proc unstage_helper {txt paths} {
269 M? -
270 T? -
271 D? {
272 - lappend pathList $path
272 + lappend path_list $path
273 if {$path eq $current_diff_path} {
274 set after {reshow_diff;}
275 }
276 }
277 }
278 }
279 - if {$pathList eq {}} {
279 + if {$path_list eq {}} {
280 unlock_index
281 } else {
282 update_indexinfo \
283 $txt \
284 - $pathList \
284 + $path_list \
285 [concat $after [list ui_ready]]
286 }
287 }
@@ -305,7 +305,7 @@ proc add_helper {txt paths} {
305
306 if {![lock_index begin-update]} return
307
308 - set pathList [list]
308 + set path_list [list]
309 set after {}
310 foreach path $paths {
311 switch -glob -- [lindex $file_states($path) 0] {
@@ -321,19 +321,19 @@ proc add_helper {txt paths} {
321 ?M -
322 ?D -
323 ?T {
324 - lappend pathList $path
324 + lappend path_list $path
325 if {$path eq $current_diff_path} {
326 set after {reshow_diff;}
327 }
328 }
329 }
330 }
331 - if {$pathList eq {}} {
331 + if {$path_list eq {}} {
332 unlock_index
333 } else {
334 update_index \
335 $txt \
336 - $pathList \
336 + $path_list \
337 [concat $after {ui_status [mc "Ready to commit."]}]
338 }
339 }
@@ -393,7 +393,7 @@ proc revert_helper {txt paths} {
393
394 if {![lock_index begin-update]} return
395
396 - set pathList [list]
396 + set path_list [list]
397 set after {}
398 foreach path $paths {
399 switch -glob -- [lindex $file_states($path) 0] {
@@ -401,7 +401,7 @@ proc revert_helper {txt paths} {
401 ?M -
402 ?T -
403 ?D {
404 - lappend pathList $path
404 + lappend path_list $path
405 if {$path eq $current_diff_path} {
406 set after {reshow_diff;}
407 }
@@ -420,12 +420,12 @@ proc revert_helper {txt paths} {
420 # as they have quite complex plural-form rules. Unfortunately,
421 # msgcat doesn't seem to support that kind of string translation.
422 #
423 - set n [llength $pathList]
423 + set n [llength $path_list]
424 if {$n == 0} {
425 unlock_index
426 return
427 } elseif {$n == 1} {
428 - set query [mc "Revert changes in file %s?" [short_path [lindex $pathList]]]
428 + set query [mc "Revert changes in file %s?" [short_path [lindex $path_list]]]
429 } else {
430 set query [mc "Revert changes in these %i files?" $n]
431 }
@@ -444,7 +444,7 @@ proc revert_helper {txt paths} {
444 if {$reply == 1} {
445 checkout_index \
446 $txt \
447 - $pathList \
447 + $path_list \
448 [concat $after [list ui_ready]]
449 } else {
450 unlock_index