disable core.symlinks explicitly on crippled filesystem

Needed to make git annex drop work on cygwin, where git keeps it enabled.
I think git can indeed make symlinks on Cygwin, due to being linked to
the library. git-annex, however, cannot.
This commit is contained in:
Joey Hess 2013-05-13 19:48:44 -05:00
parent 1093302eba
commit 9df0799df2

12
Init.hs Normal file → Executable file
View file

@ -18,6 +18,7 @@ module Init (
import Common.Annex
import Utility.TempFile
import Utility.Network
import qualified Annex
import qualified Git
import qualified Git.LsFiles
import qualified Git.Config
@ -117,6 +118,8 @@ preCommitScript = unlines
, "git annex pre-commit ."
]
{- A crippled filesystem is one that does not allow making symlinks,
- or removing write access from files. -}
probeCrippledFileSystem :: Annex Bool
probeCrippledFileSystem = do
#ifdef __WINDOWS__
@ -147,6 +150,7 @@ checkCrippledFileSystem :: Annex ()
checkCrippledFileSystem = whenM probeCrippledFileSystem $ do
warning "Detected a crippled filesystem."
setCrippledFileSystem True
unlessM isDirect $ do
warning "Enabling direct mode."
top <- fromRepo Git.repoPath
@ -157,6 +161,14 @@ checkCrippledFileSystem = whenM probeCrippledFileSystem $ do
setDirect True
setVersion directModeVersion
{- Normally git disables core.symlinks itself when the filesystem does
- not support them, but in Cygwin, git does support symlinks, while
- git-annex, not linking with Cygwin, does not. -}
whenM (coreSymlinks <$> Annex.getGitConfig) $ do
warning "Disabling core.symlinks."
setConfig (ConfigKey "core.symlinks")
(Git.Config.boolConfig False)
probeFifoSupport :: Annex Bool
probeFifoSupport = do
#ifdef __WINDOWS__