aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-11-04 21:09:00 +1100
committerPaul Mackerras <paulus@samba.org>2008-11-04 21:09:00 +1100
commit48a81b7cda1e58d8cc4d9bcadce76bbf1680ab7d (patch)
tree55f3847f80dda163415178cb5e2797a676f1f966
parentfc4977e1b989503c6dcfbc527cda2458d63d0400 (diff)
downloadgit-48a81b7cda1e58d8cc4d9bcadce76bbf1680ab7d.tar.gz
git-48a81b7cda1e58d8cc4d9bcadce76bbf1680ab7d.tar.xz
gitk: Cope with unmerged files in local changes
This modifies gettreediffline so that it when we get both a "U" line and an "M" line for the same file in the output from git diff-files or git diff-index --cached (used when the user clicks on a fake commit) we don't add the same filename to the treediff list twice. This also makes getblobdiffline recognize the "* Unmerged path ..." lines we get when we ask for the actual diffs, and makes a tiny optimization in makediffhdr. Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-xgitk20
1 files changed, 17 insertions, 3 deletions
diff --git a/gitk b/gitk
index f386981cc..bea5026f6 100755
--- a/gitk
+++ b/gitk
@@ -6854,8 +6854,10 @@ proc gettreediffline {gdtf ids} {
set file [lindex $file 0]
}
set file [encoding convertfrom $file]
- lappend treediff $file
- lappend sublist $file
+ if {$file ne [lindex $treediff end]} {
+ lappend treediff $file
+ lappend sublist $file
+ }
}
}
if {$perfile_attrs} {
@@ -6960,7 +6962,7 @@ proc makediffhdr {fname ids} {
if {$i >= 0} {
setinlist difffilestart $i $curdiffstart
}
- set ctext_file_names [lreplace $ctext_file_names end end $fname]
+ lset ctext_file_names end $fname
set l [expr {(78 - [string length $fname]) / 2}]
set pad [string range "----------------------------------------" 1 $l]
$ctext insert $curdiffstart "$pad $fname $pad" filesep
@@ -7033,6 +7035,18 @@ proc getblobdiffline {bdf ids} {
}
makediffhdr $fname $ids
+ } elseif {![string compare -length 16 "* Unmerged path " $line]} {
+ set fname [encoding convertfrom [string range $line 16 end]]
+ $ctext insert end "\n"
+ set curdiffstart [$ctext index "end - 1c"]
+ lappend ctext_file_names $fname
+ lappend ctext_file_lines [lindex [split $curdiffstart "."] 0]
+ $ctext insert end "$line\n" filesep
+ set i [lsearch -exact $treediffs($ids) $fname]
+ if {$i >= 0} {
+ setinlist difffilestart $i $curdiffstart
+ }
+
} elseif {![string compare -length 2 "@@" $line]} {
regexp {^@@+} $line ats
set line [encoding convertfrom $diffencoding $line]