global HEAD PARENT commit_type
global ui_index ui_other ui_status_value ui_comm
global status_active file_states
+ global cfg_trust_mtime
if {$status_active || ![lock_index read]} return
$ui_comm edit modified false
}
- set status_active 1
- set ui_status_value {Refreshing file status...}
- set fd_rf [open "| git update-index -q --unmerged --refresh" r]
- fconfigure $fd_rf -blocking 0 -translation binary
- fileevent $fd_rf readable [list read_refresh $fd_rf $final]
+ if {$cfg_trust_mtime == {true}} {
+ update_status_stage2 {} $final
+ } else {
+ set status_active 1
+ set ui_status_value {Refreshing file status...}
+ set fd_rf [open "| git update-index -q --unmerged --refresh" r]
+ fconfigure $fd_rf -blocking 0 -translation binary
+ fileevent $fd_rf readable [list update_status_stage2 $fd_rf $final]
+ }
}
-proc read_refresh {fd final} {
+proc update_status_stage2 {fd final} {
global gitdir PARENT commit_type
global ui_index ui_other ui_status_value ui_comm
global status_active file_states
global buf_rdi buf_rdf buf_rlo
- read $fd
- if {![eof $fd]} return
- close $fd
+ if {$fd != {}} {
+ read $fd
+ if {![eof $fd]} return
+ close $fd
+ }
set ls_others [list | git ls-files --others -z \
--exclude-per-directory=.gitignore]
}
proc pull_remote {remote branch} {
+ if {![lock_index update]} return
set w [new_console "pull $remote $branch" \
"Pulling new changes from branch $branch in $remote"]
set cmd [list git pull]
}
proc post_pull_remote {remote branch success} {
+ unlock_index
if {$success} {
update_status "Successfully pulled $branch from $remote."
} else {
proc load_repo_config {} {
global repo_config
+ global cfg_trust_mtime
array unset repo_config
catch {
}
close $fd_rc
}
+
+ if {[catch {set cfg_trust_mtime $repo_config(gui.trustmtime)}]} {
+ set cfg_trust_mtime false
+ }
+}
+
+proc save_my_config {} {
+ global repo_config
+ global cfg_trust_mtime
+
+ if {[catch {set rc_trustMTime $repo_config(gui.trustmtime)}]} {
+ set rc_trustMTime false
+ }
+ if {$cfg_trust_mtime != $rc_trustMTime} {
+ exec git repo-config gui.trustMTime $cfg_trust_mtime
+ }
}
proc load_all_remotes {} {
}
proc populate_pull_menu {m} {
- global gitdir repo_config all_remotes mainfont
+ global gitdir repo_config all_remotes mainfont disable_on_lock
foreach remote $all_remotes {
set rb {}
-label "Branch $rb_short from $remote..." \
-command [list pull_remote $remote $rb] \
-font $mainfont
+ lappend disable_on_lock \
+ [list $m entryconf [$m index last] -state]
}
}
}
}
}
+proc do_repack {} {
+ set w [new_console "repack" "Repacking the object database"]
+ set cmd [list git repack]
+ lappend cmd -a
+ lappend cmd -d
+ console_exec $w $cmd
+}
+
proc do_quit {} {
global gitdir ui_comm
file delete $save
}
+ save_my_config
destroy .
}
.mbar add cascade -label Fetch -menu .mbar.fetch
.mbar add cascade -label Pull -menu .mbar.pull
.mbar add cascade -label Push -menu .mbar.push
+.mbar add cascade -label Options -menu .mbar.options
. configure -menu .mbar
# -- Project Menu
.mbar.project add command -label Visualize \
-command do_gitk \
-font $mainfont
+.mbar.project add command -label {Repack Database} \
+ -command do_repack \
+ -font $mainfont
.mbar.project add command -label Quit \
-command do_quit \
-accelerator $M1T-Q \
# -- Push Menu
menu .mbar.push
+# -- Options Menu
+menu .mbar.options
+.mbar.options add checkbutton -label {Trust File Modification Timestamps} \
+ -offvalue false \
+ -onvalue true \
+ -variable cfg_trust_mtime
+
# -- Main Window Layout
panedwindow .vpane -orient vertical
panedwindow .vpane.files -orient horizontal