* [PATCH RESEND] Teach gitk to display dirty submodules correctly
@ 2010-04-09 20:16 Jens Lehmann
2010-04-17 8:56 ` Paul Mackerras
0 siblings, 1 reply; 4+ messages in thread
From: Jens Lehmann @ 2010-04-09 20:16 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Git Mailing List, Junio C Hamano
Since recently "git diff --submodule" prints out extra lines when the
submodule contains untracked or modified files. Show all those lines of
one submodule under the same header.
Also for newly added or removed submodules the submodule name contained
trailing garbage because the extraction of the name was not done right.
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
---
I didn't receive a response in the last two weeks, so here is a resend.
No need to test for the version of the underlying git here, as the
string "Submodule" does not appear in the diff output when older git
versions are used and the changed code is not executed at all in this
case (except for setting the new "currdiffsubmod" variable to the
empty string, but that doesn't have any negative side effects).
gitk-git/gitk | 29 +++++++++++++++++++++--------
1 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index 1f36a3e..36a9dcf 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -7501,7 +7501,7 @@ proc getblobdiffs {ids} {
global ignorespace
global limitdiffs vfilelimit curview
global diffencoding targetline diffnparents
- global git_version
+ global git_version currdiffsubmod
set textconv {}
if {[package vcompare $git_version "1.6.1"] >= 0} {
@@ -7528,6 +7528,7 @@ proc getblobdiffs {ids} {
set diffencoding [get_path_encoding {}]
fconfigure $bdf -blocking 0 -encoding binary -eofchar {}
set blobdifffd($ids) $bdf
+ set currdiffsubmod ""
filerun $bdf [list getblobdiffline $bdf $diffids]
}
@@ -7598,7 +7599,7 @@ proc getblobdiffline {bdf ids} {
global diffnexthead diffnextnote difffilestart
global ctext_file_names ctext_file_lines
global diffinhdr treediffs mergemax diffnparents
- global diffencoding jump_to_here targetline diffline
+ global diffencoding jump_to_here targetline diffline currdiffsubmod
set nr 0
$ctext conf -state normal
@@ -7679,19 +7680,30 @@ proc getblobdiffline {bdf ids} {
} elseif {![string compare -length 10 "Submodule " $line]} {
# start of a new submodule
- if {[string compare [$ctext get "end - 4c" end] "\n \n\n"]} {
+ if {[regexp -indices "\[0-9a-f\]+\\.\\." $line nameend]} {
+ set fname [string range $line 10 [expr [lindex $nameend 0] - 2]]
+ } else {
+ set fname [string range $line 10 [expr [string first "contains " $line] - 2]]
+ }
+ if {$currdiffsubmod != $fname} {
$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
+ if {$currdiffsubmod != $fname} {
+ lappend ctext_file_lines $fname
+ makediffhdr $fname $ids
+ set currdiffsubmod $fname
+ $ctext insert end "\n$line\n" filesep
+ } else {
+ $ctext insert end "$line\n" filesep
+ }
} elseif {![string compare -length 3 " >" $line]} {
+ set $currdiffsubmod ""
set line [encoding convertfrom $diffencoding $line]
$ctext insert end "$line\n" dresult
} elseif {![string compare -length 3 " <" $line]} {
+ set $currdiffsubmod ""
set line [encoding convertfrom $diffencoding $line]
$ctext insert end "$line\n" d0
} elseif {$diffinhdr} {
@@ -8527,7 +8539,7 @@ proc do_cmp_commits {a b} {
}
proc diffcommits {a b} {
- global diffcontext diffids blobdifffd diffinhdr
+ global diffcontext diffids blobdifffd diffinhdr currdiffsubmod
set tmpdir [gitknewtmpdir]
set fna [file join $tmpdir "commit-[string range $a 0 7]"]
@@ -8548,6 +8560,7 @@ proc diffcommits {a b} {
set diffids [list commits $a $b]
set blobdifffd($diffids) $fd
set diffinhdr 0
+ set currdiffsubmod ""
filerun $fd [list getblobdiffline $fd $diffids]
}
--
1.7.0.2.448.g45e29
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RESEND] Teach gitk to display dirty submodules correctly
2010-04-09 20:16 [PATCH RESEND] Teach gitk to display dirty submodules correctly Jens Lehmann
@ 2010-04-17 8:56 ` Paul Mackerras
2010-04-17 16:53 ` Junio C Hamano
0 siblings, 1 reply; 4+ messages in thread
From: Paul Mackerras @ 2010-04-17 8:56 UTC (permalink / raw)
To: Jens Lehmann; +Cc: Git Mailing List, Junio C Hamano
On Fri, Apr 09, 2010 at 10:16:42PM +0200, Jens Lehmann wrote:
> Since recently "git diff --submodule" prints out extra lines when the
> submodule contains untracked or modified files. Show all those lines of
> one submodule under the same header.
>
> Also for newly added or removed submodules the submodule name contained
> trailing garbage because the extraction of the name was not done right.
>
> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
> ---
Thanks, applied.
I changed the subject line to "gitk: Display dirty submodules
correctly" to fit in with the usual style.
Paul.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RESEND] Teach gitk to display dirty submodules correctly
2010-04-17 8:56 ` Paul Mackerras
@ 2010-04-17 16:53 ` Junio C Hamano
2010-04-19 1:10 ` Paul Mackerras
0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2010-04-17 16:53 UTC (permalink / raw)
To: Paul Mackerras
Cc: Jens Lehmann, Mark Hills, Pat Thoyts, Jonathan Nieder,
Git Mailing List
Paul Mackerras <paulus@samba.org> writes:
> Thanks, applied.
Thanks. Is it a good time to pull?
Here are the list of things that I would be getting if I did so:
Jens Lehmann (2):
gitk: Add Ctrl-W shortcut for closing the active window
gitk: Display dirty submodules correctly
Jonathan Nieder (2):
gitk: Add comments to explain encode_view_opts and decode_view_opts
gitk: Don't clobber "Remember this view" setting
Mark Hills (4):
gitk: Remove forced use of sans-serif font
gitk: Set the font for all spinbox widgets
gitk: Set the font for all listbox widgets
gitk: Use consistent font for all text input fields
Pat Thoyts (3):
gitk: Avoid calling tk_setPalette on Windows
gitk: Add emacs editor variable block
gitk: Fix display of copyright symbol
gitk-git/gitk | 72 ++++++++++++++++++++++++++++++++--------------------
gitk-git/po/de.po | 4 +-
gitk-git/po/es.po | 4 +-
gitk-git/po/fr.po | 4 +-
gitk-git/po/hu.po | 4 +-
gitk-git/po/it.po | 4 +-
gitk-git/po/ja.po | 4 +-
gitk-git/po/ru.po | 4 +-
gitk-git/po/sv.po | 4 +-
9 files changed, 60 insertions(+), 44 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RESEND] Teach gitk to display dirty submodules correctly
2010-04-17 16:53 ` Junio C Hamano
@ 2010-04-19 1:10 ` Paul Mackerras
0 siblings, 0 replies; 4+ messages in thread
From: Paul Mackerras @ 2010-04-19 1:10 UTC (permalink / raw)
To: Junio C Hamano
Cc: Jens Lehmann, Mark Hills, Pat Thoyts, Jonathan Nieder,
Git Mailing List
On Sat, Apr 17, 2010 at 09:53:55AM -0700, Junio C Hamano wrote:
> Thanks. Is it a good time to pull?
Yes, I think so, thanks.
Paul.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-04-19 1:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-09 20:16 [PATCH RESEND] Teach gitk to display dirty submodules correctly Jens Lehmann
2010-04-17 8:56 ` Paul Mackerras
2010-04-17 16:53 ` Junio C Hamano
2010-04-19 1:10 ` Paul Mackerras
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).