avoid some build warnings on windows
This commit is contained in:
		
					parent
					
						
							
								42bdaaa5d7
							
						
					
				
			
			
				commit
				
					
						53fd746705
					
				
			
		
					 6 changed files with 15 additions and 5 deletions
				
			
		| 
						 | 
					@ -48,10 +48,10 @@ import Annex.Perms
 | 
				
			||||||
import Utility.FileMode
 | 
					import Utility.FileMode
 | 
				
			||||||
import System.Posix.User
 | 
					import System.Posix.User
 | 
				
			||||||
import qualified Utility.LockFile.Posix as Posix
 | 
					import qualified Utility.LockFile.Posix as Posix
 | 
				
			||||||
 | 
					import Data.Either
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import qualified Data.Map as M
 | 
					import qualified Data.Map as M
 | 
				
			||||||
import Data.Either
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
checkCanInitialize :: Annex a -> Annex a
 | 
					checkCanInitialize :: Annex a -> Annex a
 | 
				
			||||||
checkCanInitialize a = inRepo (noAnnexFileContent . Git.repoWorkTree) >>= \case
 | 
					checkCanInitialize a = inRepo (noAnnexFileContent . Git.repoWorkTree) >>= \case
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -83,5 +83,7 @@ preferredBundledPrograms = catMaybes
 | 
				
			||||||
	-- its kernel, and avoid using them if not available.
 | 
						-- its kernel, and avoid using them if not available.
 | 
				
			||||||
	]
 | 
						]
 | 
				
			||||||
  where
 | 
					  where
 | 
				
			||||||
 | 
					#ifndef mingw32_HOST_OS
 | 
				
			||||||
	ifset True s = Just s
 | 
						ifset True s = Just s
 | 
				
			||||||
	ifset False _ = Nothing
 | 
						ifset False _ = Nothing
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,11 @@ seek = withWords (commandAction . start)
 | 
				
			||||||
-- This runs as root, so avoid making any commits or initializing
 | 
					-- This runs as root, so avoid making any commits or initializing
 | 
				
			||||||
-- git-annex, or doing other things that create root-owned files.
 | 
					-- git-annex, or doing other things that create root-owned files.
 | 
				
			||||||
start :: [String] -> CommandStart
 | 
					start :: [String] -> CommandStart
 | 
				
			||||||
 | 
					#ifndef mingw32_HOST_OS
 | 
				
			||||||
start os = do
 | 
					start os = do
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					start _os = do
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	uuid <- getUUID
 | 
						uuid <- getUUID
 | 
				
			||||||
	when (uuid == NoUUID) $
 | 
						when (uuid == NoUUID) $
 | 
				
			||||||
		giveup "This can only be run in a git-annex repository."
 | 
							giveup "This can only be run in a git-annex repository."
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,7 +42,6 @@ import qualified CmdLine.GitAnnexShell.Fields as Fields
 | 
				
			||||||
import Logs.Location
 | 
					import Logs.Location
 | 
				
			||||||
import Utility.Metered
 | 
					import Utility.Metered
 | 
				
			||||||
import Utility.CopyFile
 | 
					import Utility.CopyFile
 | 
				
			||||||
import Utility.FileMode
 | 
					 | 
				
			||||||
import Utility.Env
 | 
					import Utility.Env
 | 
				
			||||||
import Utility.Batch
 | 
					import Utility.Batch
 | 
				
			||||||
import Utility.SimpleProtocol
 | 
					import Utility.SimpleProtocol
 | 
				
			||||||
| 
						 | 
					@ -61,6 +60,10 @@ import Types.NumCopies
 | 
				
			||||||
import Annex.Action
 | 
					import Annex.Action
 | 
				
			||||||
import Messages.Progress
 | 
					import Messages.Progress
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef mingw32_HOST_OS
 | 
				
			||||||
 | 
					import Utility.FileMode
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import Control.Concurrent
 | 
					import Control.Concurrent
 | 
				
			||||||
