@@ -7509,7 +7509,7 @@ proc getblobdiffs {ids} {
7509
7509
global ignorespace
7510
7510
global limitdiffs vfilelimit curview
7511
7511
global diffencoding targetline diffnparents
7512
- global git_version
7512
+ global git_version currdiffsubmod
7513
7513
7514
7514
set textconv {}
7515
7515
if {[package vcompare $git_version " 1.6.1" ] >= 0} {
@@ -7536,6 +7536,7 @@ proc getblobdiffs {ids} {
7536
7536
set diffencoding [get_path_encoding {}]
7537
7537
fconfigure $bdf -blocking 0 -encoding binary -eofchar {}
7538
7538
set blobdifffd($ids ) $bdf
7539
+ set currdiffsubmod " "
7539
7540
filerun $bdf [list getblobdiffline $bdf $diffids ]
7540
7541
}
7541
7542
@@ -7606,7 +7607,7 @@ proc getblobdiffline {bdf ids} {
7606
7607
global diffnexthead diffnextnote difffilestart
7607
7608
global ctext_file_names ctext_file_lines
7608
7609
global diffinhdr treediffs mergemax diffnparents
7609
- global diffencoding jump_to_here targetline diffline
7610
+ global diffencoding jump_to_here targetline diffline currdiffsubmod
7610
7611
7611
7612
set nr 0
7612
7613
$ctext conf -state normal
@@ -7687,19 +7688,30 @@ proc getblobdiffline {bdf ids} {
7687
7688
7688
7689
} elseif {![string compare -length 10 " Submodule " $line ]} {
7689
7690
# start of a new submodule
7690
- if {[string compare [$ctext get " end - 4c" end] " \n \n\n " ]} {
7691
+ if {[regexp -indices "\[ 0-9a-f\] +\\ .\\ ." $line nameend]} {
7692
+ set fname [string range $line 10 [expr [lindex $nameend 0] - 2]]
7693
+ } else {
7694
+ set fname [string range $line 10 [expr [string first " contains " $line ] - 2]]
7695
+ }
7696
+ if {$currdiffsubmod != $fname } {
7691
7697
$ctext insert end " \n " ; # Add newline after commit message
7692
7698
}
7693
7699
set curdiffstart [$ctext index " end - 1c" ]
7694
7700
lappend ctext_file_names " "
7695
- set fname [string range $line 10 [expr [string last " " $line ] - 1]]
7696
- lappend ctext_file_lines $fname
7697
- makediffhdr $fname $ids
7698
- $ctext insert end " \n $line \n " filesep
7701
+ if {$currdiffsubmod != $fname } {
7702
+ lappend ctext_file_lines $fname
7703
+ makediffhdr $fname $ids
7704
+ set currdiffsubmod $fname
7705
+ $ctext insert end " \n $line \n " filesep
7706
+ } else {
7707
+ $ctext insert end " $line \n " filesep
7708
+ }
7699
7709
} elseif {![string compare -length 3 " >" $line ]} {
7710
+ set $currdiffsubmod " "
7700
7711
set line [encoding convertfrom $diffencoding $line ]
7701
7712
$ctext insert end " $line \n " dresult
7702
7713
} elseif {![string compare -length 3 " <" $line ]} {
7714
+ set $currdiffsubmod " "
7703
7715
set line [encoding convertfrom $diffencoding $line ]
7704
7716
$ctext insert end " $line \n " d0
7705
7717
} elseif {$diffinhdr } {
@@ -8535,7 +8547,7 @@ proc do_cmp_commits {a b} {
8535
8547
}
8536
8548
8537
8549
proc diffcommits {a b} {
8538
- global diffcontext diffids blobdifffd diffinhdr
8550
+ global diffcontext diffids blobdifffd diffinhdr currdiffsubmod
8539
8551
8540
8552
set tmpdir [gitknewtmpdir]
8541
8553
set fna [file join $tmpdir " commit-[ string range $a 0 7] " ]
@@ -8556,6 +8568,7 @@ proc diffcommits {a b} {
8556
8568
set diffids [list commits $a $b ]
8557
8569
set blobdifffd($diffids ) $fd
8558
8570
set diffinhdr 0
8571
+ set currdiffsubmod " "
8559
8572
filerun $fd [list getblobdiffline $fd $diffids ]
8560
8573
}
8561
8574
0 commit comments