From: Jens Lehmann <Jens.Lehmann@web.de>
To: Paul Mackerras <paulus@samba.org>
Cc: Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] gitk: Use the --submodule option for diffs
Date: Tue, 27 Oct 2009 15:59:21 +0100 [thread overview]
Message-ID: <4AE70AC9.6040302@web.de> (raw)
Instead of just showing not-quite-helpful SHA-1 pairs display the first
lines of the corresponding commit messages in the submodule (similar to
the output of 'git submodule summary').
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
This patch applies to 'next' and uses the new --submodule option of git
diff to achieve a more meaningful output of submodule differences in
gitk.
Any objections against making this the default?
(for those interested: a version of git gui with similar functionality
is available in 'master' of Shawn's repo but not yet merged).
gitk-git/gitk | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index a0214b7..5e2572d 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -7207,7 +7207,7 @@ proc diffcmd {ids flags} {
if {$i >= 0} {
if {[llength $ids] > 1 && $j < 0} {
# comparing working directory with some specific revision
- set cmd [concat | git diff-index $flags]
+ set cmd [concat | git diff-index --submodule $flags]
if {$i == 0} {
lappend cmd -R [lindex $ids 1]
} else {
@@ -7215,13 +7215,13 @@ proc diffcmd {ids flags} {
}
} else {
# comparing working directory with index
- set cmd [concat | git diff-files $flags]
+ set cmd [concat | git diff-files --submodule $flags]
if {$j == 1} {
lappend cmd -R
}
}
} elseif {$j >= 0} {
- set cmd [concat | git diff-index --cached $flags]
+ set cmd [concat | git diff-index --cached --submodule $flags]
if {[llength $ids] > 1} {
# comparing index with specific revision
if {$i == 0} {
@@ -7234,7 +7234,7 @@ proc diffcmd {ids flags} {
lappend cmd HEAD
}
} else {
- set cmd [concat | git diff-tree -r $flags $ids]
+ set cmd [concat | git diff-tree -r --submodule $flags $ids]
}
return $cmd
}
@@ -7481,6 +7481,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.g338ab.dirty
next reply other threads:[~2009-10-27 14:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-27 14:59 Jens Lehmann [this message]
2009-10-27 15:41 ` [PATCH] gitk: Use the --submodule option for diffs Johannes Schindelin
2009-10-28 4:03 ` Paul Mackerras
2009-10-28 11:40 ` [PATCH v2] gitk: Use the --submodule option for displaying diffs when available Jens Lehmann
2009-11-03 11:32 ` 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=4AE70AC9.6040302@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.