##
## task management
-set status_active 0
+set rescan_active 0
set diff_active 0
set last_clicked {}
}
}
-proc rescan {{final Ready.}} {
+proc rescan {after} {
global HEAD PARENT commit_type
global ui_index ui_other ui_status_value ui_comm
- global status_active file_states
+ global rescan_active file_states
global repo_config
- if {$status_active || ![lock_index read]} return
+ if {$rescan_active > 0 || ![lock_index read]} return
repository_state new_HEAD new_type
if {$commit_type eq {amend}
}
if {$repo_config(gui.trustmtime) eq {true}} {
- rescan_stage2 {} $final
+ rescan_stage2 {} $after
} else {
- set status_active 1
+ set rescan_active 1
set ui_status_value {Refreshing file status...}
set cmd [list git update-index]
lappend cmd -q
set fd_rf [open "| $cmd" r]
fconfigure $fd_rf -blocking 0 -translation binary
fileevent $fd_rf readable \
- [list rescan_stage2 $fd_rf $final]
+ [list rescan_stage2 $fd_rf $after]
}
}
-proc rescan_stage2 {fd final} {
+proc rescan_stage2 {fd after} {
global gitdir PARENT commit_type
global ui_index ui_other ui_status_value ui_comm
- global status_active
+ global rescan_active
global buf_rdi buf_rdf buf_rlo
if {$fd ne {}} {
set buf_rdf {}
set buf_rlo {}
- set status_active 3
+ set rescan_active 3
set ui_status_value {Scanning for modified files ...}
set fd_di [open "| git diff-index --cached -z $PARENT" r]
set fd_df [open "| git diff-files -z" r]
fconfigure $fd_di -blocking 0 -translation binary
fconfigure $fd_df -blocking 0 -translation binary
fconfigure $fd_lo -blocking 0 -translation binary
- fileevent $fd_di readable [list read_diff_index $fd_di $final]
- fileevent $fd_df readable [list read_diff_files $fd_df $final]
- fileevent $fd_lo readable [list read_ls_others $fd_lo $final]
+ fileevent $fd_di readable [list read_diff_index $fd_di $after]
+ fileevent $fd_df readable [list read_diff_files $fd_df $after]
+ fileevent $fd_lo readable [list read_ls_others $fd_lo $after]
}
proc load_message {file} {
return 0
}
-proc read_diff_index {fd final} {
+proc read_diff_index {fd after} {
global buf_rdi
append buf_rdi [read $fd]
set buf_rdi {}
}
- status_eof $fd buf_rdi $final
+ rescan_done $fd buf_rdi $after
}
-proc read_diff_files {fd final} {
+proc read_diff_files {fd after} {
global buf_rdf
append buf_rdf [read $fd]
set buf_rdf {}
}
- status_eof $fd buf_rdf $final
+ rescan_done $fd buf_rdf $after
}
-proc read_ls_others {fd final} {
+proc read_ls_others {fd after} {
global buf_rlo
append buf_rlo [read $fd]
foreach p [lrange $pck 0 end-1] {
display_file $p _O
}
- status_eof $fd buf_rlo $final
+ rescan_done $fd buf_rlo $after
}
-proc status_eof {fd buf final} {
- global status_active ui_status_value
+proc rescan_done {fd buf after} {
+ global rescan_active
global file_states repo_config
upvar $buf to_clear
if {![eof $fd]} return
set to_clear {}
close $fd
- if {[incr status_active -1] > 0} return
+ if {[incr rescan_active -1] > 0} return
prune_selection
unlock_index
}
reshow_diff
- set ui_status_value $final
+ uplevel #0 $after
}
proc prune_selection {} {
set commit_type amend
set HEAD {}
set PARENT {}
- rescan
+ rescan {set ui_status_value {Ready.}}
} elseif {$parent_count == 1} {
set commit_type amend
set PARENT $parent
$ui_comm insert end $msg
$ui_comm edit modified false
$ui_comm edit reset
- rescan
+ rescan {set ui_status_value {Ready.}}
} else {
error_popup {You can't amend a merge commit.}
return
before committing.
}
unlock_index
- rescan
+ rescan {set ui_status_value {Ready.}}
return
}
before a pull can be started.
}
unlock_index
- rescan
+ rescan {set ui_status_value {Ready.}}
return
}
if {$success} {
repository_state HEAD commit_type
set PARENT $HEAD
- set $ui_status_value {Ready.}
+ set $ui_status_value "Pulling $branch from $remote complete."
} else {
- rescan \
- "Conflicts detected while pulling $branch from $remote."
+ set m "Conflicts detected while pulling $branch from $remote."
+ rescan "set ui_status_value {$m}"
}
}
}
proc display_file {path state} {
- global file_states file_lists selected_paths status_active
+ global file_states file_lists selected_paths rescan_active
set old_m [merge_state $path $state]
- if {$status_active} return
+ if {$rescan_active > 0} return
set s $file_states($path)
set new_m [lindex $s 0]
}
proc do_rescan {} {
- rescan
+ rescan {set ui_status_value {Ready.}}
}
proc do_include_all {} {
populate_remote_menu .mbar.push To push_to
populate_pull_menu .mbar.pull
}
-after 1 rescan
+after 1 do_rescan