import Control.Concurrent.MSampleVar
 | 
					import Control.Concurrent.MSampleVar
 | 
				
			||||||
import qualified Data.Map as M
 | 
					import qualified Data.Map as M
 | 
				
			||||||
| 
						 | 
					@ -719,13 +722,14 @@ newCopyCoWTried = CopyCoWTried <$> newEmptyMVar
 | 
				
			||||||
{- Copys a file. Uses copy-on-write if it is supported. Otherwise,
 | 
					{- Copys a file. Uses copy-on-write if it is supported. Otherwise,
 | 
				
			||||||
 - uses rsync, so that interrupted copies can be resumed. -}
 | 
					 - uses rsync, so that interrupted copies can be resumed. -}
 | 
				
			||||||
rsyncOrCopyFile :: State -> [CommandParam] -> FilePath -> FilePath -> MeterUpdate -> Annex Bool
 | 
					rsyncOrCopyFile :: State -> [CommandParam] -> FilePath -> FilePath -> MeterUpdate -> Annex Bool
 | 
				
			||||||
rsyncOrCopyFile st rsyncparams src dest p =
 | 
					 | 
				
			||||||
#ifdef mingw32_HOST_OS
 | 
					#ifdef mingw32_HOST_OS
 | 
				
			||||||
 | 
					rsyncOrCopyFile _st _rsyncparams src dest p =
 | 
				
			||||||
	-- rsync is only available on Windows in some installation methods,
 | 
						-- rsync is only available on Windows in some installation methods,
 | 
				
			||||||
	-- and is not strictly needed here, so don't use it.
 | 
						-- and is not strictly needed here, so don't use it.
 | 
				
			||||||
	docopywith copyFileExternal
 | 
						docopywith copyFileExternal
 | 
				
			||||||
  where
 | 
					  where
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 | 
					rsyncOrCopyFile st rsyncparams src dest p =
 | 
				
			||||||
	-- If multiple threads reach this at the same time, they
 | 
						-- If multiple threads reach this at the same time, they
 | 
				
			||||||
	-- will both try CoW, which is acceptable.
 | 
						-- will both try CoW, which is acceptable.
 | 
				
			||||||
	ifM (liftIO $ isEmptyMVar copycowtried)
 | 
						ifM (liftIO $ isEmptyMVar copycowtried)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -170,7 +170,9 @@ genInodeCache f delta = catchDefaultIO Nothing $
 | 
				
			||||||
toInodeCache :: TSDelta -> FilePath -> FileStatus -> IO (Maybe InodeCache)
 | 
					toInodeCache :: TSDelta -> FilePath -> FileStatus -> IO (Maybe InodeCache)
 | 
				
			||||||
toInodeCache (TSDelta getdelta) f s
 | 
					toInodeCache (TSDelta getdelta) f s
 | 
				
			||||||
	| isRegularFile s = do
 | 
						| isRegularFile s = do
 | 
				
			||||||
 | 
					#ifndef mingw32_HOST_OS
 | 
				
			||||||
		delta <- getdelta
 | 
							delta <- getdelta
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
		sz <- getFileSize' f s
 | 
							sz <- getFileSize' f s
 | 
				
			||||||
#ifdef mingw32_HOST_OS
 | 
					#ifdef mingw32_HOST_OS
 | 
				
			||||||
		mtime <- MTimeHighRes . utcTimeToPOSIXSeconds <$> getModificationTime f
 | 
							mtime <- MTimeHighRes . utcTimeToPOSIXSeconds <$> getModificationTime f
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,8 +10,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module Utility.Path.Max where
 | 
					module Utility.Path.Max where
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import System.FilePath
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef mingw32_HOST_OS
 | 
					#ifndef mingw32_HOST_OS
 | 
				
			||||||
import Utility.Exception
 | 
					import Utility.Exception
 | 
				
			||||||
import System.Posix.Files
 | 
					import System.Posix.Files
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue