Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
gitk: Make "find" on "Files" work again.
author
Paul Mackerras
<paulus@samba.org>
Thu, 9 Feb 2006 23:29:26 +0000
(10:29 +1100)
committer
Paul Mackerras
<paulus@samba.org>
Thu, 9 Feb 2006 23:29:26 +0000
(10:29 +1100)
It was broken by the change to supply just the child id to
git-diff-tree rather than both child and parent.
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
b77b027
)
diff --git
a/gitk
b/gitk
index e4821406b533391d81608e7245e3afa002d45804..f4c662423c916dfaabfe14f45a90104944c0dd5c 100755
(executable)
--- a/
gitk
+++ b/
gitk
@@
-1936,7
+1936,7
@@
proc findfiles {} {
global selectedline numcommits lineid ctext
global ffileline finddidsel parents nparents
global findinprogress findstartline findinsertpos
global selectedline numcommits lineid ctext
global ffileline finddidsel parents nparents
global findinprogress findstartline findinsertpos
- global treediffs fdiffid
s
fdiffsneeded fdiffpos
+ global treediffs fdiffid fdiffsneeded fdiffpos
global findmergefiles
if {$numcommits == 0} return
global findmergefiles
if {$numcommits == 0} return
@@
-1953,11
+1953,9
@@
proc findfiles {} {
while 1 {
set id $lineid($l)
if {$findmergefiles || $nparents($id) == 1} {
while 1 {
set id $lineid($l)
if {$findmergefiles || $nparents($id) == 1} {
- foreach p $parents($id) {
- if {![info exists treediffs([list $id $p])]} {
- append diffsneeded "$id $p\n"
- lappend fdiffsneeded [list $id $p]
- }
+ if {![info exists treediffs($id)]} {
+ append diffsneeded "$id\n"
+ lappend fdiffsneeded $id
}
}
if {[incr l] >= $numcommits} {
}
}
if {[incr l] >= $numcommits} {
@@
-1974,7
+1972,7
@@
proc findfiles {} {
error_popup "Error starting search process: $err"
return
}
error_popup "Error starting search process: $err"
return
}
- catch {unset fdiffid
s
}
+ catch {unset fdiffid}
set fdiffpos 0
fconfigure $df -blocking 0
fileevent $df readable [list readfilediffs $df]
set fdiffpos 0
fconfigure $df -blocking 0
fileevent $df readable [list readfilediffs $df]
@@
-1983,16
+1981,15
@@
proc findfiles {} {
set finddidsel 0
set findinsertpos end
set id $lineid($l)
set finddidsel 0
set findinsertpos end
set id $lineid($l)
- set p [lindex $parents($id) 0]
. config -cursor watch
settextcursor watch
set findinprogress 1
. config -cursor watch
settextcursor watch
set findinprogress 1
- findcont
[list $id $p]
+ findcont
$id
update
}
proc readfilediffs {df} {
update
}
proc readfilediffs {df} {
- global findid
s fdiffids
fdiffs
+ global findid
fdiffid
fdiffs
set n [gets $df line]
if {$n < 0} {
set n [gets $df line]
if {$n < 0} {
@@
-2002,19
+1999,19
@@
proc readfilediffs {df} {
stopfindproc
bell
error_popup "Error in git-diff-tree: $err"
stopfindproc
bell
error_popup "Error in git-diff-tree: $err"
- } elseif {[info exists findid
s
]} {
- set id
s $findids
+ } elseif {[info exists findid]} {
+ set id
$findid
stopfindproc
bell
stopfindproc
bell
- error_popup "Couldn't find diffs for
{$ids}
"
+ error_popup "Couldn't find diffs for
$id
"
}
}
return
}
}
}
return
}
- if {[regexp {^([0-9a-f]{40})
\(from ([0-9a-f]{40})\)} $line match id p
]} {
+ if {[regexp {^([0-9a-f]{40})
$} $line match id
]} {
# start of a new string of diffs
donefilediff
# start of a new string of diffs
donefilediff
- set fdiffid
s [list $id $p]
+ set fdiffid
$id
set fdiffs {}
} elseif {[string match ":*" $line]} {
lappend fdiffs [lindex $line 5]
set fdiffs {}
} elseif {[string match ":*" $line]} {
lappend fdiffs [lindex $line 5]
@@
-2022,53
+2019,50
@@
proc readfilediffs {df} {
}
proc donefilediff {} {
}
proc donefilediff {} {
- global fdiffid
s fdiffs treediffs findids
+ global fdiffid
fdiffs treediffs findid
global fdiffsneeded fdiffpos
global fdiffsneeded fdiffpos
- if {[info exists fdiffid
s
]} {
- while {[lindex $fdiffsneeded $fdiffpos] ne $fdiffid
s
+ if {[info exists fdiffid]} {
+ while {[lindex $fdiffsneeded $fdiffpos] ne $fdiffid
&& $fdiffpos < [llength $fdiffsneeded]} {
# git-diff-tree doesn't output anything for a commit
# which doesn't change anything
&& $fdiffpos < [llength $fdiffsneeded]} {
# git-diff-tree doesn't output anything for a commit
# which doesn't change anything
- set nullid
s
[lindex $fdiffsneeded $fdiffpos]
- set treediffs($nullid
s
) {}
- if {[info exists findid
s] && $nullids eq $findids
} {
- unset findid
s
- findcont $nullid
s
+ set nullid [lindex $fdiffsneeded $fdiffpos]
+ set treediffs($nullid) {}
+ if {[info exists findid
] && $nullid eq $findid
} {
+ unset findid
+ findcont $nullid
}
incr fdiffpos
}
incr fdiffpos
}
incr fdiffpos
}
incr fdiffpos
- if {![info exists treediffs($fdiffid
s
)]} {
- set treediffs($fdiffid
s
) $fdiffs
+ if {![info exists treediffs($fdiffid)]} {
+ set treediffs($fdiffid) $fdiffs
}
}
- if {[info exists findid
s] && $fdiffids eq $findids
} {
- unset findid
s
- findcont $fdiffid
s
+ if {[info exists findid
] && $fdiffid eq $findid
} {
+ unset findid
+ findcont $fdiffid
}
}
}
}
}
}
-proc findcont {id
s
} {
- global findid
s
treediffs parents nparents
+proc findcont {id} {
+ global findid treediffs parents nparents
global ffileline findstartline finddidsel
global lineid numcommits matchinglines findinprogress
global findmergefiles
global ffileline findstartline finddidsel
global lineid numcommits matchinglines findinprogress
global findmergefiles
- set id [lindex $ids 0]
- set p [lindex $ids 1]
- set pi [lsearch -exact $parents($id) $p]
set l $ffileline
while 1 {
if {$findmergefiles || $nparents($id) == 1} {
set l $ffileline
while 1 {
if {$findmergefiles || $nparents($id) == 1} {
- if {![info exists treediffs($id
s
)]} {
- set findid
s $ids
+ if {![info exists treediffs($id)]} {
+ set findid
$id
set ffileline $l
return
}
set doesmatch 0
set ffileline $l
return
}
set doesmatch 0
- foreach f $treediffs($id
s
) {
+ foreach f $treediffs($id) {
set x [findmatches $f]
if {$x != {}} {
set doesmatch 1
set x [findmatches $f]
if {$x != {}} {
set doesmatch 1
@@
-2077,21
+2071,13
@@
proc findcont {ids} {
}
if {$doesmatch} {
insertmatch $l $id
}
if {$doesmatch} {
insertmatch $l $id
- set pi $nparents($id)
}
}
- } else {
- set pi $nparents($id)
}
}
- if {[incr pi] >= $nparents($id)} {
- set pi 0
- if {[incr l] >= $numcommits} {
- set l 0
- }
- if {$l == $findstartline} break
- set id $lineid($l)
+ if {[incr l] >= $numcommits} {
+ set l 0
}
}
- set p [lindex $parents($id) $pi]
- set id
s [list $id $p]
+ if {$l == $findstartline} break
+ set id
$lineid($l)
}
stopfindproc
if {!$finddidsel} {
}
stopfindproc
if {!$finddidsel} {