add --force-small: Don't dereference link when checking file status
authorKyle Meyer <kyle@kyleam.com>
Mon, 23 Mar 2020 19:45:15 +0000 (15:45 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 26 Mar 2020 17:11:27 +0000 (13:11 -0400)
addSmallOverridden calls getFileStatus and then checks the result with
isSymbolicLink.  getFileStatus dereferences symbolic links, so
isSymbolicLink will always return false (assuming the getFileStatus
call doesn't fail on a broken link).  Use getSymbolicLinkStatus
instead.

Command/Add.hs

index e142aac0bca2f32a1baac3b6eb832137a9158f5a..56e6fb2361dbe75eaa38074fa790bddc5e5e7b06 100644 (file)
@@ -107,7 +107,7 @@ addSmallOverridden :: RawFilePath -> Annex Bool
 addSmallOverridden file = do
        showNote "adding content to git repository"
        let file' = fromRawFilePath file
-       s <- liftIO $ getFileStatus file'
+       s <- liftIO $ getSymbolicLinkStatus file'
        if isSymbolicLink s
                then addFile file 
                else do