@@ -1936,7 +1936,7 @@ proc findfiles {} {
19361936 global selectedline numcommits lineid ctext
19371937 global ffileline finddidsel parents nparents
19381938 global findinprogress findstartline findinsertpos
1939- global treediffs fdiffids fdiffsneeded fdiffpos
1939+ global treediffs fdiffid fdiffsneeded fdiffpos
19401940 global findmergefiles
19411941
19421942 if {$numcommits == 0} return
@@ -1953,11 +1953,9 @@ proc findfiles {} {
19531953 while 1 {
19541954 set id $lineid($l)
19551955 if {$findmergefiles || $nparents($id) == 1} {
1956- foreach p $parents($id) {
1957- if {![info exists treediffs([list $id $p ])]} {
1958- append diffsneeded " $id $p \n "
1959- lappend fdiffsneeded [list $id $p ]
1960- }
1956+ if {![info exists treediffs($id )]} {
1957+ append diffsneeded " $id \n "
1958+ lappend fdiffsneeded $id
19611959 }
19621960 }
19631961 if {[incr l] >= $numcommits } {
@@ -1974,7 +1972,7 @@ proc findfiles {} {
19741972 error_popup " Error starting search process: $err "
19751973 return
19761974 }
1977- catch {unset fdiffids }
1975+ catch {unset fdiffid }
19781976 set fdiffpos 0
19791977 fconfigure $df -blocking 0
19801978 fileevent $df readable [list readfilediffs $df ]
@@ -1983,16 +1981,15 @@ proc findfiles {} {
19831981 set finddidsel 0
19841982 set findinsertpos end
19851983 set id $lineid($l)
1986- set p [lindex $parents($id) 0]
19871984 . config -cursor watch
19881985 settextcursor watch
19891986 set findinprogress 1
1990- findcont [ list $id $p ]
1987+ findcont $id
19911988 update
19921989}
19931990
19941991proc readfilediffs {df} {
1995- global findids fdiffids fdiffs
1992+ global findid fdiffid fdiffs
19961993
19971994 set n [gets $df line]
19981995 if {$n < 0} {
@@ -2002,73 +1999,70 @@ proc readfilediffs {df} {
20021999 stopfindproc
20032000 bell
20042001 error_popup " Error in git-diff-tree: $err "
2005- } elseif {[info exists findids ]} {
2006- set ids $findids
2002+ } elseif {[info exists findid ]} {
2003+ set id $findid
20072004 stopfindproc
20082005 bell
2009- error_popup " Couldn't find diffs for { $ids } "
2006+ error_popup " Couldn't find diffs for $id "
20102007 }
20112008 }
20122009 return
20132010 }
2014- if {[regexp {^([0-9a-f]{40}) \(from ([0-9a-f]{40})\)} $line match id p ]} {
2011+ if {[regexp {^([0-9a-f]{40})$} $line match id]} {
20152012 # start of a new string of diffs
20162013 donefilediff
2017- set fdiffids [ list $id $p ]
2014+ set fdiffid $id
20182015 set fdiffs {}
20192016 } elseif {[string match " :*" $line ]} {
20202017 lappend fdiffs [lindex $line 5]
20212018 }
20222019}
20232020
20242021proc donefilediff {} {
2025- global fdiffids fdiffs treediffs findids
2022+ global fdiffid fdiffs treediffs findid
20262023 global fdiffsneeded fdiffpos
20272024
2028- if {[info exists fdiffids ]} {
2029- while {[lindex $fdiffsneeded $fdiffpos ] ne $fdiffids
2025+ if {[info exists fdiffid ]} {
2026+ while {[lindex $fdiffsneeded $fdiffpos ] ne $fdiffid
20302027 && $fdiffpos < [llength $fdiffsneeded ]} {
20312028 # git-diff-tree doesn't output anything for a commit
20322029 # which doesn't change anything
2033- set nullids [lindex $fdiffsneeded $fdiffpos ]
2034- set treediffs($nullids ) {}
2035- if {[info exists findids ] && $nullids eq $findids } {
2036- unset findids
2037- findcont $nullids
2030+ set nullid [lindex $fdiffsneeded $fdiffpos ]
2031+ set treediffs($nullid ) {}
2032+ if {[info exists findid ] && $nullid eq $findid } {
2033+ unset findid
2034+ findcont $nullid
20382035 }
20392036 incr fdiffpos
20402037 }
20412038 incr fdiffpos
20422039
2043- if {![info exists treediffs($fdiffids )]} {
2044- set treediffs($fdiffids ) $fdiffs
2040+ if {![info exists treediffs($fdiffid )]} {
2041+ set treediffs($fdiffid ) $fdiffs
20452042 }
2046- if {[info exists findids ] && $fdiffids eq $findids } {
2047- unset findids
2048- findcont $fdiffids
2043+ if {[info exists findid ] && $fdiffid eq $findid } {
2044+ unset findid
2045+ findcont $fdiffid
20492046 }
20502047 }
20512048}
20522049
2053- proc findcont {ids } {
2054- global findids treediffs parents nparents
2050+ proc findcont {id } {
2051+ global findid treediffs parents nparents
20552052 global ffileline findstartline finddidsel
20562053 global lineid numcommits matchinglines findinprogress
20572054 global findmergefiles
20582055
2059- set id [lindex $ids 0]
2060- set p [lindex $ids 1]
2061- set pi [lsearch -exact $parents($id) $p ]
20622056 set l $ffileline
20632057 while 1 {
20642058 if {$findmergefiles || $nparents($id) == 1} {
2065- if {![info exists treediffs($ids )]} {
2066- set findids $ids
2059+ if {![info exists treediffs($id )]} {
2060+ set findid $id
20672061 set ffileline $l
20682062 return
20692063 }
20702064 set doesmatch 0
2071- foreach f $treediffs($ids ) {
2065+ foreach f $treediffs($id ) {
20722066 set x [findmatches $f ]
20732067 if {$x != {}} {
20742068 set doesmatch 1
@@ -2077,21 +2071,13 @@ proc findcont {ids} {
20772071 }
20782072 if {$doesmatch } {
20792073 insertmatch $l $id
2080- set pi $nparents($id)
20812074 }
2082- } else {
2083- set pi $nparents($id)
20842075 }
2085- if {[incr pi] >= $nparents($id) } {
2086- set pi 0
2087- if {[incr l] >= $numcommits } {
2088- set l 0
2089- }
2090- if {$l == $findstartline } break
2091- set id $lineid($l)
2076+ if {[incr l] >= $numcommits } {
2077+ set l 0
20922078 }
2093- set p [ lindex $parents($id) $pi ]
2094- set ids [ list $ id $p ]
2079+ if { $l == $findstartline } break
2080+ set id $lineid($l)
20952081 }
20962082 stopfindproc
20972083 if {!$finddidsel } {
0 commit comments