summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d070c4c)
raw | patch | inline | side by side (parent: d070c4c)
author | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 26 Jan 2007 02:33:06 +0000 (21:33 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 26 Jan 2007 05:41:01 +0000 (00:41 -0500) |
I just noticed that a file was always jumping to compare against HEAD
and the index during a refresh, even if the diff viewer was comparing
the index against the working directory prior to the refresh. The
bug turned out to be caused by a foreach loop going through all file
list names searching for the path. Since $ui_index was the first one
searched and the file was contained in that file list the loop broke
out, leaving $w set to $ui_index when it had been set by the caller
to $ui_workdir. Silly bug caused by using a parameter as a loop
index.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
and the index during a refresh, even if the diff viewer was comparing
the index against the working directory prior to the refresh. The
bug turned out to be caused by a foreach loop going through all file
list names searching for the path. Since $ui_index was the first one
searched and the file was contained in that file list the loop broke
out, leaving $w set to $ui_index when it had been set by the caller
to $ui_workdir. Silly bug caused by using a parameter as a loop
index.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index faae6ce7c5007b037088849bb096b912c6b6fb46..b0a195ce8a16a4a9868b5f23376af1f44759f7e3 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
if {$diff_active || ![lock_index read]} return
clear_diff
- if {$w eq {} || $lno == {}} {
- foreach w [array names file_lists] {
- set lno [lsearch -sorted $file_lists($w) $path]
- if {$lno >= 0} {
- incr lno
- break
- }
+ if {$lno == {}} {
+ set lno [lsearch -sorted $file_lists($w) $path]
+ if {$lno >= 0} {
+ incr lno
}
}
- if {$w ne {} && $lno >= 1} {
+ if {$lno >= 1} {
$w tag add in_diff $lno.0 [expr {$lno + 1}].0
}