diff options
| author | Junio C Hamano <gitster@pobox.com> | 2007-09-17 23:50:17 -0700 | 
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2007-09-17 23:50:17 -0700 | 
| commit | 9269df96105dff5ecc137b598ac7664d218ac6be (patch) | |
| tree | 388409bbe67fafc18e79ae49a394643636e0711b /git-gui/lib/diff.tcl | |
| parent | be510cfef3d8344007bd34128ca6eb799b714c8c (diff) | |
| parent | 3849bfba84fb5b0e9d46920f62105b4e1dd97e63 (diff) | |
| download | git-9269df96105dff5ecc137b598ac7664d218ac6be.tar.gz | |
Merge branch 'maint' of git://repo.or.cz/git-gui into maint
* 'maint' of git://repo.or.cz/git-gui:
  git-gui: Disable native platform text selection in "lists"
  git-gui: Paper bag fix "Commit->Revert" format arguments
  git-gui: Provide 'uninstall' Makefile target to undo an installation
  git-gui: Font chooser to handle a large number of font families
  git-gui: Make backporting changes from i18n version easier
  git-gui: Don't delete send on Windows as it doesn't exist
  git-gui: Trim trailing slashes from untracked submodule names
  git-gui: Assume untracked directories are Git submodules
  git-gui: handle "deleted symlink" diff marker
  git-gui: show unstaged symlinks in diff viewer
  git-gui: Avoid use of libdir in Makefile
  git-gui: Disable Tk send in all git-gui sessions
  git-gui: lib/index.tcl: handle files with % in the filename properly
  git-gui: Properly set the state of "Stage/Unstage Hunk" action
  git-gui: Fix detaching current branch during checkout
  git-gui: Correct starting of git-remote to handle -w option
Diffstat (limited to 'git-gui/lib/diff.tcl')
| -rw-r--r-- | git-gui/lib/diff.tcl | 33 | 
1 files changed, 27 insertions, 6 deletions
| diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl index e09e1257e1..694834ab7a 100644 --- a/git-gui/lib/diff.tcl +++ b/git-gui/lib/diff.tcl @@ -84,12 +84,30 @@ proc show_diff {path w {lno {}}} {  	#  	if {$m eq {_O}} {  		set max_sz [expr {128 * 1024}] +		set type unknown  		if {[catch { -				set fd [open $path r] -				fconfigure $fd -eofchar {} -				set content [read $fd $max_sz] -				close $fd -				set sz [file size $path] +				set type [file type $path] +				switch -- $type { +				directory { +					set type submodule +					set content {} +					set sz 0 +				} +				link { +					set content [file readlink $path] +					set sz [string length $content] +				} +				file { +					set fd [open $path r] +					fconfigure $fd -eofchar {} +					set content [read $fd $max_sz] +					close $fd +					set sz [file size $path] +				} +				default { +					error "'$type' not supported" +				} +				}  			} err ]} {  			set diff_active 0  			unlock_index @@ -98,7 +116,9 @@ proc show_diff {path w {lno {}}} {  			return  		}  		$ui_diff conf -state normal -		if {![catch {set type [exec file $path]}]} { +		if {$type eq {submodule}} { +			$ui_diff insert end "* Git Repository (subproject)\n" d_@ +		} elseif {![catch {set type [exec file $path]}]} {  			set n [string length $path]  			if {[string equal -length $n $path $type]} {  				set type [string range $type $n end] @@ -198,6 +218,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]} { | 
