summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichele Ballabio <barra_cuda@katamail.com>2007-09-09 19:04:45 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-09-09 23:47:22 (GMT)
commit2d19f8e921a1cdc562783814747819b0d5a12641 (patch)
tree4b2565cb9c1f6d3a20dce7601bad34a862fb44de /lib
parentc63fe3b2dc90120a4bdba7194f92efc2f3c342ed (diff)
downloadgit-2d19f8e921a1cdc562783814747819b0d5a12641.zip
git-2d19f8e921a1cdc562783814747819b0d5a12641.tar.gz
git-2d19f8e921a1cdc562783814747819b0d5a12641.tar.bz2
git-gui: show unstaged symlinks in diff viewer
git-gui has a minor problem with regards to symlinks that point to directories. git init mkdir realdir ln -s realdir linkdir git gui Now clicking on file names in the "unstaged changes" window, there's a problem coming from the "linkdir" symlink: git-gui complains with error reading "file4": illegal operation on a directory ...even though git-gui can add that same symlink to the index just fine. This patch fix this by adding a check. [sp: Minor fix to use {link} instead of "link" in condition and to only open the path if it is not a symlink.] Signed-off-by: Michele Ballabio <barra_cuda@katamail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/diff.tcl15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/diff.tcl b/lib/diff.tcl
index e09e125..9eeff2e 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -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