summaryrefslogtreecommitdiff
path: root/git-gui/lib/diff.tcl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-10-27 21:55:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-10-27 21:55:37 (GMT)
commit4096958aab6f83302dd00f19d2bd500ae75e8c29 (patch)
treec231a97c24ca3b7653fa0542bcfe90f141f1d1e9 /git-gui/lib/diff.tcl
parent610f99ec7d22b5750f12350f67c1341d6be8030f (diff)
parentacb9108c19e40b0477b8c828d1c5054665abbaf4 (diff)
downloadgit-4096958aab6f83302dd00f19d2bd500ae75e8c29.zip
git-4096958aab6f83302dd00f19d2bd500ae75e8c29.tar.gz
git-4096958aab6f83302dd00f19d2bd500ae75e8c29.tar.bz2
Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui: git-gui: adjust the minimum height of diff pane for shorter screen height git-gui: fix use of uninitialized variable git-gui: store wm state and fix wm geometry git-gui: Ensure submodule path is quoted properly git-gui: fix diff for partially staged submodule changes git-gui: Update russian translation git-gui: Limit display to a maximum number of files git-gui: remove warning when deleting correctly merged remote branch git-gui: Added Greek translation & glossary git-gui: display summary when showing diff of a submodule
Diffstat (limited to 'git-gui/lib/diff.tcl')
-rw-r--r--git-gui/lib/diff.tcl32
1 files changed, 30 insertions, 2 deletions
diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
index 925b3f5..bd5d189 100644
--- a/git-gui/lib/diff.tcl
+++ b/git-gui/lib/diff.tcl
@@ -255,7 +255,7 @@ proc show_other_diff {path w m cont_info} {
proc start_show_diff {cont_info {add_opts {}}} {
global file_states file_lists
- global is_3way_diff diff_active repo_config
+ global is_3way_diff is_submodule_diff diff_active repo_config
global ui_diff ui_index ui_workdir
global current_diff_path current_diff_side current_diff_header
@@ -265,6 +265,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
set s $file_states($path)
set m [lindex $s 0]
set is_3way_diff 0
+ set is_submodule_diff 0
set diff_active 1
set current_diff_header {}
@@ -295,6 +296,16 @@ proc start_show_diff {cont_info {add_opts {}}} {
lappend cmd $path
}
+ if {[string match {160000 *} [lindex $s 2]]
+ || [string match {160000 *} [lindex $s 3]]} {
+ set is_submodule_diff 1
+ if {$w eq $ui_index} {
+ set cmd [list submodule summary --cached -- $path]
+ } else {
+ set cmd [list submodule summary --files -- $path]
+ }
+ }
+
if {[catch {set fd [eval git_read --nice $cmd]} err]} {
set diff_active 0
unlock_index
@@ -312,7 +323,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
}
proc read_diff {fd cont_info} {
- global ui_diff diff_active
+ global ui_diff diff_active is_submodule_diff
global is_3way_diff is_conflict_diff current_diff_header
global current_diff_queue
global diff_empty_count
@@ -374,6 +385,23 @@ proc read_diff {fd cont_info} {
set tags {}
}
}
+ } elseif {$is_submodule_diff} {
+ if {$line == ""} continue
+ if {[regexp {^\* } $line]} {
+ set line [string replace $line 0 1 {Submodule }]
+ set tags d_@
+ } else {
+ set op [string range $line 0 2]
+ switch -- $op {
+ { <} {set tags d_-}
+ { >} {set tags d_+}
+ { W} {set tags {}}
+ default {
+ puts "error: Unhandled submodule diff marker: {$op}"
+ set tags {}
+ }
+ }
+ }
} else {
set op [string index $line 0]
switch -- $op {