From: Jens Lehmann <Jens.Lehmann@web.de>
To: Paul Mackerras <paulus@samba.org>, Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH v2] gitk: Use the --submodule option for displaying diffs when available
Date: Wed, 28 Oct 2009 12:40:45 +0100 [thread overview]
Message-ID: <4AE82DBD.5070202@web.de> (raw)
In-Reply-To: <19175.49800.697048.349753@drongo.ozlabs.ibm.com>
Instead of just showing not-quite-helpful SHA-1 pairs in the diff display
of a submodule gitk will display the first lines of the corresponding
commit messages (similar to the output of 'git submodule summary') when
the underlying git installation supports this. That makes it much easier
to evaluate the changes, as it eliminates the need to start a gitk inside
the submodule and use the superprojects hashes there to find out what the
commits are about.
This patch applies to 'next' - which will be 1.6.6 or 1.7.0 when merged -
and uses the new --submodule option of git diff when a version of 1.6.6 or
higher is detected to achieve a more human readable output of submodule
differences in gitk.
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
Thanks for the review of the first version of this patch. I tried to
address all the issues raised and moved the additions of the --submodule
flag to the getblobdiffs procedure, where the --textconv flag is handled
too.
gitk-git/gitk | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index a0214b7..b06cac7 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -7343,7 +7343,11 @@ proc getblobdiffs {ids} {
if {[package vcompare $git_version "1.6.1"] >= 0} {
set textconv "--textconv"
}
- set cmd [diffcmd $ids "-p $textconv -C --cc --no-commit-id -U$diffcontext"]
+ set submodule {}
+ if {[package vcompare $git_version "1.6.6"] >= 0} {
+ set submodule "--submodule"
+ }
+ set cmd [diffcmd $ids "-p $textconv $submodule -C --cc --no-commit-id -U$diffcontext"]
if {$ignorespace} {
append cmd " -w"
}
@@ -7481,6 +7485,21 @@ proc getblobdiffline {bdf ids} {
set diffnparents [expr {[string length $ats] - 1}]
set diffinhdr 0
+ } elseif {![string compare -length 10 "Submodule " $line]} {
+ # start of a new submodule
+ if {[string compare [$ctext get "end - 4c" end] "\n \n\n"]} {
+ $ctext insert end "\n"; # Add newline after commit message
+ }
+ set curdiffstart [$ctext index "end - 1c"]
+ lappend ctext_file_names ""
+ set fname [string range $line 10 [expr [string last " " $line] - 1]]
+ lappend ctext_file_lines $fname
+ makediffhdr $fname $ids
+ $ctext insert end "\n$line\n" filesep
+ } elseif {![string compare -length 3 " >" $line]} {
+ $ctext insert end "$line\n" dresult
+ } elseif {![string compare -length 3 " <" $line]} {
+ $ctext insert end "$line\n" d0
} elseif {$diffinhdr} {
if {![string compare -length 12 "rename from " $line]} {
set fname [string range $line [expr 6 + [string first " from " $line] ] end]
--
1.6.5.2.182.g3d976.dirty
next prev parent reply other threads:[~2009-10-28 11:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-27 14:59 [PATCH] gitk: Use the --submodule option for diffs Jens Lehmann
2009-10-27 15:41 ` Johannes Schindelin
2009-10-28 4:03 ` Paul Mackerras
2009-10-28 11:40 ` Jens Lehmann [this message]
2009-11-03 11:32 ` [PATCH v2] gitk: Use the --submodule option for displaying diffs when available Paul Mackerras
2009-10-28 7:19 ` [PATCH] gitk: Use the --submodule option for diffs Junio C Hamano
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=4AE82DBD.5070202@web.de \
--to=jens.lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--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).