From: Max Kirillov <max@max630.net>
To: Paul Mackerras <paulus@samba.org>
Cc: git@vger.kernel.org
Subject: [PATCH v2 1/4] gitk: use single blamestuff for all show_line_source{} calls
Date: Tue, 24 Jun 2014 21:18:04 +0300 [thread overview]
Message-ID: <20140624181738.GA23114@wheezy.local> (raw)
In-Reply-To: <20140624181514.GA23051@wheezy.local>
There seems to be no point to search for several origins at once.
Probably is is not even fully working (because there is one blameinst),
but blamestuff for some reason is an array. Also, it is not cleaned
after blame is completed.
Signed-off-by: Max Kirillov <max@max630.net>
---
gitk | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/gitk b/gitk
index 41e5071..8ef6aa8 100755
--- a/gitk
+++ b/gitk
@@ -3824,17 +3824,18 @@ proc show_line_source {} {
nowbusy blaming [mc "Searching"]
fconfigure $f -blocking 0
set i [reg_instance $f]
- set blamestuff($i) {}
+ set blamestuff {}
set blameinst $i
filerun $f [list read_line_source $f $i]
}
proc stopblaming {} {
- global blameinst
+ global blameinst blamestuff
if {[info exists blameinst]} {
stop_instance $blameinst
unset blameinst
+ unset blamestuff
notbusy blaming
}
}
@@ -3843,7 +3844,7 @@ proc read_line_source {fd inst} {
global blamestuff curview commfd blameinst nullid nullid2
while {[gets $fd line] >= 0} {
- lappend blamestuff($inst) $line
+ lappend blamestuff $line
}
if {![eof $fd]} {
return 1
@@ -3854,17 +3855,18 @@ proc read_line_source {fd inst} {
fconfigure $fd -blocking 1
if {[catch {close $fd} err]} {
error_popup [mc "Error running git blame: %s" $err]
+ unset blamestuff
return 0
}
set fname {}
- set line [split [lindex $blamestuff($inst) 0] " "]
+ set line [split [lindex $blamestuff 0] " "]
set id [lindex $line 0]
set lnum [lindex $line 1]
if {[string length $id] == 40 && [string is xdigit $id] &&
[string is digit -strict $lnum]} {
# look for "filename" line
- foreach l $blamestuff($inst) {
+ foreach l $blamestuff {
if {[string match "filename *" $l]} {
set fname [string range $l 9 end]
break
@@ -3887,6 +3889,7 @@ proc read_line_source {fd inst} {
} else {
puts "oops couldn't parse git blame output"
}
+ unset blamestuff
return 0
}
--
2.0.0.526.g5318336
next prev parent reply other threads:[~2014-06-24 18:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-24 18:15 [PATCH 0/4 v2] gitk: show latest change to region Max Kirillov
2014-06-24 18:18 ` Max Kirillov [this message]
2014-06-24 18:19 ` [PATCH v2 2/4] gitk: refactor: separate generic hunk parsing out of find_hunk_blamespecs{} Max Kirillov
2014-06-24 18:20 ` [PATCH v2 3/4] gitk: refactor: separate io from logic in the searching origin of line Max Kirillov
2014-06-24 18:21 ` [PATCH v2 4/4] gitk: show latest change to region Max Kirillov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140624181738.GA23114@wheezy.local \
--to=max@max630.net \
--cc=git@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).