From: Yann Dirson <ydirson@altern.org>
To: git@vger.kernel.org
Subject: [PATCH] Re: Make "gitk" work better with dense revlists
Date: Tue, 15 Nov 2005 23:57:40 +0100 [thread overview]
Message-ID: <20051115225740.GB28173@nowhere.earth> (raw)
Linus wrote:
>To generate the diff for a commit, gitk used to do
>
> git-diff-tree -p -C $p $id
Although the "$p" reference is harmful to --dense mode, and redundant
when we just want to look at a single commit, removing it breaks the
"Diff this -> selected" and "Diff selected -> this" features.
A minimal fix would be at least make your change dependant on being in
dense mode, and disable those extra features then (better than keeping
them broken) if noone takes the lead to fix it.
Signed-off-by: Yann Dirson <ydirson@altern.org>
diff --git a/gitk b/gitk
index a9d37d9..f73ab41 100755
--- a/gitk
+++ b/gitk
@@ -2801,12 +2801,17 @@ proc addtocflist {ids} {
}
proc gettreediffs {ids} {
- global treediff parents treepending
+ global treediff parents treepending isdense
set treepending $ids
set treediff {}
set id [lindex $ids 0]
set p [lindex $ids 1]
- if [catch {set gdtf [open "|git-diff-tree -r $id" r]}] return
+ if {$isdense == 1} {
+ set range "$id"
+ } else {
+ set range "$p $id"
+ }
+ if [catch {set gdtf [open "|git-diff-tree -r $range" r]}] return
fconfigure $gdtf -blocking 0
fileevent $gdtf readable [list gettreediffline $gdtf $ids]
}
@@ -2837,12 +2842,16 @@ proc gettreediffline {gdtf ids} {
proc getblobdiffs {ids} {
global diffopts blobdifffd diffids env curdifftag curtagstart
- global difffilestart nextupdate diffinhdr treediffs
+ global difffilestart nextupdate diffinhdr treediffs isdense
set id [lindex $ids 0]
set p [lindex $ids 1]
set env(GIT_DIFF_OPTS) $diffopts
- set cmd [list | git-diff-tree -r -p -C $id]
+ if {$isdense == 1} {
+ set cmd [list | git-diff-tree -r -p -C $id]
+ } else {
+ set cmd [list | git-diff-tree -r -p -C $p $id]
+ }
if {[catch {set bdf [open $cmd r]} err]} {
puts "error getting diffs: $err"
return
@@ -3299,16 +3308,21 @@ proc mstime {} {
}
proc rowmenu {x y id} {
- global rowctxmenu idline selectedline rowmenuid
+ global rowctxmenu idline selectedline rowmenuid isdense
if {![info exists selectedline] || $idline($id) eq $selectedline} {
- set state disabled
+ set patchstate disabled
} else {
- set state normal
+ set patchstate normal
+ }
+ if {$isdense || $patchstate eq "disabled"} {
+ set diffstate disabled
+ } else {
+ set diffstate normal
}
- $rowctxmenu entryconfigure 0 -state $state
- $rowctxmenu entryconfigure 1 -state $state
- $rowctxmenu entryconfigure 2 -state $state
+ $rowctxmenu entryconfigure 0 -state $diffstate
+ $rowctxmenu entryconfigure 1 -state $diffstate
+ $rowctxmenu entryconfigure 2 -state $patchstate
set rowmenuid $id
tk_popup $rowctxmenu $x $y
}
@@ -3653,6 +3667,7 @@ proc doquit {} {
# defaults...
set datemode 0
set boldnames 0
+set isdense 0
set diffopts "-U 5 -p"
set wrcomcmd "git-diff-tree --stdin -p --pretty"
@@ -3678,6 +3693,10 @@ foreach arg $argv {
"^$" { }
"^-b" { set boldnames 1 }
"^-d" { set datemode 1 }
+ "^--dense$" {
+ set isdense 1
+ lappend revtreeargs $arg
+ }
default {
lappend revtreeargs $arg
}
--
Yann Dirson <ydirson@altern.org> |
Debian-related: <dirson@debian.org> | Support Debian GNU/Linux:
| Freedom, Power, Stability, Gratis
http://ydirson.free.fr/ | Check <http://www.debian.org/>
next reply other threads:[~2005-11-15 22:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-15 22:57 Yann Dirson [this message]
2005-11-19 22:48 ` [PATCH, take 2] Re: Make "gitk" work better with dense revlists Yann Dirson
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=20051115225740.GB28173@nowhere.earth \
--to=ydirson@altern.org \
--cc=git@vger.kernel.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).