{"thread":{"id":"23400","subject":"[PATCH RESEND] Teach gitk to display dirty submodules correctly","startedAt":"2010-04-09T20:16:42Z","lastAt":"2010-04-19T01:10:32Z","messageCount":4,"participants":["Jens Lehmann","Paul Mackerras","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"139071","messageId":"4BBF8B2A.5090208@web.de","threadId":"23400","inReplyTo":null,"subject":"[PATCH RESEND] Teach gitk to display dirty submodules correctly","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-04-09T20:16:42Z","receivedAt":"2010-04-09T20:16:42Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Since recently \"git diff --submodule\" prints out extra lines when the\nsubmodule contains untracked or modified files. Show all those lines of\none submodule under the same header.\n\nAlso for newly added or removed submodules the submodule name contained\ntrailing garbage because the extraction of the name was not done right.\n\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n\nI didn't receive a response in the last two weeks, so here is a resend.\n\nNo need to test for the version of the underlying git here, as the\nstring \"Submodule\" does not appear in the diff output when older git\nversions are used and the changed code is not executed at all in this\ncase (except for setting the new \"currdiffsubmod\" variable to the\nempty string, but that doesn't have any negative side effects).\n\n gitk-git/gitk |   29 +++++++++++++++++++++--------\n 1 files changed, 21 insertions(+), 8 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 1f36a3e..36a9dcf 100644\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -7501,7 +7501,7 @@ proc getblobdiffs {ids} {\n     global ignorespace\n     global limitdiffs vfilelimit curview\n     global diffencoding targetline diffnparents\n-    global git_version\n+    global git_version currdiffsubmod\n\n     set textconv {}\n     if {[package vcompare $git_version \"1.6.1\"] >= 0} {\n@@ -7528,6 +7528,7 @@ proc getblobdiffs {ids} {\n     set diffencoding [get_path_encoding {}]\n     fconfigure $bdf -blocking 0 -encoding binary -eofchar {}\n     set blobdifffd($ids) $bdf\n+    set currdiffsubmod \"\"\n     filerun $bdf [list getblobdiffline $bdf $diffids]\n }\n\n@@ -7598,7 +7599,7 @@ proc getblobdiffline {bdf ids} {\n     global diffnexthead diffnextnote difffilestart\n     global ctext_file_names ctext_file_lines\n     global diffinhdr treediffs mergemax diffnparents\n-    global diffencoding jump_to_here targetline diffline\n+    global diffencoding jump_to_here targetline diffline currdiffsubmod\n\n     set nr 0\n     $ctext conf -state normal\n@@ -7679,19 +7680,30 @@ proc getblobdiffline {bdf ids} {\n\n \t} elseif {![string compare -length 10 \"Submodule \" $line]} {\n \t    # start of a new submodule\n-\t    if {[string compare [$ctext get \"end - 4c\" end] \"\\n \\n\\n\"]} {\n+\t    if {[regexp -indices \"\\[0-9a-f\\]+\\\\.\\\\.\" $line nameend]} {\n+\t\tset fname [string range $line 10 [expr [lindex $nameend 0] - 2]]\n+\t    } else {\n+\t\tset fname [string range $line 10 [expr [string first \"contains \" $line] - 2]]\n+\t    }\n+\t    if {$currdiffsubmod != $fname} {\n \t\t$ctext insert end \"\\n\";     # Add newline after commit message\n \t    }\n \t    set curdiffstart [$ctext index \"end - 1c\"]\n \t    lappend ctext_file_names \"\"\n-\t    set fname [string range $line 10 [expr [string last \" \" $line] - 1]]\n-\t    lappend ctext_file_lines $fname\n-\t    makediffhdr $fname $ids\n-\t    $ctext insert end \"\\n$line\\n\" filesep\n+\t    if {$currdiffsubmod != $fname} {\n+\t\tlappend ctext_file_lines $fname\n+\t\tmakediffhdr $fname $ids\n+\t\tset currdiffsubmod $fname\n+\t\t$ctext insert end \"\\n$line\\n\" filesep\n+\t    } else {\n+\t\t$ctext insert end \"$line\\n\" filesep\n+\t    }\n \t} elseif {![string compare -length 3 \"  >\" $line]} {\n+\t    set $currdiffsubmod \"\"\n \t    set line [encoding convertfrom $diffencoding $line]\n \t    $ctext insert end \"$line\\n\" dresult\n \t} elseif {![string compare -length 3 \"  <\" $line]} {\n+\t    set $currdiffsubmod \"\"\n \t    set line [encoding convertfrom $diffencoding $line]\n \t    $ctext insert end \"$line\\n\" d0\n \t} elseif {$diffinhdr} {\n@@ -8527,7 +8539,7 @@ proc do_cmp_commits {a b} {\n }\n\n proc diffcommits {a b} {\n-    global diffcontext diffids blobdifffd diffinhdr\n+    global diffcontext diffids blobdifffd diffinhdr currdiffsubmod\n\n     set tmpdir [gitknewtmpdir]\n     set fna [file join $tmpdir \"commit-[string range $a 0 7]\"]\n@@ -8548,6 +8560,7 @@ proc diffcommits {a b} {\n     set diffids [list commits $a $b]\n     set blobdifffd($diffids) $fd\n     set diffinhdr 0\n+    set currdiffsubmod \"\"\n     filerun $fd [list getblobdiffline $fd $diffids]\n }\n\n-- \n1.7.0.2.448.g45e29\n"},{"id":"139726","messageId":"20100417085600.GD6681@brick.ozlabs.ibm.com","threadId":"23400","inReplyTo":"4BBF8B2A.5090208@web.de","subject":"Re: [PATCH RESEND] Teach gitk to display dirty submodules correctly","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2010-04-17T08:56:00Z","receivedAt":"2010-04-17T08:56:00Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Fri, Apr 09, 2010 at 10:16:42PM +0200, Jens Lehmann wrote:\n\n> Since recently \"git diff --submodule\" prints out extra lines when the\n> submodule contains untracked or modified files. Show all those lines of\n> one submodule under the same header.\n> \n> Also for newly added or removed submodules the submodule name contained\n> trailing garbage because the extraction of the name was not done right.\n> \n> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n> ---\n\nThanks, applied.\n\nI changed the subject line to \"gitk: Display dirty submodules\ncorrectly\" to fit in with the usual style.\n\nPaul.\n"},{"id":"139756","messageId":"7vzl122f6k.fsf@alter.siamese.dyndns.org","threadId":"23400","inReplyTo":"20100417085600.GD6681@brick.ozlabs.ibm.com","subject":"Re: [PATCH RESEND] Teach gitk to display dirty submodules correctly","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-04-17T16:53:55Z","receivedAt":"2010-04-17T16:53:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Mackerras <paulus@samba.org> writes:\n\n> Thanks, applied.\n\nThanks.  Is it a good time to pull?\n\nHere are the list of things that I would be getting if I did so:\n\nJens Lehmann (2):\n      gitk: Add Ctrl-W shortcut for closing the active window\n      gitk: Display dirty submodules correctly\n\nJonathan Nieder (2):\n      gitk: Add comments to explain encode_view_opts and decode_view_opts\n      gitk: Don't clobber \"Remember this view\" setting\n\nMark Hills (4):\n      gitk: Remove forced use of sans-serif font\n      gitk: Set the font for all spinbox widgets\n      gitk: Set the font for all listbox widgets\n      gitk: Use consistent font for all text input fields\n\nPat Thoyts (3):\n      gitk: Avoid calling tk_setPalette on Windows\n      gitk: Add emacs editor variable block\n      gitk: Fix display of copyright symbol\n\n gitk-git/gitk     |   72 ++++++++++++++++++++++++++++++++--------------------\n gitk-git/po/de.po |    4 +-\n gitk-git/po/es.po |    4 +-\n gitk-git/po/fr.po |    4 +-\n gitk-git/po/hu.po |    4 +-\n gitk-git/po/it.po |    4 +-\n gitk-git/po/ja.po |    4 +-\n gitk-git/po/ru.po |    4 +-\n gitk-git/po/sv.po |    4 +-\n 9 files changed, 60 insertions(+), 44 deletions(-)\n"},{"id":"139861","messageId":"20100419011032.GB4386@brick.ozlabs.ibm.com","threadId":"23400","inReplyTo":"7vzl122f6k.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH RESEND] Teach gitk to display dirty submodules correctly","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2010-04-19T01:10:32Z","receivedAt":"2010-04-19T01:10:32Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"On Sat, Apr 17, 2010 at 09:53:55AM -0700, Junio C Hamano wrote:\n\n> Thanks.  Is it a good time to pull?\n\nYes, I think so, thanks.\n\nPaul.\n"}]}