]> asedeno.scripts.mit.edu Git - git.git/blobdiff - lib/diff.tcl
git-gui: handle "deleted symlink" diff marker
[git.git] / lib / diff.tcl
index e09e1257e1be299caceb0c6f0074c1b43b566974..a1d5e523d2efd900c96c7905f8b0d6b76f4b2f32 100644 (file)
@@ -85,11 +85,16 @@ proc show_diff {path w {lno {}}} {
        if {$m eq {_O}} {
                set max_sz [expr {128 * 1024}]
                if {[catch {
-                               set fd [open $path r]
-                               fconfigure $fd -eofchar {}
-                               set content [read $fd $max_sz]
-                               close $fd
-                               set sz [file size $path]
+                               if {[file type $path] == {link}} {
+                                       set content [file readlink $path]
+                                       set sz [string length $content]
+                               } else {
+                                       set fd [open $path r]
+                                       fconfigure $fd -eofchar {}
+                                       set content [read $fd $max_sz]
+                                       close $fd
+                                       set sz [file size $path]
+                               }
                        } err ]} {
                        set diff_active 0
                        unlock_index
@@ -198,6 +203,7 @@ proc read_diff {fd} {
                if {[string match {mode *} $line]
                        || [string match {new file *} $line]
                        || [string match {deleted file *} $line]
+                       || [string match {deleted symlink} $line]
                        || [string match {Binary files * and * differ} $line]
                        || $line eq {\ No newline at end of file}
                        || [regexp {^\* Unmerged path } $line]} {