88
-message $msg
89
}
90
91
+proc info_popup {msg} {
92
+ global gitdir appname
93
+
94
+ set title $appname
95
+ if {$gitdir != {}} {
96
+ append title { (}
97
+ append title [lindex \
98
+ [file split [file normalize [file dirname $gitdir]]] \
99
+ end]
100
+ append title {)}
101
+ }
102
+ tk_messageBox \
103
+ -parent . \
104
+ -icon error \
105
+ -type ok \
106
+ -title $title \
107
+ -message $msg
108
+}
109
+
110
######################################################################
111
##
112
## repository setup
223
} else {
224
set status_active 1
225
set ui_status_value {Refreshing file status...}
207
- set fd_rf [open "| git update-index -q --unmerged --refresh" r]
226
+ set cmd [list git update-index]
227
+ lappend cmd -q
228
+ lappend cmd --unmerged
229
+ lappend cmd --ignore-missing
230
+ lappend cmd --refresh
231
+ set fd_rf [open "| $cmd" r]
232
fconfigure $fd_rf -blocking 0 -translation binary
233
fileevent $fd_rf readable \
234
[list update_status_stage2 $fd_rf $final]
405
}
406
}
407
408
+proc handle_empty_diff {} {
409
+ global ui_fname_value file_states file_lists
410
+
411
+ set path $ui_fname_value
412
+ set s $file_states($path)
413
+ if {[lindex $s 0] != {_M}} return
414
+
415
+ info_popup "No differences detected.
416
+
417
+[short_path $path] has no changes.
418
+
419
+The modification date of this file was updated by another
420
+application and you currently have the Trust File Modification
421
+Timestamps feature enabled, so Git did not automatically detect
422
+that there are no content differences in this file.
423
+
424
+This file will now be removed from the modified files list, to
425
+prevent possible confusion.
426
+"
427
+ if {[catch {exec git update-index -- $path} err]} {
428
+ error_popup "Failed to refresh index:\n\n$err"
429
+ }
430
+
431
+ clear_diff
432
+ set old_w [mapcol [lindex $file_states($path) 0] $path]
433
+ set lno [lsearch -sorted $file_lists($old_w) $path]
434
+ if {$lno >= 0} {
435
+ set file_lists($old_w) \
436
+ [lreplace $file_lists($old_w) $lno $lno]
437
+ incr lno
438
+ $old_w conf -state normal
439
+ $old_w delete $lno.0 [expr $lno + 1].0
440
+ $old_w conf -state disabled
441
+ }
442
+}
443
+
444
proc show_diff {path {w {}} {lno {}}} {
445
global file_states file_lists
446
global PARENT diff_3way diff_active
511
512
proc read_diff {fd} {
513
global ui_diff ui_status_value diff_3way diff_active
514
+ global cfg_trust_mtime
515
516
while {[gets $fd line] >= 0} {
517
if {[string match {diff --git *} $line]} continue
558
set diff_active 0
559
unlock_index
560
set ui_status_value {Ready.}
561
+
562
+ if {$cfg_trust_mtime && [$ui_diff index end] == {2.0}} {
563
+ handle_empty_diff
564
+ }
565
}
566
}
567
653
U? {
654
error_popup "Unmerged files cannot be committed.
655
591
-File [escape_path $path] has merge conflicts.
656
+File [short_path $path] has merge conflicts.
657
You must resolve them and include the file before committing.
658
"
659
unlock_index
662
default {
663
error_popup "Unknown file state [lindex $s 0] detected.
664
600
-File [escape_path $path] cannot be committed by this program.
665
+File [short_path $path] cannot be committed by this program.
666
"
667
}
668
}
953
return $path
954
}
955
956
+proc short_path {path} {
957
+ return [escape_path [lindex [file split $path] end]]
958
+}
959
+
960
set next_icon_id 0
961
962
proc merge_state {path new_state} {
990
}
991
992
proc display_file {path state} {
924
- global ui_index ui_other
993
global file_states file_lists status_active
994
995
set old_m [merge_state $path $state]