Done using a mode witness, which ensures it's fixed everywhere. Fixing catFileKey was a bear, because git cat-file does not provide a nice way to query for the mode of a file and there is no other efficient way to do it. Oh, for libgit2.. Note that I am looking at tree objects from HEAD, rather than the index. Because I cat-file cannot show a tree object for the index. So this fix is technically incomplete. The only cases where it matters are: 1. A new large file has been directly staged in git, but not committed. 2. A file that was committed to HEAD as a symlink has been staged directly in the index. This could be fixed a lot better using libgit2.
		
			
				
	
	
		
			23 lines
		
	
	
	
		
			529 B
			
		
	
	
	
		
			Haskell
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
	
		
			529 B
			
		
	
	
	
		
			Haskell
		
	
	
	
	
	
{- git file modes
 | 
						|
 -
 | 
						|
 - Copyright 2013 Joey Hess <joey@kitenet.net>
 | 
						|
 -
 | 
						|
 - Licensed under the GNU GPL version 3 or higher.
 | 
						|
 -}
 | 
						|
 | 
						|
{-# LANGUAGE CPP #-}
 | 
						|
 | 
						|
module Git.FileMode where
 | 
						|
 | 
						|
import Utility.FileMode
 | 
						|
 | 
						|
import System.PosixCompat.Types
 | 
						|
 | 
						|
symLinkMode :: FileMode
 | 
						|
symLinkMode = 40960
 | 
						|
 | 
						|
{- Git uses a special file mode to indicate a symlink. This is the case
 | 
						|
 - even on Windows, so we hard code the valuse here, rather than using
 | 
						|
 - System.Posix.Files.symbolicLinkMode. -}
 | 
						|
isSymLink :: FileMode -> Bool
 | 
						|
isSymLink = checkMode symLinkMode
 |