summaryrefslogtreecommitdiff
path: root/git-gui.sh
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-25 22:38:59 -0500
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2007-01-26 00:41:01 -0500
commit156b29211ae4f8143f143fd6cce6e93b60c51f43 (patch)
treee79ab695b1ce93ec65f8a4c608e4e75dff8aca0e /git-gui.sh
parentgit-gui: Maintain the same file list for diff during refresh. (diff)
downloadtgif-156b29211ae4f8143f143fd6cce6e93b60c51f43.tar.xz
git-gui: Always use lsearch -exact, to prevent globbing.
Anytime we are using lsearch we are doing [lsearch -sorted] and we are applying it to file paths (or file path like things). Its valid for these to contain special glob characters, but when that happens we do not want globbing to occur. Instead we really need exact match semantics. Always supplying -exact to lsearch will ensure that is the case. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/git-gui.sh b/git-gui.sh
index b0a195ce8a..b203c56a98 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -568,7 +568,7 @@ proc reshow_diff {} {
if {$p eq {}
|| $current_diff_side eq {}
|| [catch {set s $file_states($p)}]
- || [lsearch -sorted $file_lists($current_diff_side) $p] == -1} {
+ || [lsearch -sorted -exact $file_lists($current_diff_side) $p] == -1} {
clear_diff
} else {
show_diff $p $current_diff_side
@@ -608,7 +608,7 @@ proc show_diff {path w {lno {}}} {
clear_diff
if {$lno == {}} {
- set lno [lsearch -sorted $file_lists($w) $path]
+ set lno [lsearch -sorted -exact $file_lists($w) $path]
if {$lno >= 0} {
incr lno
}
@@ -1427,7 +1427,7 @@ proc display_file_helper {w path icon_name old_m new_m} {
global file_lists
if {$new_m eq {_}} {
- set lno [lsearch -sorted $file_lists($w) $path]
+ set lno [lsearch -sorted -exact $file_lists($w) $path]
if {$lno >= 0} {
set file_lists($w) [lreplace $file_lists($w) $lno $lno]
incr lno
@@ -1438,7 +1438,7 @@ proc display_file_helper {w path icon_name old_m new_m} {
} elseif {$old_m eq {_} && $new_m ne {_}} {
lappend file_lists($w) $path
set file_lists($w) [lsort -unique $file_lists($w)]
- set lno [lsearch -sorted $file_lists($w) $path]
+ set lno [lsearch -sorted -exact $file_lists($w) $path]
incr lno
$w conf -state normal
$w image create $lno.0 \
@@ -2142,7 +2142,7 @@ Delete the selected branches?}
if {[catch {exec git update-ref -d "refs/heads/$b" $o} err]} {
append failed " - $b: $err\n"
} else {
- set x [lsearch -sorted $all_heads $b]
+ set x [lsearch -sorted -exact $all_heads $b]
if {$x >= 0} {
set all_heads [lreplace $all_heads $x $x]
}