@@ -90,6 +90,15 @@ proc dorunq {} {
90
90
}
91
91
}
92
92
93
+ proc reg_instance {fd} {
94
+ global commfd leftover loginstance
95
+
96
+ set i [incr loginstance]
97
+ set commfd($i ) $fd
98
+ set leftover($i ) {}
99
+ return $i
100
+ }
101
+
93
102
proc unmerged_files {files} {
94
103
global nr_unmerged
95
104
@@ -294,10 +303,10 @@ proc parseviewrevs {view revs} {
294
303
# Start off a git log process and arrange to read its output
295
304
proc start_rev_list {view} {
296
305
global startmsecs commitidx viewcomplete curview
297
- global commfd leftover tclencoding
306
+ global tclencoding
298
307
global viewargs viewargscmd viewfiles vfilelimit
299
308
global showlocalchanges commitinterest
300
- global viewactive loginstance viewinstances vmergeonly
309
+ global viewactive viewinstances vmergeonly
301
310
global pending_select mainheadid
302
311
global vcanopt vflags vrevs vorigargs
303
312
@@ -354,10 +363,8 @@ proc start_rev_list {view} {
354
363
error_popup " [ mc " Error executing git log:" ] $err "
355
364
return 0
356
365
}
357
- set i [incr loginstance ]
366
+ set i [reg_instance $fd ]
358
367
set viewinstances($view ) [list $i ]
359
- set commfd($i ) $fd
360
- set leftover($i ) {}
361
368
if {$showlocalchanges && $mainheadid ne {}} {
362
369
lappend commitinterest($mainheadid ) {dodiffindex}
363
370
}
@@ -420,8 +427,8 @@ proc getcommits {} {
420
427
421
428
proc updatecommits {} {
422
429
global curview vcanopt vorigargs vfilelimit viewinstances
423
- global viewactive viewcomplete loginstance tclencoding
424
- global startmsecs commfd showneartags showlocalchanges leftover
430
+ global viewactive viewcomplete tclencoding
431
+ global startmsecs showneartags showlocalchanges
425
432
global mainheadid pending_select
426
433
global isworktree
427
434
global varcid vposids vnegids vflags vrevs
@@ -482,10 +489,8 @@ proc updatecommits {} {
482
489
if {$viewactive($view) == 0} {
483
490
set startmsecs [clock clicks -milliseconds]
484
491
}
485
- set i [incr loginstance ]
492
+ set i [reg_instance $fd ]
486
493
lappend viewinstances($view ) $i
487
- set commfd($i ) $fd
488
- set leftover($i ) {}
489
494
fconfigure $fd -blocking 0 -translation lf -eofchar {}
490
495
if {$tclencoding != {}} {
491
496
fconfigure $fd -encoding $tclencoding
@@ -4063,10 +4068,11 @@ proc dodiffindex {} {
4063
4068
incr lserial
4064
4069
set fd [open " |git diff-index --cached HEAD" r]
4065
4070
fconfigure $fd -blocking 0
4066
- filerun $fd [list readdiffindex $fd $lserial ]
4071
+ set i [reg_instance $fd ]
4072
+ filerun $fd [list readdiffindex $fd $lserial $i ]
4067
4073
}
4068
4074
4069
- proc readdiffindex {fd serial} {
4075
+ proc readdiffindex {fd serial inst } {
4070
4076
global mainheadid nullid nullid2 curview commitinfo commitdata lserial
4071
4077
4072
4078
set isdiff 1
@@ -4077,7 +4083,7 @@ proc readdiffindex {fd serial} {
4077
4083
set isdiff 0
4078
4084
}
4079
4085
# we only need to see one line and we don't really care what it says...
4080
- close $fd
4086
+ stop_instance $inst
4081
4087
4082
4088
if {$serial != $lserial } {
4083
4089
return 0
@@ -4086,7 +4092,8 @@ proc readdiffindex {fd serial} {
4086
4092
# now see if there are any local changes not checked in to the index
4087
4093
set fd [open " |git diff-files" r]
4088
4094
fconfigure $fd -blocking 0
4089
- filerun $fd [list readdifffiles $fd $serial ]
4095
+ set i [reg_instance $fd ]
4096
+ filerun $fd [list readdifffiles $fd $serial $i ]
4090
4097
4091
4098
if {$isdiff && ![commitinview $nullid2 $curview ]} {
4092
4099
# add the line for the changes in the index to the graph
@@ -4103,7 +4110,7 @@ proc readdiffindex {fd serial} {
4103
4110
return 0
4104
4111
}
4105
4112
4106
- proc readdifffiles {fd serial} {
4113
+ proc readdifffiles {fd serial inst } {
4107
4114
global mainheadid nullid nullid2 curview
4108
4115
global commitinfo commitdata lserial
4109
4116
@@ -4115,7 +4122,7 @@ proc readdifffiles {fd serial} {
4115
4122
set isdiff 0
4116
4123
}
4117
4124
# we only need to see one line and we don't really care what it says...
4118
- close $fd
4125
+ stop_instance $inst
4119
4126
4120
4127
if {$serial != $lserial } {
4121
4128
return 0
0 commit comments