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
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 -exact $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
}
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
} 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 \
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]
}
return
}
+ # -- Don't do a pointless switch.
+ #
+ if {$current_branch eq $new_branch} {
+ unlock_index
+ return
+ }
+
if {$repo_config(gui.trustmtime) eq {true}} {
switch_branch_stage2 {} $new_branch
} else {