summaryrefslogtreecommitdiff
path: root/git-gui/lib/blame.tcl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-01-08 19:17:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-01-08 19:18:06 (GMT)
commitfe47c9cb5f98e305a15db24b8a9f62151ae65d8d (patch)
tree7efca0534124565539fe12f47f847fdc3980f0d3 /git-gui/lib/blame.tcl
parent042ed3e048af08014487d19196984347e3be7d1c (diff)
parent0d2116c6441079a5a1091e4cf152fd9d5fa9811b (diff)
downloadgit-fe47c9cb5f98e305a15db24b8a9f62151ae65d8d.zip
git-fe47c9cb5f98e305a15db24b8a9f62151ae65d8d.tar.gz
git-fe47c9cb5f98e305a15db24b8a9f62151ae65d8d.tar.bz2
Merge https://github.com/prati0100/git-gui
* https://github.com/prati0100/git-gui: git-gui: allow opening currently selected file in default app git-gui: allow closing console window with Escape git gui: fix branch name encoding error git-gui: revert untracked files by deleting them git-gui: update status bar to track operations git-gui: consolidate naming conventions
Diffstat (limited to 'git-gui/lib/blame.tcl')
-rw-r--r--git-gui/lib/blame.tcl24
1 files changed, 17 insertions, 7 deletions
diff --git a/git-gui/lib/blame.tcl b/git-gui/lib/blame.tcl
index a1aeb8b..62ec083 100644
--- a/git-gui/lib/blame.tcl
+++ b/git-gui/lib/blame.tcl
@@ -24,6 +24,7 @@ field w_cviewer ; # pane showing commit message
field finder ; # find mini-dialog frame
field gotoline ; # line goto mini-dialog frame
field status ; # status mega-widget instance
+field status_operation ; # operation displayed by status mega-widget
field old_height ; # last known height of $w.file_pane
@@ -274,6 +275,7 @@ constructor new {i_commit i_path i_jump} {
pack $w_cviewer -expand 1 -fill both
set status [::status_bar::new $w.status]
+ set status_operation {}
menu $w.ctxm -tearoff 0
$w.ctxm add command \
@@ -602,16 +604,23 @@ method _exec_blame {cur_w cur_d options cur_s} {
} else {
lappend options $commit
}
+
+ # We may recurse in from another call to _exec_blame and already have
+ # a status operation.
+ if {$status_operation == {}} {
+ set status_operation [$status start \
+ $cur_s \
+ [mc "lines annotated"]]
+ } else {
+ $status_operation restart $cur_s
+ }
+
lappend options -- $path
set fd [eval git_read --nice blame $options]
fconfigure $fd -blocking 0 -translation lf -encoding utf-8
fileevent $fd readable [cb _read_blame $fd $cur_w $cur_d]
set current_fd $fd
set blame_lines 0
-
- $status start \
- $cur_s \
- [mc "lines annotated"]
}
method _read_blame {fd cur_w cur_d} {
@@ -806,10 +815,11 @@ method _read_blame {fd cur_w cur_d} {
[mc "Loading original location annotations..."]
} else {
set current_fd {}
- $status stop [mc "Annotation complete."]
+ $status_operation stop [mc "Annotation complete."]
+ set status_operation {}
}
} else {
- $status update $blame_lines $total_lines
+ $status_operation update $blame_lines $total_lines
}
} ifdeleted { catch {close $fd} }
@@ -1124,7 +1134,7 @@ method _blameparent {} {
set diffcmd [list diff-tree --unified=0 $cparent $cmit -- $new_path]
}
if {[catch {set fd [eval git_read $diffcmd]} err]} {
- $status stop [mc "Unable to display parent"]
+ $status_operation stop [mc "Unable to display parent"]
error_popup [strcat [mc "Error loading diff:"] "\n\n$err"]
return
}