packages feed

git-annex 5.20141219 → 5.20141231

raw patch · 61 files changed

+1962/−1672 lines, 61 files

Files

Annex/Init.hs view
@@ -32,14 +32,14 @@ import Annex.Direct import Annex.Content.Direct import Annex.Environment-import Annex.Perms import Backend+import Annex.Hook+import Upgrade #ifndef mingw32_HOST_OS import Utility.UserInfo import Utility.FileMode+import Annex.Perms #endif-import Annex.Hook-import Upgrade  genDescription :: Maybe String -> Annex String genDescription (Just d) = return d
Annex/Ssh.hs view
@@ -35,9 +35,9 @@ import Utility.Env import Types.CleanupActions import Annex.Index (addGitEnv)-import Utility.LockFile #ifndef mingw32_HOST_OS import Annex.Perms+import Utility.LockFile #endif  {- Generates parameters to ssh to a given host (or user@host) on a given
Annex/View/ViewedFile.hs view
@@ -5,6 +5,8 @@  - Licensed under the GNU GPL version 3 or higher.  -} +{-# LANGUAGE CPP #-}+ module Annex.View.ViewedFile ( 	ViewedFile, 	MkViewedFile,@@ -43,11 +45,19 @@  	{- To avoid collisions with filenames or directories that contain 	 - '%', and to allow the original directories to be extracted-	 - from the ViewedFile, '%' is escaped to '\%' (and '\' to '\\').+	 - from the ViewedFile, '%' is escaped. ) 	 -} 	escape :: String -> String-	escape = replace "%" "\\%" . replace "\\" "\\\\"+	escape = replace "%" (escchar:'%':[]) . replace [escchar] [escchar, escchar] +escchar :: Char+#ifndef mingw32_HOST_OS+escchar = '\\'+#else+-- \ is path separator on Windows, so instead use !+escchar = '!'+#endif+ {- For use when operating already within a view, so whatever filepath  - is present in the work tree is already a ViewedFile. -} viewedFileReuse :: MkViewedFile@@ -61,7 +71,7 @@ 	sep l _ [] = reverse l 	sep l curr (c:cs) 		| c == '%' = sep (reverse curr:l) "" cs-		| c == '\\' = case cs of+		| c == escchar = case cs of 			(c':cs') -> sep l (c':curr) cs' 			[] -> sep l curr cs 		| otherwise = sep l (c:curr) cs@@ -70,6 +80,7 @@ prop_viewedFile_roundtrips f 	-- Relative filenames wanted, not directories. 	| any (isPathSeparator) (end f ++ beginning f) = True+	| isAbsolute f = True 	| otherwise = dir == dirFromViewedFile (viewedFileFromReference f)   where 	dir = joinPath $ beginning $ splitDirectories f
Assistant/Install.hs view
@@ -22,7 +22,9 @@ import Utility.OSX #else import Utility.FreeDesktop+#ifdef linux_HOST_OS import Utility.UserInfo+#endif import Assistant.Install.Menu #endif 
Assistant/Threads/NetWatcher.hs view
@@ -15,10 +15,10 @@ import Utility.ThreadScheduler import qualified Types.Remote as Remote import Assistant.DaemonStatus-import Assistant.RemoteControl import Utility.NotificationBroadcaster  #if WITH_DBUS+import Assistant.RemoteControl import Utility.DBus import DBus.Client import DBus
Assistant/Threads/SanityChecker.hs view
@@ -40,15 +40,15 @@ import Logs.Unused import Logs.Transfer import Config.Files-import Utility.DiskFree+import Types.Key (keyBackendName) import qualified Annex #ifdef WITH_WEBAPP import Assistant.WebApp.Types #endif #ifndef mingw32_HOST_OS import Utility.LogFile+import Utility.DiskFree #endif-import Types.Key (keyBackendName)  import Data.Time.Clock.POSIX import qualified Data.Text as T
Assistant/WebApp/Configurators/Ssh.hs view
@@ -34,10 +34,6 @@ import Utility.ThreadScheduler import Utility.Env -#ifdef mingw32_HOST_OS-import Utility.Rsync-#endif- import qualified Data.Text as T import qualified Data.Map as M import Network.Socket
Assistant/WebApp/Configurators/XMPP.hs view
@@ -24,10 +24,10 @@ import Assistant.WebApp.RepoList import Assistant.WebApp.Configurators import Assistant.XMPP-#endif import qualified Git.Remote.Remove import Remote.List import Creds+#endif  #ifdef WITH_XMPP import Network.Protocol.XMPP
BuildFlags.hs view
@@ -86,7 +86,7 @@ #else #warning Building without CryptoHash. #endif-#ifdef WITH_TORRENTParser+#ifdef WITH_TORRENTPARSER 	, "TorrentParser" #else #warning Building without haskell torrent library; will instead use btshowmetainfo to parse torrent files.
CHANGELOG view
@@ -1,3 +1,20 @@+git-annex (5.20141231) unstable; urgency=medium++  * vicfg: Avoid crashing on badly encoded config data.+  * Work around statfs() overflow on some XFS systems.+  * sync: Now supports remote groups, the same way git remote update does.+  * setpresentkey: A new plumbing-level command.+  * Run shutdown cleanup actions even if there were failures processing+    the command. Among other fixes, this means that addurl will stage+    added files even if adding one of the urls fails.+  * bittorrent: Fix locking problem when using addurl file://+  * Windows: Fix local rsync filepath munging (fixes 26 test suite failures).+  * Windows: Got the rsync special remote working.+  * Windows: Fix handling of views of filenames containing '%'+  * OSX: Switched away from deprecated statfs64 interface.++ -- Joey Hess <id@joeyh.name>  Wed, 31 Dec 2014 15:15:46 -0400+ git-annex (5.20141219) unstable; urgency=medium    * Webapp: When adding a new box.com remote, use the new style chunking.
CmdLine.hs view
@@ -53,8 +53,8 @@ 			whenM (annexDebug <$> Annex.getGitConfig) $ 				liftIO enableDebugOutput 			startup-			performCommandAction cmd params-			shutdown $ cmdnocommit cmd+			performCommandAction cmd params $+				shutdown $ cmdnocommit cmd 	go _flags params (Left e) = do 		when fuzzy $ 			autocorrect =<< Git.Config.global
CmdLine/Action.hs view
@@ -17,13 +17,14 @@ type CommandActionRunner = CommandStart -> CommandCleanup  {- Runs a command, starting with the check stage, and then- - the seek stage. Finishes by printing the number of commandActions that- - failed. -}-performCommandAction :: Command -> CmdParams -> Annex ()-performCommandAction Command { cmdseek = seek, cmdcheck = c, cmdname = name } params = do+ - the seek stage. Finishes by running the continutation, and + - then showing a count of any failures. -}+performCommandAction :: Command -> CmdParams -> Annex () -> Annex ()+performCommandAction Command { cmdseek = seek, cmdcheck = c, cmdname = name } params cont = do 	mapM_ runCheck c 	Annex.changeState $ \s -> s { Annex.errcounter = 0 } 	seek params+	cont 	showerrcount =<< Annex.getState Annex.errcounter   where 	showerrcount 0 = noop
CmdLine/GitAnnex.hs view
@@ -27,6 +27,7 @@ import qualified Command.DropKey import qualified Command.TransferKey import qualified Command.TransferKeys+import qualified Command.SetPresentKey import qualified Command.ReKey import qualified Command.MetaData import qualified Command.View@@ -150,6 +151,7 @@ 	, Command.DropKey.cmd 	, Command.TransferKey.cmd 	, Command.TransferKeys.cmd+	, Command.SetPresentKey.cmd 	, Command.ReKey.cmd 	, Command.MetaData.cmd 	, Command.View.cmd
Command/AddUrl.hs view
@@ -210,7 +210,7 @@ 	| relaxed = do 		setUrlPresent u key url 		next $ return True-	| otherwise = ifM (elem url <$> getUrls key)+	| otherwise = ifM ((elem url <$> getUrls key) <&&> (elem u <$> loggedLocations key)) 		( next $ return True -- nothing to do 		, do 			(exists, samesize) <- checkexistssize key
+ Command/SetPresentKey.hs view
@@ -0,0 +1,35 @@+{- git-annex command+ -+ - Copyright 2014 Joey Hess <joey@kitenet.net>+ -+ - Licensed under the GNU GPL version 3 or higher.+ -}++module Command.SetPresentKey where++import Common.Annex+import Command+import Logs.Location+import Logs.Presence.Pure+import Types.Key++cmd :: [Command]+cmd = [noCommit $ command "setpresentkey" (paramPair paramKey (paramPair paramUUID "[1|0]")) seek+	SectionPlumbing "change records of where key is present"] ++seek :: CommandSeek+seek = withWords start++start :: [String] -> CommandStart+start (ks:us:vs:[]) = do+	showStart' "setpresentkey" k Nothing+	next $ perform k (toUUID us) s+  where+	k = fromMaybe (error "bad key") (file2key ks)+	s = fromMaybe (error "bad value") (parseStatus vs)+start _ = error "Wrong number of parameters"++perform :: Key -> UUID -> LogStatus -> CommandPerform+perform k u s = next $ do+	logChange k u s+	return True
Command/Sync.hs view
@@ -6,7 +6,17 @@  - Licensed under the GNU GPL version 3 or higher.  -} -module Command.Sync where+module Command.Sync (+	cmd,+	prepMerge,+	mergeLocal,+	mergeRemote,+	commitStaged,+	pushBranch,+	updateBranch,+	syncBranch,+	updateSyncBranch,+) where  import Common.Annex import Command@@ -109,16 +119,21 @@ syncRemotes rs = ifM (Annex.getState Annex.fast) ( nub <$> pickfast , wanted )   where 	pickfast = (++) <$> listed <*> (filterM good =<< fastest <$> available)+	 	wanted 		| null rs = filterM good =<< concat . Remote.byCost <$> available 		| otherwise = listed-	listed = catMaybes <$> mapM (Remote.byName . Just) rs+	+	listed = concat <$> mapM Remote.byNameOrGroup rs+	 	available = filter (remoteAnnexSync . Remote.gitconfig) 		. filter (not . Remote.isXMPPRemote) 		<$> Remote.remoteList+	 	good r 		| Remote.gitSyncableRemote r = Remote.Git.repoAvail $ Remote.repo r 		| otherwise = return True+	 	fastest = fromMaybe [] . headMaybe . Remote.byCost  commit :: CommandStart
Command/Vicfg.hs view
@@ -42,7 +42,7 @@ 	createAnnexDirectory $ parentDir f 	cfg <- getCfg 	descs <- uuidDescriptions-	liftIO $ writeFile f $ genCfg cfg descs+	liftIO $ writeFileAnyEncoding f $ genCfg cfg descs 	vicfg cfg f 	stop @@ -52,11 +52,11 @@ 	-- Allow EDITOR to be processed by the shell, so it can contain options. 	unlessM (liftIO $ boolSystem "sh" [Param "-c", Param $ unwords [vi, shellEscape f]]) $ 		error $ vi ++ " exited nonzero; aborting"-	r <- parseCfg (defCfg curcfg) <$> liftIO (readFileStrict f)+	r <- parseCfg (defCfg curcfg) <$> liftIO (readFileStrictAnyEncoding f) 	liftIO $ nukeFile f 	case r of 		Left s -> do-			liftIO $ writeFile f s+			liftIO $ writeFileAnyEncoding f s 			vicfg curcfg f 		Right newcfg -> setCfg curcfg newcfg 
Git/DiffTree.hs view
@@ -16,24 +16,15 @@ ) where  import Numeric-import System.Posix.Types  import Common import Git import Git.Sha import Git.Command import Git.FilePath+import Git.DiffTreeItem import qualified Git.Filename import qualified Git.Ref--data DiffTreeItem = DiffTreeItem-	{ srcmode :: FileMode-	, dstmode :: FileMode-	, srcsha :: Sha -- nullSha if file was added-	, dstsha :: Sha -- nullSha if file was deleted-	, status :: String-	, file :: TopFilePath-	} deriving Show  {- Checks if the DiffTreeItem modifies a file with a given name  - or under a directory by that name. -}
+ Git/DiffTreeItem.hs view
@@ -0,0 +1,24 @@+{- git diff-tree item+ -+ - Copyright 2012 Joey Hess <joey@kitenet.net>+ -+ - Licensed under the GNU GPL version 3 or higher.+ -}++module Git.DiffTreeItem (+	DiffTreeItem(..),+) where++import System.Posix.Types++import Git.FilePath+import Git.Types++data DiffTreeItem = DiffTreeItem+	{ srcmode :: FileMode+	, dstmode :: FileMode+	, srcsha :: Sha -- nullSha if file was added+	, dstsha :: Sha -- nullSha if file was deleted+	, status :: String+	, file :: TopFilePath+	} deriving Show
Git/UpdateIndex.hs view
@@ -29,7 +29,7 @@ import Git.Command import Git.FilePath import Git.Sha-import qualified Git.DiffTree as Diff+import qualified Git.DiffTreeItem as Diff  {- Streamers are passed a callback and should feed it lines in the form  - read by update-index, and generated by ls-tree. -}
Logs/Presence/Pure.hs view
@@ -30,14 +30,16 @@   where 	parseline l = LogLine 		<$> (utcTimeToPOSIXSeconds <$> parseTime defaultTimeLocale "%s%Qs" d)-		<*> parsestatus s+		<*> parseStatus s 		<*> pure rest 	  where 		(d, pastd) = separate (== ' ') l 		(s, rest) = separate (== ' ') pastd-	parsestatus "1" = Just InfoPresent-	parsestatus "0" = Just InfoMissing-	parsestatus _ = Nothing++parseStatus :: String -> Maybe LogStatus+parseStatus "1" = Just InfoPresent+parseStatus "0" = Just InfoMissing+parseStatus _ = Nothing  {- Generates a log file. -} showLog :: [LogLine] -> String
Logs/Web.hs view
@@ -54,9 +54,9 @@ setUrlPresent :: UUID -> Key -> URLString -> Annex () setUrlPresent uuid key url = do 	us <- getUrls key-	unless (url `elem` us) $ do+	unless (url `elem` us) $ 		addLog (urlLogFile key) =<< logNow InfoPresent url-		logChange key uuid InfoPresent+	logChange key uuid InfoPresent  setUrlMissing :: UUID -> Key -> URLString -> Annex () setUrlMissing uuid key url = do
Messages.hs view
@@ -42,7 +42,7 @@ import Data.Quantity import System.Log.Logger import System.Log.Formatter-import System.Log.Handler (setFormatter, LogHandler)+import System.Log.Handler (setFormatter) import System.Log.Handler.Simple  import Common hiding (handle)
Remote.hs view
@@ -26,6 +26,7 @@ 	uuidDescriptions, 	byName, 	byName',+	byNameOrGroup, 	byNameOnly, 	byNameWithUUID, 	byCost,@@ -94,7 +95,11 @@ 	| otherwise = desc ++ " [" ++ n ++ "]"  {- When a name is specified, looks up the remote matching that name.- - (Or it can be a UUID.) -}+ - (Or it can be a UUID.)+ -+ - Throws an error if a name is specified and no matching remote can be+ - found.+ -} byName :: Maybe RemoteName -> Annex (Maybe Remote) byName Nothing = return Nothing byName (Just n) = either error Just <$> byName' n@@ -120,6 +125,14 @@ 	go [] = Left $ "there is no available git remote named \"" ++ n ++ "\"" 	go (match:_) = Right match 	matching r = n == name r || toUUID n == uuid r++{- Finds the remote or remote group matching the name. -}+byNameOrGroup :: RemoteName -> Annex [Remote]+byNameOrGroup n = go =<< getConfigMaybe (ConfigKey ("remotes." ++ n))+  where+	go (Just l) = concatMap maybeToList <$>+		mapM (Remote.byName . Just) (split " " l)+	go Nothing = maybeToList <$> Remote.byName (Just n)  {- Only matches remote name, not UUID -} byNameOnly :: RemoteName -> Annex (Maybe Remote)
Remote/BitTorrent.hs view
@@ -200,7 +200,8 @@ 					return ok 				else do 					misctmp <- fromRepo gitAnnexTmpMiscDir-					withTmpFileIn misctmp "torrent" $ \f _h -> do+					withTmpFileIn misctmp "torrent" $ \f h -> do+						liftIO $ hClose h 						ok <- Url.withUrlOptions $ Url.download u f 						when ok $ 							liftIO $ renameFile f torrent
Remote/Git.hs view
@@ -358,7 +358,9 @@ 	| not $ Git.repoIsUrl (repo r) = guardUsable (repo r) (return False) $ do 		params <- Ssh.rsyncParams r Download 		u <- getUUID+#ifndef mingw32_HOST_OS 		hardlink <- annexHardLink <$> Annex.getGitConfig+#endif 		-- run copy from perspective of remote 		onLocal r $ do 			ensureInitialized
Test.hs view
@@ -80,1559 +80,1536 @@ import qualified Utility.Gpg #endif -type TestEnv = M.Map String String--main :: [String] -> IO ()-main ps = do-	let tests = testGroup "Tests"-		-- Test both direct and indirect mode.-		-- Windows is only going to use direct mode,-		-- so don't test twice.-		[ properties-#ifndef mingw32_HOST_OS-		, withTestEnv True $ unitTests "(direct)"-		, withTestEnv False $ unitTests "(indirect)"-#else-		, withTestEnv False $ unitTests ""-#endif-		]--	-- Can't use tasty's defaultMain because one of the command line-	-- parameters is "test".-	let pinfo = info (helper <*> suiteOptionParser ingredients tests)-		( fullDesc <> header "Builtin test suite" )-	opts <- parseOpts (prefs idm) pinfo ps-	case tryIngredients ingredients opts tests of-		Nothing -> error "No tests found!?"-		Just act -> ifM act-			( exitSuccess-			, do-				putStrLn "  (This could be due to a bug in git-annex, or an incompatability"-				putStrLn "   with utilities, such as git, installed on this system.)"-				exitFailure-			)-  where-	parseOpts pprefs pinfo args =-#if MIN_VERSION_optparse_applicative(0,10,0)-		case execParserPure pprefs pinfo args of-			(Options.Applicative.Failure failure) -> do-				let (msg, _exit) = renderFailure failure progdesc-				error msg-			v -> handleParseResult v-#else-		handleParseResult $ execParserPure pprefs pinfo args-#endif-	progdesc = "git-annex test"--ingredients :: [Ingredient]-ingredients =-	[ rerunningTests [consoleTestReporter]-	, listingTests-	]--properties :: TestTree-properties = localOption (QuickCheckTests 1000) $ testGroup "QuickCheck"-	[ testProperty "prop_idempotent_deencode_git" Git.Filename.prop_idempotent_deencode-	, testProperty "prop_idempotent_deencode" Utility.Format.prop_idempotent_deencode-	, testProperty "prop_idempotent_fileKey" Locations.prop_idempotent_fileKey-	, testProperty "prop_idempotent_key_encode" Types.Key.prop_idempotent_key_encode-	, testProperty "prop_idempotent_key_decode" Types.Key.prop_idempotent_key_decode-	, testProperty "prop_idempotent_shellEscape" Utility.SafeCommand.prop_idempotent_shellEscape-	, testProperty "prop_idempotent_shellEscape_multiword" Utility.SafeCommand.prop_idempotent_shellEscape_multiword-	, testProperty "prop_logs_sane" Logs.prop_logs_sane-	, testProperty "prop_idempotent_configEscape" Logs.Remote.prop_idempotent_configEscape-	, testProperty "prop_parse_show_Config" Logs.Remote.prop_parse_show_Config-	, testProperty "prop_parentDir_basics" Utility.Path.prop_parentDir_basics-	, testProperty "prop_relPathDirToFile_basics" Utility.Path.prop_relPathDirToFile_basics-	, testProperty "prop_relPathDirToFile_regressionTest" Utility.Path.prop_relPathDirToFile_regressionTest-	, testProperty "prop_cost_sane" Config.Cost.prop_cost_sane-	, testProperty "prop_matcher_sane" Utility.Matcher.prop_matcher_sane-	, testProperty "prop_HmacSha1WithCipher_sane" Crypto.prop_HmacSha1WithCipher_sane-	, testProperty "prop_TimeStamp_sane" Logs.MapLog.prop_TimeStamp_sane-	, testProperty "prop_addMapLog_sane" Logs.MapLog.prop_addMapLog_sane-	, testProperty "prop_verifiable_sane" Utility.Verifiable.prop_verifiable_sane-	, testProperty "prop_segment_regressionTest" Utility.Misc.prop_segment_regressionTest-	, testProperty "prop_read_write_transferinfo" Logs.Transfer.prop_read_write_transferinfo-	, testProperty "prop_read_show_inodecache" Utility.InodeCache.prop_read_show_inodecache-	, testProperty "prop_parse_show_log" Logs.Presence.prop_parse_show_log-	, testProperty "prop_read_show_TrustLevel" Types.TrustLevel.prop_read_show_TrustLevel-	, testProperty "prop_parse_show_TrustLog" Logs.Trust.prop_parse_show_TrustLog-	, testProperty "prop_hashes_stable" Utility.Hash.prop_hashes_stable-	, testProperty "prop_schedule_roundtrips" Utility.Scheduled.prop_schedule_roundtrips-	, testProperty "prop_past_sane" Utility.Scheduled.prop_past_sane-	, testProperty "prop_duration_roundtrips" Utility.HumanTime.prop_duration_roundtrips-	, testProperty "prop_metadata_sane" Types.MetaData.prop_metadata_sane-	, testProperty "prop_metadata_serialize" Types.MetaData.prop_metadata_serialize-	, testProperty "prop_branchView_legal" Logs.View.prop_branchView_legal-	, testProperty "prop_view_roundtrips" Annex.View.prop_view_roundtrips-	, testProperty "prop_viewedFile_rountrips" Annex.View.ViewedFile.prop_viewedFile_roundtrips-	]--{- These tests set up the test environment, but also test some basic parts- - of git-annex. They are always run before the unitTests. -}-initTests :: TestEnv -> TestTree-initTests testenv = testGroup "Init Tests"-	[ check "init" test_init-	, check "add" test_add-	]-  where-	check desc t = testCase desc (t testenv)--unitTests :: String -> IO TestEnv -> TestTree-unitTests note gettestenv = testGroup ("Unit Tests " ++ note)-	[ check "add sha1dup" test_add_sha1dup-	, check "add extras" test_add_extras-	, check "reinject" test_reinject-	, check "unannex (no copy)" test_unannex_nocopy-	, check "unannex (with copy)" test_unannex_withcopy-	, check "drop (no remote)" test_drop_noremote-	, check "drop (with remote)" test_drop_withremote-	, check "drop (untrusted remote)" test_drop_untrustedremote-	, check "get" test_get-	, check "move" test_move-	, check "copy" test_copy-	, check "lock" test_lock-	, check "edit (no pre-commit)" test_edit-	, check "edit (pre-commit)" test_edit_precommit-	, check "partial commit" test_partial_commit-	, check "fix" test_fix-	, check "trust" test_trust-	, check "fsck (basics)" test_fsck_basic-	, check "fsck (bare)" test_fsck_bare-	, check "fsck (local untrusted)" test_fsck_localuntrusted-	, check "fsck (remote untrusted)" test_fsck_remoteuntrusted-	, check "migrate" test_migrate-	, check "migrate (via gitattributes)" test_migrate_via_gitattributes-	, check" unused" test_unused-	, check "describe" test_describe-	, check "find" test_find-	, check "merge" test_merge-	, check "info" test_info-	, check "version" test_version-	, check "sync" test_sync-	, check "union merge regression" test_union_merge_regression-	, check "conflict resolution" test_conflict_resolution-	, check "conflict resolution movein regression" test_conflict_resolution_movein_regression-	, check "conflict resolution (mixed directory and file)" test_mixed_conflict_resolution-	, check "conflict resolution symlink bit" test_conflict_resolution_symlink_bit-	, check "conflict resolution (uncommitted local file)" test_uncommitted_conflict_resolution-	, check "conflict resolution (removed file)" test_remove_conflict_resolution-	, check "conflict resolution (nonannexed file)" test_nonannexed_file_conflict_resolution-	, check "conflict resolution (nonannexed symlink)" test_nonannexed_symlink_conflict_resolution-	, check "map" test_map-	, check "uninit" test_uninit-	, check "uninit (in git-annex branch)" test_uninit_inbranch-	, check "upgrade" test_upgrade-	, check "whereis" test_whereis-	, check "hook remote" test_hook_remote-	, check "directory remote" test_directory_remote-	, check "rsync remote" test_rsync_remote-	, check "bup remote" test_bup_remote-	, check "crypto" test_crypto-	, check "preferred content" test_preferred_content-	, check "add subdirs" test_add_subdirs-	]-  where-	check desc t = testCase desc (gettestenv >>= t)---- this test case create the main repo-test_init :: TestEnv -> Assertion-test_init testenv = innewrepo testenv $ do-	git_annex testenv "init" [reponame] @? "init failed"-	handleforcedirect testenv-  where-	reponame = "test repo"---- this test case runs in the main repo, to set up a basic--- annexed file that later tests will use-test_add :: TestEnv -> Assertion-test_add testenv = inmainrepo testenv $ do-	writeFile annexedfile $ content annexedfile-	git_annex testenv "add" [annexedfile] @? "add failed"-	annexed_present annexedfile-	writeFile sha1annexedfile $ content sha1annexedfile-	git_annex testenv "add" [sha1annexedfile, "--backend=SHA1"] @? "add with SHA1 failed"-	annexed_present sha1annexedfile-	checkbackend sha1annexedfile backendSHA1-	ifM (annexeval Config.isDirect)-		( do-			writeFile ingitfile $ content ingitfile-			not <$> boolSystem "git" [Param "add", File ingitfile] @? "git add failed to fail in direct mode"-			nukeFile ingitfile-			git_annex testenv "sync" [] @? "sync failed"-		, do-			writeFile ingitfile $ content ingitfile-			boolSystem "git" [Param "add", File ingitfile] @? "git add failed"-			boolSystem "git" [Params "commit -q -m commit"] @? "git commit failed"-			git_annex testenv "add" [ingitfile] @? "add ingitfile should be no-op"-			unannexed ingitfile-		)--test_add_sha1dup :: TestEnv -> Assertion-test_add_sha1dup testenv = intmpclonerepo testenv $ do-	writeFile sha1annexedfiledup $ content sha1annexedfiledup-	git_annex testenv "add" [sha1annexedfiledup, "--backend=SHA1"] @? "add of second file with same SHA1 failed"-	annexed_present sha1annexedfiledup-	annexed_present sha1annexedfile--test_add_extras :: TestEnv -> Assertion-test_add_extras testenv = intmpclonerepo testenv $ do-	writeFile wormannexedfile $ content wormannexedfile-	git_annex testenv "add" [wormannexedfile, "--backend=WORM"] @? "add with WORM failed"-	annexed_present wormannexedfile-	checkbackend wormannexedfile backendWORM--test_reinject :: TestEnv -> Assertion-test_reinject testenv = intmpclonerepoInDirect testenv $ do-	git_annex testenv "drop" ["--force", sha1annexedfile] @? "drop failed"-	writeFile tmp $ content sha1annexedfile-	r <- annexeval $ Types.Backend.getKey backendSHA1-		Types.KeySource.KeySource { Types.KeySource.keyFilename = tmp, Types.KeySource.contentLocation = tmp, Types.KeySource.inodeCache = Nothing }-	let key = Types.Key.key2file $ fromJust r-	git_annex testenv "reinject" [tmp, sha1annexedfile] @? "reinject failed"-	git_annex testenv "fromkey" [key, sha1annexedfiledup] @? "fromkey failed for dup"-	annexed_present sha1annexedfiledup-  where-	tmp = "tmpfile"--test_unannex_nocopy :: TestEnv -> Assertion-test_unannex_nocopy testenv = intmpclonerepo testenv $ do-	annexed_notpresent annexedfile-	git_annex testenv "unannex" [annexedfile] @? "unannex failed with no copy"-	annexed_notpresent annexedfile--test_unannex_withcopy :: TestEnv -> Assertion-test_unannex_withcopy testenv = intmpclonerepo testenv $ do-	git_annex testenv "get" [annexedfile] @? "get failed"-	annexed_present annexedfile-	git_annex testenv "unannex" [annexedfile, sha1annexedfile] @? "unannex failed"-	unannexed annexedfile-	git_annex testenv "unannex" [annexedfile] @? "unannex failed on non-annexed file"-	unannexed annexedfile-	unlessM (annexeval Config.isDirect) $ do-		git_annex testenv "unannex" [ingitfile] @? "unannex ingitfile should be no-op"-		unannexed ingitfile--test_drop_noremote :: TestEnv -> Assertion-test_drop_noremote testenv = intmpclonerepo testenv $ do-	git_annex testenv "get" [annexedfile] @? "get failed"-	boolSystem "git" [Params "remote rm origin"]-		@? "git remote rm origin failed"-	not <$> git_annex testenv "drop" [annexedfile] @? "drop wrongly succeeded with no known copy of file"-	annexed_present annexedfile-	git_annex testenv "drop" ["--force", annexedfile] @? "drop --force failed"-	annexed_notpresent annexedfile-	git_annex testenv "drop" [annexedfile] @? "drop of dropped file failed"-	unlessM (annexeval Config.isDirect) $ do-		git_annex testenv "drop" [ingitfile] @? "drop ingitfile should be no-op"-		unannexed ingitfile--test_drop_withremote :: TestEnv -> Assertion-test_drop_withremote testenv = intmpclonerepo testenv $ do-	git_annex testenv "get" [annexedfile] @? "get failed"-	annexed_present annexedfile-	git_annex testenv "numcopies" ["2"] @? "numcopies config failed"-	not <$> git_annex testenv "drop" [annexedfile] @? "drop succeeded although numcopies is not satisfied"-	git_annex testenv "numcopies" ["1"] @? "numcopies config failed"-	git_annex testenv "drop" [annexedfile] @? "drop failed though origin has copy"-	annexed_notpresent annexedfile-	inmainrepo testenv $ annexed_present annexedfile--test_drop_untrustedremote :: TestEnv -> Assertion-test_drop_untrustedremote testenv = intmpclonerepo testenv $ do-	git_annex testenv "untrust" ["origin"] @? "untrust of origin failed"-	git_annex testenv "get" [annexedfile] @? "get failed"-	annexed_present annexedfile-	not <$> git_annex testenv "drop" [annexedfile] @? "drop wrongly suceeded with only an untrusted copy of the file"-	annexed_present annexedfile-	inmainrepo testenv $ annexed_present annexedfile--test_get :: TestEnv -> Assertion-test_get testenv = intmpclonerepo testenv $ do-	inmainrepo testenv $ annexed_present annexedfile-	annexed_notpresent annexedfile-	git_annex testenv "get" [annexedfile] @? "get of file failed"-	inmainrepo testenv $ annexed_present annexedfile-	annexed_present annexedfile-	git_annex testenv "get" [annexedfile] @? "get of file already here failed"-	inmainrepo testenv $ annexed_present annexedfile-	annexed_present annexedfile-	unlessM (annexeval Config.isDirect) $ do-		inmainrepo testenv $ unannexed ingitfile-		unannexed ingitfile-		git_annex testenv "get" [ingitfile] @? "get ingitfile should be no-op"-		inmainrepo testenv $ unannexed ingitfile-		unannexed ingitfile--test_move :: TestEnv -> Assertion-test_move testenv = intmpclonerepo testenv $ do-	annexed_notpresent annexedfile-	inmainrepo testenv $ annexed_present annexedfile-	git_annex testenv "move" ["--from", "origin", annexedfile] @? "move --from of file failed"-	annexed_present annexedfile-	inmainrepo testenv $ annexed_notpresent annexedfile-	git_annex testenv "move" ["--from", "origin", annexedfile] @? "move --from of file already here failed"-	annexed_present annexedfile-	inmainrepo testenv $ annexed_notpresent annexedfile-	git_annex testenv "move" ["--to", "origin", annexedfile] @? "move --to of file failed"-	inmainrepo testenv $ annexed_present annexedfile-	annexed_notpresent annexedfile-	git_annex testenv "move" ["--to", "origin", annexedfile] @? "move --to of file already there failed"-	inmainrepo testenv $ annexed_present annexedfile-	annexed_notpresent annexedfile-	unlessM (annexeval Config.isDirect) $ do-		unannexed ingitfile-		inmainrepo testenv $ unannexed ingitfile-		git_annex testenv "move" ["--to", "origin", ingitfile] @? "move of ingitfile should be no-op"-		unannexed ingitfile-		inmainrepo testenv $ unannexed ingitfile-		git_annex testenv "move" ["--from", "origin", ingitfile] @? "move of ingitfile should be no-op"-		unannexed ingitfile-		inmainrepo testenv $ unannexed ingitfile--test_copy :: TestEnv -> Assertion-test_copy testenv = intmpclonerepo testenv $ do-	annexed_notpresent annexedfile-	inmainrepo testenv $ annexed_present annexedfile-	git_annex testenv "copy" ["--from", "origin", annexedfile] @? "copy --from of file failed"-	annexed_present annexedfile-	inmainrepo testenv $ annexed_present annexedfile-	git_annex testenv "copy" ["--from", "origin", annexedfile] @? "copy --from of file already here failed"-	annexed_present annexedfile-	inmainrepo testenv $ annexed_present annexedfile-	git_annex testenv "copy" ["--to", "origin", annexedfile] @? "copy --to of file already there failed"-	annexed_present annexedfile-	inmainrepo testenv $ annexed_present annexedfile-	git_annex testenv "move" ["--to", "origin", annexedfile] @? "move --to of file already there failed"-	annexed_notpresent annexedfile-	inmainrepo testenv $ annexed_present annexedfile-	unlessM (annexeval Config.isDirect) $ do-		unannexed ingitfile-		inmainrepo testenv $ unannexed ingitfile-		git_annex testenv "copy" ["--to", "origin", ingitfile] @? "copy of ingitfile should be no-op"-		unannexed ingitfile-		inmainrepo testenv $ unannexed ingitfile-		git_annex testenv "copy" ["--from", "origin", ingitfile] @? "copy of ingitfile should be no-op"-		checkregularfile ingitfile-		checkcontent ingitfile--test_preferred_content :: TestEnv -> Assertion-test_preferred_content testenv = intmpclonerepo testenv $ do-	annexed_notpresent annexedfile-	-- get --auto only looks at numcopies when preferred content is not-	-- set, and with 1 copy existing, does not get the file.-	git_annex testenv "get" ["--auto", annexedfile] @? "get --auto of file failed with default preferred content"-	annexed_notpresent annexedfile--	git_annex testenv "wanted" [".", "standard"] @? "set expression to standard failed"-	git_annex testenv "group" [".", "client"] @? "set group to standard failed"-	git_annex testenv "get" ["--auto", annexedfile] @? "get --auto of file failed for client"-	annexed_present annexedfile-	git_annex testenv "ungroup" [".", "client"] @? "ungroup failed"--	git_annex testenv "wanted" [".", "standard"] @? "set expression to standard failed"-	git_annex testenv "group" [".", "manual"] @? "set group to manual failed"-	-- drop --auto with manual leaves the file where it is-	git_annex testenv "drop" ["--auto", annexedfile] @? "drop --auto of file failed with manual preferred content"-	annexed_present annexedfile-	git_annex testenv "drop" [annexedfile] @? "drop of file failed"-	annexed_notpresent annexedfile-	-- get --auto with manual does not get the file-	git_annex testenv "get" ["--auto", annexedfile] @? "get --auto of file failed with manual preferred content"-	annexed_notpresent annexedfile-	git_annex testenv "ungroup" [".", "client"] @? "ungroup failed"-	-	git_annex testenv "wanted" [".", "exclude=*"] @? "set expression to exclude=* failed"-	git_annex testenv "get" [annexedfile] @? "get of file failed"-	annexed_present annexedfile-	git_annex testenv "drop" ["--auto", annexedfile] @? "drop --auto of file failed with exclude=*"-	annexed_notpresent annexedfile-	git_annex testenv "get" ["--auto", annexedfile] @? "get --auto of file failed with exclude=*"-	annexed_notpresent annexedfile--test_lock :: TestEnv -> Assertion-test_lock testenv = intmpclonerepoInDirect testenv $ do-	-- regression test: unlock of not present file should skip it-	annexed_notpresent annexedfile-	not <$> git_annex testenv "unlock" [annexedfile] @? "unlock failed to fail with not present file"-	annexed_notpresent annexedfile--	git_annex testenv "get" [annexedfile] @? "get of file failed"-	annexed_present annexedfile-	git_annex testenv "unlock" [annexedfile] @? "unlock failed"		-	unannexed annexedfile-	-- write different content, to verify that lock-	-- throws it away-	changecontent annexedfile-	writeFile annexedfile $ content annexedfile ++ "foo"-	not <$> git_annex testenv "lock" [annexedfile] @? "lock failed to fail without --force"-	git_annex testenv "lock" ["--force", annexedfile] @? "lock --force failed"-	annexed_present annexedfile-	git_annex testenv "unlock" [annexedfile] @? "unlock failed"		-	unannexed annexedfile-	changecontent annexedfile-	git_annex testenv "add" [annexedfile] @? "add of modified file failed"-	runchecks [checklink, checkunwritable] annexedfile-	c <- readFile annexedfile-	assertEqual "content of modified file" c (changedcontent annexedfile)-	r' <- git_annex testenv "drop" [annexedfile]-	not r' @? "drop wrongly succeeded with no known copy of modified file"--test_edit :: TestEnv -> Assertion-test_edit = test_edit' False--test_edit_precommit :: TestEnv -> Assertion-test_edit_precommit = test_edit' True--test_edit' :: Bool -> TestEnv -> Assertion-test_edit' precommit testenv = intmpclonerepoInDirect testenv $ do-	git_annex testenv "get" [annexedfile] @? "get of file failed"-	annexed_present annexedfile-	git_annex testenv "edit" [annexedfile] @? "edit failed"-	unannexed annexedfile-	changecontent annexedfile-	boolSystem "git" [Param "add", File annexedfile]-		@? "git add of edited file failed"-	if precommit-		then git_annex testenv "pre-commit" []-			@? "pre-commit failed"-		else boolSystem "git" [Params "commit -q -m contentchanged"]-			@? "git commit of edited file failed"-	runchecks [checklink, checkunwritable] annexedfile-	c <- readFile annexedfile-	assertEqual "content of modified file" c (changedcontent annexedfile)-	not <$> git_annex testenv "drop" [annexedfile] @? "drop wrongly succeeded with no known copy of modified file"--test_partial_commit :: TestEnv -> Assertion-test_partial_commit testenv = intmpclonerepoInDirect testenv $ do-	git_annex testenv "get" [annexedfile] @? "get of file failed"-	annexed_present annexedfile-	git_annex testenv "unlock" [annexedfile] @? "unlock failed"-	not <$> boolSystem "git" [Params "commit -q -m test", File annexedfile]-		@? "partial commit of unlocked file not blocked by pre-commit hook"--test_fix :: TestEnv -> Assertion-test_fix testenv = intmpclonerepoInDirect testenv $ do-	annexed_notpresent annexedfile-	git_annex testenv "fix" [annexedfile] @? "fix of not present failed"-	annexed_notpresent annexedfile-	git_annex testenv "get" [annexedfile] @? "get of file failed"-	annexed_present annexedfile-	git_annex testenv "fix" [annexedfile] @? "fix of present file failed"-	annexed_present annexedfile-	createDirectory subdir-	boolSystem "git" [Param "mv", File annexedfile, File subdir]-		@? "git mv failed"-	git_annex testenv "fix" [newfile] @? "fix of moved file failed"-	runchecks [checklink, checkunwritable] newfile-	c <- readFile newfile-	assertEqual "content of moved file" c (content annexedfile)-  where-	subdir = "s"-	newfile = subdir ++ "/" ++ annexedfile--test_trust :: TestEnv -> Assertion-test_trust testenv = intmpclonerepo testenv $ do-	git_annex testenv "trust" [repo] @? "trust failed"-	trustcheck Logs.Trust.Trusted "trusted 1"-	git_annex testenv "trust" [repo] @? "trust of trusted failed"-	trustcheck Logs.Trust.Trusted "trusted 2"-	git_annex testenv "untrust" [repo] @? "untrust failed"-	trustcheck Logs.Trust.UnTrusted "untrusted 1"-	git_annex testenv "untrust" [repo] @? "untrust of untrusted failed"-	trustcheck Logs.Trust.UnTrusted "untrusted 2"-	git_annex testenv "dead" [repo] @? "dead failed"-	trustcheck Logs.Trust.DeadTrusted "deadtrusted 1"-	git_annex testenv "dead" [repo] @? "dead of dead failed"-	trustcheck Logs.Trust.DeadTrusted "deadtrusted 2"-	git_annex testenv "semitrust" [repo] @? "semitrust failed"-	trustcheck Logs.Trust.SemiTrusted "semitrusted 1"-	git_annex testenv "semitrust" [repo] @? "semitrust of semitrusted failed"-	trustcheck Logs.Trust.SemiTrusted "semitrusted 2"-  where-	repo = "origin"-	trustcheck expected msg = do-		present <- annexeval $ do-			l <- Logs.Trust.trustGet expected-			u <- Remote.nameToUUID repo-			return $ u `elem` l-		assertBool msg present--test_fsck_basic :: TestEnv -> Assertion-test_fsck_basic testenv = intmpclonerepo testenv $ do-	git_annex testenv "fsck" [] @? "fsck failed"-	git_annex testenv "numcopies" ["2"] @? "numcopies config failed"-	fsck_should_fail testenv "numcopies unsatisfied"-	git_annex testenv "numcopies" ["1"] @? "numcopies config failed"-	corrupt annexedfile-	corrupt sha1annexedfile-  where-	corrupt f = do-		git_annex testenv "get" [f] @? "get of file failed"-		Utility.FileMode.allowWrite f-		writeFile f (changedcontent f)-		ifM (annexeval Config.isDirect)-			( git_annex testenv "fsck" [] @? "fsck failed in direct mode with changed file content"-			, not <$> git_annex testenv "fsck" [] @? "fsck failed to fail with corrupted file content"-			)-		git_annex testenv "fsck" [] @? "fsck unexpectedly failed again; previous one did not fix problem with " ++ f--test_fsck_bare :: TestEnv -> Assertion-test_fsck_bare testenv = intmpbareclonerepo testenv $-	git_annex testenv "fsck" [] @? "fsck failed"--test_fsck_localuntrusted :: TestEnv -> Assertion-test_fsck_localuntrusted testenv = intmpclonerepo testenv $ do-	git_annex testenv "get" [annexedfile] @? "get failed"-	git_annex testenv "untrust" ["origin"] @? "untrust of origin repo failed"-	git_annex testenv "untrust" ["."] @? "untrust of current repo failed"-	fsck_should_fail testenv "content only available in untrusted (current) repository"-	git_annex testenv "trust" ["."] @? "trust of current repo failed"-	git_annex testenv "fsck" [annexedfile] @? "fsck failed on file present in trusted repo"--test_fsck_remoteuntrusted :: TestEnv -> Assertion-test_fsck_remoteuntrusted testenv = intmpclonerepo testenv $ do-	git_annex testenv "numcopies" ["2"] @? "numcopies config failed"-	git_annex testenv "get" [annexedfile] @? "get failed"-	git_annex testenv "get" [sha1annexedfile] @? "get failed"-	git_annex testenv "fsck" [] @? "fsck failed with numcopies=2 and 2 copies"-	git_annex testenv "untrust" ["origin"] @? "untrust of origin failed"-	fsck_should_fail testenv "content not replicated to enough non-untrusted repositories"--fsck_should_fail :: TestEnv -> String -> Assertion-fsck_should_fail testenv m = not <$> git_annex testenv "fsck" []-	@? "fsck failed to fail with " ++ m--test_migrate :: TestEnv -> Assertion-test_migrate = test_migrate' False--test_migrate_via_gitattributes :: TestEnv -> Assertion-test_migrate_via_gitattributes = test_migrate' True--test_migrate' :: Bool -> TestEnv -> Assertion-test_migrate' usegitattributes testenv = intmpclonerepoInDirect testenv $ do-	annexed_notpresent annexedfile-	annexed_notpresent sha1annexedfile-	git_annex testenv "migrate" [annexedfile] @? "migrate of not present failed"-	git_annex testenv "migrate" [sha1annexedfile] @? "migrate of not present failed"-	git_annex testenv "get" [annexedfile] @? "get of file failed"-	git_annex testenv "get" [sha1annexedfile] @? "get of file failed"-	annexed_present annexedfile-	annexed_present sha1annexedfile-	if usegitattributes-		then do-			writeFile ".gitattributes" "* annex.backend=SHA1"-			git_annex testenv "migrate" [sha1annexedfile]-				@? "migrate sha1annexedfile failed"-			git_annex testenv "migrate" [annexedfile]-				@? "migrate annexedfile failed"-		else do-			git_annex testenv "migrate" [sha1annexedfile, "--backend", "SHA1"]-				@? "migrate sha1annexedfile failed"-			git_annex testenv "migrate" [annexedfile, "--backend", "SHA1"]-				@? "migrate annexedfile failed"-	annexed_present annexedfile-	annexed_present sha1annexedfile-	checkbackend annexedfile backendSHA1-	checkbackend sha1annexedfile backendSHA1--	-- check that reversing a migration works-	writeFile ".gitattributes" "* annex.backend=SHA256"-	git_annex testenv "migrate" [sha1annexedfile]-		@? "migrate sha1annexedfile failed"-	git_annex testenv "migrate" [annexedfile]-		@? "migrate annexedfile failed"-	annexed_present annexedfile-	annexed_present sha1annexedfile-	checkbackend annexedfile backendSHA256-	checkbackend sha1annexedfile backendSHA256--test_unused :: TestEnv -> Assertion--- This test is broken in direct mode-test_unused testenv = intmpclonerepoInDirect testenv $ do-	-- keys have to be looked up before files are removed-	annexedfilekey <- annexeval $ findkey annexedfile-	sha1annexedfilekey <- annexeval $ findkey sha1annexedfile-	git_annex testenv "get" [annexedfile] @? "get of file failed"-	git_annex testenv "get" [sha1annexedfile] @? "get of file failed"-	checkunused [] "after get"-	boolSystem "git" [Params "rm -fq", File annexedfile] @? "git rm failed"-	checkunused [] "after rm"-	boolSystem "git" [Params "commit -q -m foo"] @? "git commit failed"-	checkunused [] "after commit"-	-- unused checks origin/master; once it's gone it is really unused-	boolSystem "git" [Params "remote rm origin"] @? "git remote rm origin failed"-	checkunused [annexedfilekey] "after origin branches are gone"-	boolSystem "git" [Params "rm -fq", File sha1annexedfile] @? "git rm failed"-	boolSystem "git" [Params "commit -q -m foo"] @? "git commit failed"-	checkunused [annexedfilekey, sha1annexedfilekey] "after rm sha1annexedfile"--	-- good opportunity to test dropkey also-	git_annex testenv "dropkey" ["--force", Types.Key.key2file annexedfilekey]-		@? "dropkey failed"-	checkunused [sha1annexedfilekey] ("after dropkey --force " ++ Types.Key.key2file annexedfilekey)--	not <$> git_annex testenv "dropunused" ["1"] @? "dropunused failed to fail without --force"-	git_annex testenv "dropunused" ["--force", "1"] @? "dropunused failed"-	checkunused [] "after dropunused"-	not <$> git_annex testenv "dropunused" ["--force", "10", "501"] @? "dropunused failed to fail on bogus numbers"--	-- unused used to miss symlinks that were not staged and pointed -	-- at annexed content, and think that content was unused-	writeFile "unusedfile" "unusedcontent"-	git_annex testenv "add" ["unusedfile"] @? "add of unusedfile failed"-	unusedfilekey <- annexeval $ findkey "unusedfile"-	renameFile "unusedfile" "unusedunstagedfile"-	boolSystem "git" [Params "rm -qf", File "unusedfile"] @? "git rm failed"-	checkunused [] "with unstaged link"-	removeFile "unusedunstagedfile"-	checkunused [unusedfilekey] "with unstaged link deleted"--	-- unused used to miss symlinks that were deleted or modified-	-- manually, but commited as such.-	writeFile "unusedfile" "unusedcontent"-	git_annex testenv "add" ["unusedfile"] @? "add of unusedfile failed"-	boolSystem "git" [Param "add", File "unusedfile"] @? "git add failed"-	unusedfilekey' <- annexeval $ findkey "unusedfile"-	checkunused [] "with staged deleted link"-	boolSystem "git" [Params "rm -qf", File "unusedfile"] @? "git rm failed"-	checkunused [unusedfilekey'] "with staged link deleted"--	-- unused used to miss symlinks that were deleted or modified-	-- manually, but not staged as such.-	writeFile "unusedfile" "unusedcontent"-	git_annex testenv "add" ["unusedfile"] @? "add of unusedfile failed"-	boolSystem "git" [Param "add", File "unusedfile"] @? "git add failed"-	unusedfilekey'' <- annexeval $ findkey "unusedfile"-	checkunused [] "with unstaged deleted link"-	removeFile "unusedfile"-	checkunused [unusedfilekey''] "with unstaged link deleted"--  where-	checkunused expectedkeys desc = do-		git_annex testenv "unused" [] @? "unused failed"-		unusedmap <- annexeval $ Logs.Unused.readUnusedMap ""-		let unusedkeys = M.elems unusedmap-		assertEqual ("unused keys differ " ++ desc)-			(sort expectedkeys) (sort unusedkeys)-	findkey f = do-		r <- Backend.lookupFile f-		return $ fromJust r--test_describe :: TestEnv -> Assertion-test_describe testenv = intmpclonerepo testenv $ do-	git_annex testenv "describe" [".", "this repo"] @? "describe 1 failed"-	git_annex testenv "describe" ["origin", "origin repo"] @? "describe 2 failed"--test_find :: TestEnv -> Assertion-test_find testenv = intmpclonerepo testenv $ do-	annexed_notpresent annexedfile-	git_annex_expectoutput testenv "find" [] []-	git_annex testenv "get" [annexedfile] @? "get failed"-	annexed_present annexedfile-	annexed_notpresent sha1annexedfile-	git_annex_expectoutput testenv "find" [] [annexedfile]-	git_annex_expectoutput testenv "find" ["--exclude", annexedfile, "--and", "--exclude", sha1annexedfile] []-	git_annex_expectoutput testenv "find" ["--include", annexedfile] [annexedfile]-	git_annex_expectoutput testenv "find" ["--not", "--in", "origin"] []-	git_annex_expectoutput testenv "find" ["--copies", "1", "--and", "--not", "--copies", "2"] [sha1annexedfile]-	git_annex_expectoutput testenv "find" ["--inbackend", "SHA1"] [sha1annexedfile]-	git_annex_expectoutput testenv "find" ["--inbackend", "WORM"] []--	{- --include=* should match files in subdirectories too,-	 - and --exclude=* should exclude them. -}-	createDirectory "dir"-	writeFile "dir/subfile" "subfile"-	git_annex testenv "add" ["dir"] @? "add of subdir failed"-	git_annex_expectoutput testenv "find" ["--include", "*", "--exclude", annexedfile, "--exclude", sha1annexedfile] ["dir/subfile"]-	git_annex_expectoutput testenv "find" ["--exclude", "*"] []--test_merge :: TestEnv -> Assertion-test_merge testenv = intmpclonerepo testenv $-	git_annex testenv "merge" [] @? "merge failed"--test_info :: TestEnv -> Assertion-test_info testenv = intmpclonerepo testenv $ do-	json <- git_annex_output testenv "info" ["--json"]-	case Text.JSON.decodeStrict json :: Text.JSON.Result (Text.JSON.JSObject Text.JSON.JSValue) of-		Text.JSON.Ok _ -> return ()-		Text.JSON.Error e -> assertFailure e--test_version :: TestEnv -> Assertion-test_version testenv = intmpclonerepo testenv $-	git_annex testenv "version" [] @? "version failed"--test_sync :: TestEnv -> Assertion-test_sync testenv = intmpclonerepo testenv $ do-	git_annex testenv "sync" [] @? "sync failed"-	{- Regression test for bug fixed in -	 - 7b0970b340d7faeb745c666146c7f701ec71808f, where in direct mode-	 - sync committed the symlink standin file to the annex. -}-	git_annex_expectoutput testenv "find" ["--in", "."] []--{- Regression test for union merge bug fixed in- - 0214e0fb175a608a49b812d81b4632c081f63027 -}-test_union_merge_regression :: TestEnv -> Assertion-test_union_merge_regression testenv =-	{- We need 3 repos to see this bug. -}-	withtmpclonerepo testenv False $ \r1 ->-		withtmpclonerepo testenv False $ \r2 ->-			withtmpclonerepo testenv False $ \r3 -> do-				forM_ [r1, r2, r3] $ \r -> indir testenv r $ do-					when (r /= r1) $-						boolSystem "git" [Params "remote add r1", File ("../../" ++ r1)] @? "remote add"-					when (r /= r2) $-						boolSystem "git" [Params "remote add r2", File ("../../" ++ r2)] @? "remote add"-					when (r /= r3) $-						boolSystem "git" [Params "remote add r3", File ("../../" ++ r3)] @? "remote add"-					git_annex testenv "get" [annexedfile] @? "get failed"-					boolSystem "git" [Params "remote rm origin"] @? "remote rm"-				forM_ [r3, r2, r1] $ \r -> indir testenv r $-					git_annex testenv "sync" [] @? "sync failed"-				forM_ [r3, r2] $ \r -> indir testenv r $-					git_annex testenv "drop" ["--force", annexedfile] @? "drop failed"-				indir testenv r1 $ do-					git_annex testenv "sync" [] @? "sync failed in r1"-					git_annex_expectoutput testenv "find" ["--in", "r3"] []-					{- This was the bug. The sync-					 - mangled location log data and it-					 - thought the file was still in r2 -}-					git_annex_expectoutput testenv "find" ["--in", "r2"] []--{- Regression test for the automatic conflict resolution bug fixed- - in f4ba19f2b8a76a1676da7bb5850baa40d9c388e2. -}-test_conflict_resolution_movein_regression :: TestEnv -> Assertion-test_conflict_resolution_movein_regression testenv = withtmpclonerepo testenv False $ \r1 -> -	withtmpclonerepo testenv False $ \r2 -> do-		let rname r = if r == r1 then "r1" else "r2"-		forM_ [r1, r2] $ \r -> indir testenv r $ do-			{- Get all files, see check below. -}-			git_annex testenv "get" [] @? "get failed"-			disconnectOrigin-		pair testenv r1 r2-		forM_ [r1, r2] $ \r -> indir testenv r $ do-			{- Set up a conflict. -}-			let newcontent = content annexedfile ++ rname r-			ifM (annexeval Config.isDirect)-				( writeFile annexedfile newcontent-				, do-					git_annex testenv "unlock" [annexedfile] @? "unlock failed"		-					writeFile annexedfile newcontent-				)-		{- Sync twice in r1 so it gets the conflict resolution-		 - update from r2 -}-		forM_ [r1, r2, r1] $ \r -> indir testenv r $-			git_annex testenv "sync" ["--force"] @? "sync failed in " ++ rname r-		{- After the sync, it should be possible to get all-		 - files. This includes both sides of the conflict,-		 - although the filenames are not easily predictable.-		 --		 - The bug caused, in direct mode, one repo to-		 - be missing the content of the file that had-		 - been put in it. -}-		forM_ [r1, r2] $ \r -> indir testenv r $ do-			git_annex testenv "get" [] @? "unable to get all files after merge conflict resolution in " ++ rname r--{- Simple case of conflict resolution; 2 different versions of annexed- - file. -}-test_conflict_resolution :: TestEnv -> Assertion-test_conflict_resolution testenv = -	withtmpclonerepo testenv False $ \r1 ->-		withtmpclonerepo testenv False $ \r2 -> do-			indir testenv r1 $ do-				disconnectOrigin-				writeFile conflictor "conflictor1"-				git_annex testenv "add" [conflictor] @? "add conflicter failed"-				git_annex testenv "sync" [] @? "sync failed in r1"-			indir testenv r2 $ do-				disconnectOrigin-				writeFile conflictor "conflictor2"-				git_annex testenv "add" [conflictor] @? "add conflicter failed"-				git_annex testenv "sync" [] @? "sync failed in r2"-			pair testenv r1 r2-			forM_ [r1,r2,r1] $ \r -> indir testenv r $-				git_annex testenv "sync" [] @? "sync failed"-			checkmerge "r1" r1-			checkmerge "r2" r2-  where-	conflictor = "conflictor"-	variantprefix = conflictor ++ ".variant"-	checkmerge what d = do-		l <- getDirectoryContents d-		let v = filter (variantprefix `isPrefixOf`) l-		length v == 2-			@? (what ++ " not exactly 2 variant files in: " ++ show l)-		conflictor `notElem` l @? ("conflictor still present after conflict resolution")-		indir testenv d $ do-			git_annex testenv "get" v @? "get failed"-			git_annex_expectoutput testenv "find" v v---{- Check merge conflict resolution when one side is an annexed- - file, and the other is a directory. -}-test_mixed_conflict_resolution :: TestEnv -> Assertion-test_mixed_conflict_resolution testenv = do-	check True-	check False-  where-	check inr1 = withtmpclonerepo testenv False $ \r1 ->-		withtmpclonerepo testenv False $ \r2 -> do-			indir testenv r1 $ do-				disconnectOrigin-				writeFile conflictor "conflictor"-				git_annex testenv "add" [conflictor] @? "add conflicter failed"-				git_annex testenv "sync" [] @? "sync failed in r1"-			indir testenv r2 $ do-				disconnectOrigin-				createDirectory conflictor-				writeFile subfile "subfile"-				git_annex testenv "add" [conflictor] @? "add conflicter failed"-				git_annex testenv "sync" [] @? "sync failed in r2"-			pair testenv r1 r2-			let l = if inr1 then [r1, r2] else [r2, r1]-			forM_ l $ \r -> indir testenv r $-				git_annex testenv "sync" [] @? "sync failed in mixed conflict"-			checkmerge "r1" r1-			checkmerge "r2" r2-	conflictor = "conflictor"-	subfile = conflictor </> "subfile"-	variantprefix = conflictor ++ ".variant"-	checkmerge what d = do-		doesDirectoryExist (d </> conflictor) @? (d ++ " conflictor directory missing")-		l <- getDirectoryContents d-		let v = filter (variantprefix `isPrefixOf`) l-		not (null v)-			@? (what ++ " conflictor variant file missing in: " ++ show l )-		length v == 1-			@? (what ++ " too many variant files in: " ++ show v)-		indir testenv d $ do-			git_annex testenv "get" (conflictor:v) @? ("get failed in " ++ what)-			git_annex_expectoutput testenv "find" [conflictor] [Git.FilePath.toInternalGitPath subfile]-			git_annex_expectoutput testenv "find" v v--{- Check merge conflict resolution when both repos start with an annexed- - file; one modifies it, and the other deletes it. -}-test_remove_conflict_resolution :: TestEnv -> Assertion-test_remove_conflict_resolution testenv = do-	check True-	check False-  where-	check inr1 = withtmpclonerepo testenv False $ \r1 ->-		withtmpclonerepo testenv False $ \r2 -> do-			indir testenv r1 $ do-				disconnectOrigin-				writeFile conflictor "conflictor"-				git_annex testenv "add" [conflictor] @? "add conflicter failed"-				git_annex testenv "sync" [] @? "sync failed in r1"-			indir testenv r2 $-				disconnectOrigin-			pair testenv r1 r2-			indir testenv r2 $ do-				git_annex testenv "sync" [] @? "sync failed in r2"-				git_annex testenv "get" [conflictor]-					@? "get conflictor failed"-				unlessM (annexeval Config.isDirect) $ do-					git_annex testenv "unlock" [conflictor]-						@? "unlock conflictor failed"-				writeFile conflictor "newconflictor"-			indir testenv r1 $-				nukeFile conflictor-			let l = if inr1 then [r1, r2, r1] else [r2, r1, r2]-			forM_ l $ \r -> indir testenv r $-				git_annex testenv "sync" [] @? "sync failed"-			checkmerge "r1" r1-			checkmerge "r2" r2-	conflictor = "conflictor"-	variantprefix = conflictor ++ ".variant"-	checkmerge what d = do-		l <- getDirectoryContents d-		let v = filter (variantprefix `isPrefixOf`) l-		not (null v)-			@? (what ++ " conflictor variant file missing in: " ++ show l )-		length v == 1-			@? (what ++ " too many variant files in: " ++ show v)--{- Check merge confalict resolution when a file is annexed in one repo,- - and checked directly into git in the other repo.- -- - This test requires indirect mode to set it up, but tests both direct and- - indirect mode.- -}-test_nonannexed_file_conflict_resolution :: TestEnv -> Assertion-test_nonannexed_file_conflict_resolution testenv = do-	check True False-	check False False-	check True True-	check False True-  where-	check inr1 switchdirect = withtmpclonerepo testenv False $ \r1 ->-		withtmpclonerepo testenv False $ \r2 ->-			whenM (isInDirect r1 <&&> isInDirect r2) $ do-				indir testenv r1 $ do-					disconnectOrigin-					writeFile conflictor "conflictor"-					git_annex testenv "add" [conflictor] @? "add conflicter failed"-					git_annex testenv "sync" [] @? "sync failed in r1"-				indir testenv r2 $ do-					disconnectOrigin-					writeFile conflictor nonannexed_content-					boolSystem "git" [Params "add", File conflictor] @? "git add conflictor failed"-					git_annex testenv "sync" [] @? "sync failed in r2"-				pair testenv r1 r2-				let l = if inr1 then [r1, r2] else [r2, r1]-				forM_ l $ \r -> indir testenv r $ do-					when switchdirect $-						git_annex testenv "direct" [] @? "failed switching to direct mode"-					git_annex testenv "sync" [] @? "sync failed"-				checkmerge ("r1" ++ show switchdirect) r1-				checkmerge ("r2" ++ show switchdirect) r2-	conflictor = "conflictor"-	nonannexed_content = "nonannexed"-	variantprefix = conflictor ++ ".variant"-	checkmerge what d = do-		l <- getDirectoryContents d-		let v = filter (variantprefix `isPrefixOf`) l-		not (null v)-			@? (what ++ " conflictor variant file missing in: " ++ show l )-		length v == 1-			@? (what ++ " too many variant files in: " ++ show v)-		conflictor `elem` l @? (what ++ " conflictor file missing in: " ++ show l)-		s <- catchMaybeIO (readFile (d </> conflictor))-		s == Just nonannexed_content-			@? (what ++ " wrong content for nonannexed file: " ++ show s)---{- Check merge confalict resolution when a file is annexed in one repo,- - and is a non-git-annex symlink in the other repo.- -- - Test can only run when coreSymlinks is supported, because git needs to- - be able to check out the non-git-annex symlink.- -}-test_nonannexed_symlink_conflict_resolution :: TestEnv -> Assertion-test_nonannexed_symlink_conflict_resolution testenv = do-	check True False-	check False False-	check True True-	check False True-  where-	check inr1 switchdirect = withtmpclonerepo testenv False $ \r1 ->-		withtmpclonerepo testenv False $ \r2 ->-			whenM (checkRepo (Types.coreSymlinks <$> Annex.getGitConfig) r1-			       <&&> isInDirect r1 <&&> isInDirect r2) $ do-				indir testenv r1 $ do-					disconnectOrigin-					writeFile conflictor "conflictor"-					git_annex testenv "add" [conflictor] @? "add conflicter failed"-					git_annex testenv "sync" [] @? "sync failed in r1"-				indir testenv r2 $ do-					disconnectOrigin-					createSymbolicLink symlinktarget "conflictor"-					boolSystem "git" [Params "add", File conflictor] @? "git add conflictor failed"-					git_annex testenv "sync" [] @? "sync failed in r2"-				pair testenv r1 r2-				let l = if inr1 then [r1, r2] else [r2, r1]-				forM_ l $ \r -> indir testenv r $ do-					when switchdirect $-						git_annex testenv "direct" [] @? "failed switching to direct mode"-					git_annex testenv "sync" [] @? "sync failed"-				checkmerge ("r1" ++ show switchdirect) r1-				checkmerge ("r2" ++ show switchdirect) r2-	conflictor = "conflictor"-	symlinktarget = "dummy-target"-	variantprefix = conflictor ++ ".variant"-	checkmerge what d = do-		l <- getDirectoryContents d-		let v = filter (variantprefix `isPrefixOf`) l-		not (null v)-			@? (what ++ " conflictor variant file missing in: " ++ show l )-		length v == 1-			@? (what ++ " too many variant files in: " ++ show v)-		conflictor `elem` l @? (what ++ " conflictor file missing in: " ++ show l)-		s <- catchMaybeIO (readSymbolicLink (d </> conflictor))-		s == Just symlinktarget-			@? (what ++ " wrong target for nonannexed symlink: " ++ show s)--{- Check merge conflict resolution when there is a local file,- - that is not staged or committed, that conflicts with what's being added- - from the remmote.- -- - Case 1: Remote adds file named conflictor; local has a file named- - conflictor.- -- - Case 2: Remote adds conflictor/file; local has a file named conflictor.- -}-test_uncommitted_conflict_resolution :: TestEnv -> Assertion-test_uncommitted_conflict_resolution testenv = do-	check conflictor-	check (conflictor </> "file")-  where-	check remoteconflictor = withtmpclonerepo testenv False $ \r1 ->-		withtmpclonerepo testenv False $ \r2 -> do-			indir testenv r1 $ do-				disconnectOrigin-				createDirectoryIfMissing True (parentDir remoteconflictor)-				writeFile remoteconflictor annexedcontent-				git_annex testenv "add" [conflictor] @? "add remoteconflicter failed"-				git_annex testenv "sync" [] @? "sync failed in r1"-			indir testenv r2 $ do-				disconnectOrigin-				writeFile conflictor localcontent-			pair testenv r1 r2-			indir testenv r2 $ ifM (annexeval Config.isDirect)-				( do-					git_annex testenv "sync" [] @? "sync failed"-					let local = conflictor ++ localprefix-					doesFileExist local @? (local ++ " missing after merge")-					s <- readFile local-					s == localcontent @? (local ++ " has wrong content: " ++ s)-					git_annex testenv "get" [conflictor] @? "get failed"-					doesFileExist remoteconflictor @? (remoteconflictor ++ " missing after merge")-					s' <- readFile remoteconflictor-					s' == annexedcontent @? (remoteconflictor ++ " has wrong content: " ++ s)-				-- this case is intentionally not handled-				-- in indirect mode, since the user-				-- can recover on their own easily-				, not <$> git_annex testenv "sync" [] @? "sync failed to fail"-				)-	conflictor = "conflictor"-	localprefix = ".variant-local"-	localcontent = "local"-	annexedcontent = "annexed"--{- On Windows/FAT, repeated conflict resolution sometimes - - lost track of whether a file was a symlink. - -}-test_conflict_resolution_symlink_bit :: TestEnv -> Assertion-test_conflict_resolution_symlink_bit testenv =-	withtmpclonerepo testenv False $ \r1 ->-		withtmpclonerepo testenv False $ \r2 ->-			withtmpclonerepo testenv False $ \r3 -> do-				indir testenv r1 $ do-					writeFile conflictor "conflictor"-					git_annex testenv "add" [conflictor] @? "add conflicter failed"-					git_annex testenv "sync" [] @? "sync failed in r1"-					check_is_link conflictor "r1"-				indir testenv r2 $ do-					createDirectory conflictor-					writeFile (conflictor </> "subfile") "subfile"-					git_annex testenv "add" [conflictor] @? "add conflicter failed"-					git_annex testenv "sync" [] @? "sync failed in r2"-					check_is_link (conflictor </> "subfile") "r2"-				indir testenv r3 $ do-					writeFile conflictor "conflictor"-					git_annex testenv "add" [conflictor] @? "add conflicter failed"-					git_annex testenv "sync" [] @? "sync failed in r1"-					check_is_link (conflictor </> "subfile") "r3"-  where-	conflictor = "conflictor"-	check_is_link f what = do-		git_annex_expectoutput testenv "find" ["--include=*", f] [Git.FilePath.toInternalGitPath f]-		l <- annexeval $ Annex.inRepo $ Git.LsTree.lsTreeFiles Git.Ref.headRef [f]-		all (\i -> Git.Types.toBlobType (Git.LsTree.mode i) == Just Git.Types.SymlinkBlob) l-			@? (what ++ " " ++ f ++ " lost symlink bit after merge: " ++ show l)--{- Set up repos as remotes of each other. -}-pair :: TestEnv -> FilePath -> FilePath -> Assertion-pair testenv r1 r2 = forM_ [r1, r2] $ \r -> indir testenv r $ do-	when (r /= r1) $-		boolSystem "git" [Params "remote add r1", File ("../../" ++ r1)] @? "remote add"-	when (r /= r2) $-		boolSystem "git" [Params "remote add r2", File ("../../" ++ r2)] @? "remote add"--test_map :: TestEnv -> Assertion-test_map testenv = intmpclonerepo testenv $ do-	-- set descriptions, that will be looked for in the map-	git_annex testenv "describe" [".", "this repo"] @? "describe 1 failed"-	git_annex testenv "describe" ["origin", "origin repo"] @? "describe 2 failed"-	-- --fast avoids it running graphviz, not a build dependency-	git_annex testenv "map" ["--fast"] @? "map failed"--test_uninit :: TestEnv -> Assertion-test_uninit testenv = intmpclonerepo testenv $ do-	git_annex testenv "get" [] @? "get failed"-	annexed_present annexedfile-	_ <- git_annex testenv "uninit" [] -- exit status not checked; does abnormal exit-	checkregularfile annexedfile-	doesDirectoryExist ".git" @? ".git vanished in uninit"--test_uninit_inbranch :: TestEnv -> Assertion-test_uninit_inbranch testenv = intmpclonerepoInDirect testenv $ do-	boolSystem "git" [Params "checkout git-annex"] @? "git checkout git-annex"-	not <$> git_annex testenv "uninit" [] @? "uninit failed to fail when git-annex branch was checked out"--test_upgrade :: TestEnv -> Assertion-test_upgrade testenv = intmpclonerepo testenv $-	git_annex testenv "upgrade" [] @? "upgrade from same version failed"--test_whereis :: TestEnv -> Assertion-test_whereis testenv = intmpclonerepo testenv $ do-	annexed_notpresent annexedfile-	git_annex testenv "whereis" [annexedfile] @? "whereis on non-present file failed"-	git_annex testenv "untrust" ["origin"] @? "untrust failed"-	not <$> git_annex testenv "whereis" [annexedfile] @? "whereis on non-present file only present in untrusted repo failed to fail"-	git_annex testenv "get" [annexedfile] @? "get failed"-	annexed_present annexedfile-	git_annex testenv "whereis" [annexedfile] @? "whereis on present file failed"--test_hook_remote :: TestEnv -> Assertion-test_hook_remote testenv = intmpclonerepo testenv $ do-#ifndef mingw32_HOST_OS-	git_annex testenv "initremote" (words "foo type=hook encryption=none hooktype=foo") @? "initremote failed"-	createDirectory dir-	git_config "annex.foo-store-hook" $-		"cp $ANNEX_FILE " ++ loc-	git_config "annex.foo-retrieve-hook" $-		"cp " ++ loc ++ " $ANNEX_FILE"-	git_config "annex.foo-remove-hook" $-		"rm -f " ++ loc-	git_config "annex.foo-checkpresent-hook" $-		"if [ -e " ++ loc ++ " ]; then echo $ANNEX_KEY; fi"-	git_annex testenv "get" [annexedfile] @? "get of file failed"-	annexed_present annexedfile-	git_annex testenv "copy" [annexedfile, "--to", "foo"] @? "copy --to hook remote failed"-	annexed_present annexedfile-	git_annex testenv "drop" [annexedfile, "--numcopies=2"] @? "drop failed"-	annexed_notpresent annexedfile-	git_annex testenv "move" [annexedfile, "--from", "foo"] @? "move --from hook remote failed"-	annexed_present annexedfile-	not <$> git_annex testenv "drop" [annexedfile, "--numcopies=2"] @? "drop failed to fail"-	annexed_present annexedfile-  where-	dir = "dir"-	loc = dir ++ "/$ANNEX_KEY"-	git_config k v = boolSystem "git" [Param "config", Param k, Param v]-		@? "git config failed"-#else-	-- this test doesn't work in Windows TODO-	noop-#endif--test_directory_remote :: TestEnv -> Assertion-test_directory_remote testenv = intmpclonerepo testenv $ do-	createDirectory "dir"-	git_annex testenv "initremote" (words "foo type=directory encryption=none directory=dir") @? "initremote failed"-	git_annex testenv "get" [annexedfile] @? "get of file failed"-	annexed_present annexedfile-	git_annex testenv "copy" [annexedfile, "--to", "foo"] @? "copy --to directory remote failed"-	annexed_present annexedfile-	git_annex testenv "drop" [annexedfile, "--numcopies=2"] @? "drop failed"-	annexed_notpresent annexedfile-	git_annex testenv "move" [annexedfile, "--from", "foo"] @? "move --from directory remote failed"-	annexed_present annexedfile-	not <$> git_annex testenv "drop" [annexedfile, "--numcopies=2"] @? "drop failed to fail"-	annexed_present annexedfile--test_rsync_remote :: TestEnv -> Assertion-test_rsync_remote testenv = intmpclonerepo testenv $ do-#ifndef mingw32_HOST_OS-	createDirectory "dir"-	git_annex testenv "initremote" (words "foo type=rsync encryption=none rsyncurl=dir") @? "initremote failed"-	git_annex testenv "get" [annexedfile] @? "get of file failed"-	annexed_present annexedfile-	git_annex testenv "copy" [annexedfile, "--to", "foo"] @? "copy --to rsync remote failed"-	annexed_present annexedfile-	git_annex testenv "drop" [annexedfile, "--numcopies=2"] @? "drop failed"-	annexed_notpresent annexedfile-	git_annex testenv "move" [annexedfile, "--from", "foo"] @? "move --from rsync remote failed"-	annexed_present annexedfile-	not <$> git_annex testenv "drop" [annexedfile, "--numcopies=2"] @? "drop failed to fail"-	annexed_present annexedfile-#else-	-- Rsync remotes with a rsyncurl of a directory do not currently-	-- work on Windows.-	noop-#endif--test_bup_remote :: TestEnv -> Assertion-test_bup_remote testenv = intmpclonerepo testenv $ when Build.SysConfig.bup $ do-	dir <- absPath "dir" -- bup special remote needs an absolute path-	createDirectory dir-	git_annex testenv "initremote" (words $ "foo type=bup encryption=none buprepo="++dir) @? "initremote failed"-	git_annex testenv "get" [annexedfile] @? "get of file failed"-	annexed_present annexedfile-	git_annex testenv "copy" [annexedfile, "--to", "foo"] @? "copy --to bup remote failed"-	annexed_present annexedfile-	git_annex testenv "drop" [annexedfile, "--numcopies=2"] @? "drop failed"-	annexed_notpresent annexedfile-	git_annex testenv "copy" [annexedfile, "--from", "foo"] @? "copy --from bup remote failed"-	annexed_present annexedfile-	git_annex testenv "move" [annexedfile, "--from", "foo"] @? "move --from bup remote failed"-	annexed_present annexedfile---- gpg is not a build dependency, so only test when it's available-test_crypto :: TestEnv -> Assertion-#ifndef mingw32_HOST_OS-test_crypto testenv = do-	testscheme "shared"-	testscheme "hybrid"-	testscheme "pubkey"-  where-	testscheme scheme = intmpclonerepo testenv $ whenM (Utility.Path.inPath Utility.Gpg.gpgcmd) $ do-		Utility.Gpg.testTestHarness @? "test harness self-test failed"-		Utility.Gpg.testHarness $ do-			createDirectory "dir"-			let a cmd = git_annex testenv cmd $-				[ "foo"-				, "type=directory"-				, "encryption=" ++ scheme-				, "directory=dir"-				, "highRandomQuality=false"-				] ++ if scheme `elem` ["hybrid","pubkey"]-					then ["keyid=" ++ Utility.Gpg.testKeyId]-					else []-			a "initremote" @? "initremote failed"-			not <$> a "initremote" @? "initremote failed to fail when run twice in a row"-			a "enableremote" @? "enableremote failed"-			a "enableremote" @? "enableremote failed when run twice in a row"-			git_annex testenv "get" [annexedfile] @? "get of file failed"-			annexed_present annexedfile-			git_annex testenv "copy" [annexedfile, "--to", "foo"] @? "copy --to encrypted remote failed"-			(c,k) <- annexeval $ do-				uuid <- Remote.nameToUUID "foo"-				rs <- Logs.Remote.readRemoteLog-				Just k <- Backend.lookupFile annexedfile-				return (fromJust $ M.lookup uuid rs, k)-			let key = if scheme `elem` ["hybrid","pubkey"]-					then Just $ Utility.Gpg.KeyIds [Utility.Gpg.testKeyId]-					else Nothing-			testEncryptedRemote scheme key c [k] @? "invalid crypto setup"-	-			annexed_present annexedfile-			git_annex testenv "drop" [annexedfile, "--numcopies=2"] @? "drop failed"-			annexed_notpresent annexedfile-			git_annex testenv "move" [annexedfile, "--from", "foo"] @? "move --from encrypted remote failed"-			annexed_present annexedfile-			not <$> git_annex testenv "drop" [annexedfile, "--numcopies=2"] @? "drop failed to fail"-			annexed_present annexedfile-	{- Ensure the configuration complies with the encryption scheme, and-	 - that all keys are encrypted properly for the given directory remote. -}-	testEncryptedRemote scheme ks c keys = case Remote.Helper.Encryptable.extractCipher c of-		Just cip@Crypto.SharedCipher{} | scheme == "shared" && isNothing ks ->-			checkKeys cip Nothing-		Just cip@(Crypto.EncryptedCipher encipher v ks')-			| checkScheme v && keysMatch ks' ->-				checkKeys cip (Just v) <&&> checkCipher encipher ks'-		_ -> return False-	  where-		keysMatch (Utility.Gpg.KeyIds ks') =-			maybe False (\(Utility.Gpg.KeyIds ks2) ->-					sort (nub ks2) == sort (nub ks')) ks-		checkCipher encipher = Utility.Gpg.checkEncryptionStream encipher . Just-		checkScheme Types.Crypto.Hybrid = scheme == "hybrid"-		checkScheme Types.Crypto.PubKey = scheme == "pubkey"-		checkKeys cip mvariant = do-			cipher <- Crypto.decryptCipher cip-			files <- filterM doesFileExist $-				map ("dir" </>) $ concatMap (key2files cipher) keys-			return (not $ null files) <&&> allM (checkFile mvariant) files-		checkFile mvariant filename =-			Utility.Gpg.checkEncryptionFile filename $-				if mvariant == Just Types.Crypto.PubKey then ks else Nothing-		key2files cipher = Locations.keyPaths .-			Crypto.encryptKey Types.Crypto.HmacSha1 cipher-#else-test_crypto _env = putStrLn "gpg testing not implemented on Windows"-#endif--test_add_subdirs :: TestEnv -> Assertion-test_add_subdirs testenv = intmpclonerepo testenv $ do-	createDirectory "dir"-	writeFile ("dir" </> "foo") $ "dir/" ++ content annexedfile-	git_annex testenv "add" ["dir"] @? "add of subdir failed"--	{- Regression test for Windows bug where symlinks were not-	 - calculated correctly for files in subdirs. -}-	git_annex testenv "sync" [] @? "sync failed"-	l <- annexeval $ decodeBS <$> Annex.CatFile.catObject (Git.Types.Ref "HEAD:dir/foo")-	"../.git/annex/" `isPrefixOf` l @? ("symlink from subdir to .git/annex is wrong: " ++ l)--	createDirectory "dir2"-	writeFile ("dir2" </> "foo") $ content annexedfile-	setCurrentDirectory "dir"-	git_annex testenv "add" [".." </> "dir2"] @? "add of ../subdir failed"---- This is equivilant to running git-annex, but it's all run in-process--- (when the OS allows) so test coverage collection works.-git_annex :: TestEnv -> String -> [String] -> IO Bool-git_annex testenv command params = do-	forM_ (M.toList testenv) $ \(var, val) ->-		Utility.Env.setEnv var val True--	-- catch all errors, including normally fatal errors-	r <- try run::IO (Either SomeException ())-	case r of-		Right _ -> return True-		Left _ -> return False-  where-	run = GitAnnex.run (command:"-q":params)--{- Runs git-annex and returns its output. -}-git_annex_output :: TestEnv -> String -> [String] -> IO String-git_annex_output testenv command params = do-	got <- Utility.Process.readProcessEnv "git-annex" (command:params)-		(Just $ M.toList testenv)-	-- XXX since the above is a separate process, code coverage stats are-	-- not gathered for things run in it.-	-- Run same command again, to get code coverage.-	_ <- git_annex testenv command params-	return got--git_annex_expectoutput :: TestEnv -> String -> [String] -> [String] -> IO ()-git_annex_expectoutput testenv command params expected = do-	got <- lines <$> git_annex_output testenv command params-	got == expected @? ("unexpected value running " ++ command ++ " " ++ show params ++ " -- got: " ++ show got ++ " expected: " ++ show expected)---- Runs an action in the current annex. Note that shutdown actions--- are not run; this should only be used for actions that query state.-annexeval :: Types.Annex a -> IO a-annexeval a = do-	s <- Annex.new =<< Git.CurrentRepo.get-	Annex.eval s $ do-		Annex.setOutput Types.Messages.QuietOutput-		a--innewrepo :: TestEnv -> Assertion -> Assertion-innewrepo testenv a = withgitrepo testenv $ \r -> indir testenv r a--inmainrepo :: TestEnv -> Assertion -> Assertion-inmainrepo testenv = indir testenv mainrepodir--intmpclonerepo :: TestEnv -> Assertion -> Assertion-intmpclonerepo testenv a = withtmpclonerepo testenv False $ \r -> indir testenv r a--intmpclonerepoInDirect :: TestEnv -> Assertion -> Assertion-intmpclonerepoInDirect testenv a = intmpclonerepo testenv $-	ifM isdirect-		( putStrLn "not supported in direct mode; skipping"-		, a-		)-  where-	isdirect = annexeval $ do-		Annex.Init.initialize Nothing-		Config.isDirect--checkRepo :: Types.Annex a -> FilePath -> IO a-checkRepo getval d = do-	s <- Annex.new =<< Git.Construct.fromPath d-	Annex.eval s getval--isInDirect :: FilePath -> IO Bool-isInDirect = checkRepo (not <$> Config.isDirect)--intmpbareclonerepo :: TestEnv -> Assertion -> Assertion-intmpbareclonerepo testenv a = withtmpclonerepo testenv True $ \r -> indir testenv r a--withtmpclonerepo :: TestEnv -> Bool -> (FilePath -> Assertion) -> Assertion-withtmpclonerepo testenv bare a = do-	dir <- tmprepodir-	bracket (clonerepo testenv mainrepodir dir bare) cleanup a--disconnectOrigin :: Assertion-disconnectOrigin = boolSystem "git" [Params "remote rm origin"] @? "remote rm"--withgitrepo :: TestEnv -> (FilePath -> Assertion) -> Assertion-withgitrepo testenv = bracket (setuprepo testenv mainrepodir) return--indir :: TestEnv -> FilePath -> Assertion -> Assertion-indir testenv dir a = do-	currdir <- getCurrentDirectory-	-- Assertion failures throw non-IO errors; catch-	-- any type of error and change back to currdir before-	-- rethrowing.-	r <- bracket_ (changeToTmpDir testenv dir) (setCurrentDirectory currdir)-		(try a::IO (Either SomeException ()))-	case r of-		Right () -> return ()-		Left e -> throwM e--setuprepo :: TestEnv -> FilePath -> IO FilePath-setuprepo testenv dir = do-	cleanup dir-	ensuretmpdir-	boolSystem "git" [Params "init -q", File dir] @? "git init failed"-	configrepo testenv dir-	return dir---- clones are always done as local clones; we cannot test ssh clones-clonerepo :: TestEnv -> FilePath -> FilePath -> Bool -> IO FilePath-clonerepo testenv old new bare = do-	cleanup new-	ensuretmpdir-	let b = if bare then " --bare" else ""-	boolSystem "git" [Params ("clone -q" ++ b), File old, File new] @? "git clone failed"-	configrepo testenv new-	indir testenv new $-		git_annex testenv "init" ["-q", new] @? "git annex init failed"-	unless bare $-		indir testenv new $-			handleforcedirect testenv-	return new--configrepo :: TestEnv -> FilePath -> IO ()-configrepo testenv dir = indir testenv dir $ do-	-- ensure git is set up to let commits happen-	boolSystem "git" [Params "config user.name", Param "Test User"] @? "git config failed"-	boolSystem "git" [Params "config user.email test@example.com"] @? "git config failed"-	-- avoid signed commits by test suite-	boolSystem "git" [Params "config commit.gpgsign false"] @? "git config failed"--handleforcedirect :: TestEnv -> IO ()-handleforcedirect testenv = when (M.lookup "FORCEDIRECT" testenv == Just "1") $-	git_annex testenv "direct" ["-q"] @? "git annex direct failed"-	-ensuretmpdir :: IO ()-ensuretmpdir = do-	e <- doesDirectoryExist tmpdir-	unless e $-		createDirectory tmpdir--cleanup :: FilePath -> IO ()-cleanup = cleanup' False--cleanup' :: Bool -> FilePath -> IO ()-cleanup' final dir = whenM (doesDirectoryExist dir) $ do-	Command.Uninit.prepareRemoveAnnexDir dir-	-- This sometimes fails on Windows, due to some files-	-- being still opened by a subprocess.-	catchIO (removeDirectoryRecursive dir) $ \e ->-		when final $ do-			print e-			putStrLn "sleeping 10 seconds and will retry directory cleanup"-			Utility.ThreadScheduler.threadDelaySeconds (Utility.ThreadScheduler.Seconds 10)-			whenM (doesDirectoryExist dir) $-				removeDirectoryRecursive dir-	-checklink :: FilePath -> Assertion-checklink f = do-	s <- getSymbolicLinkStatus f-	-- in direct mode, it may be a symlink, or not, depending-	-- on whether the content is present.-	unlessM (annexeval Config.isDirect) $-		isSymbolicLink s @? f ++ " is not a symlink"--checkregularfile :: FilePath -> Assertion-checkregularfile f = do-	s <- getSymbolicLinkStatus f-	isRegularFile s @? f ++ " is not a normal file"-	return ()--checkcontent :: FilePath -> Assertion-checkcontent f = do-	c <- Utility.Exception.catchDefaultIO "could not read file" $ readFile f-	assertEqual ("checkcontent " ++ f) (content f) c--checkunwritable :: FilePath -> Assertion-checkunwritable f = unlessM (annexeval Config.isDirect) $ do-	-- Look at permissions bits rather than trying to write or-	-- using fileAccess because if run as root, any file can be-	-- modified despite permissions.-	s <- getFileStatus f-	let mode = fileMode s-	when (mode == mode `unionFileModes` ownerWriteMode) $-		assertFailure $ "able to modify annexed file's " ++ f ++ " content"--checkwritable :: FilePath -> Assertion-checkwritable f = do-	r <- tryIO $ writeFile f $ content f-	case r of-		Left _ -> assertFailure $ "unable to modify " ++ f-		Right _ -> return ()--checkdangling :: FilePath -> Assertion-checkdangling f = ifM (annexeval Config.crippledFileSystem)-	( return () -- probably no real symlinks to test-	, do-		r <- tryIO $ readFile f-		case r of-			Left _ -> return () -- expected; dangling link-			Right _ -> assertFailure $ f ++ " was not a dangling link as expected"-	)--checklocationlog :: FilePath -> Bool -> Assertion-checklocationlog f expected = do-	thisuuid <- annexeval Annex.UUID.getUUID-	r <- annexeval $ Backend.lookupFile f-	case r of-		Just k -> do-			uuids <- annexeval $ Remote.keyLocations k-			assertEqual ("bad content in location log for " ++ f ++ " key " ++ Types.Key.key2file k ++ " uuid " ++ show thisuuid)-				expected (thisuuid `elem` uuids)-		_ -> assertFailure $ f ++ " failed to look up key"--checkbackend :: FilePath -> Types.Backend -> Assertion-checkbackend file expected = do-	b <- annexeval $ maybe (return Nothing) (Backend.getBackend file) -		=<< Backend.lookupFile file-	assertEqual ("backend for " ++ file) (Just expected) b--inlocationlog :: FilePath -> Assertion-inlocationlog f = checklocationlog f True--notinlocationlog :: FilePath -> Assertion-notinlocationlog f = checklocationlog f False--runchecks :: [FilePath -> Assertion] -> FilePath -> Assertion-runchecks [] _ = return ()-runchecks (a:as) f = do-	a f-	runchecks as f--annexed_notpresent :: FilePath -> Assertion-annexed_notpresent = runchecks-	[checklink, checkdangling, notinlocationlog]--annexed_present :: FilePath -> Assertion-annexed_present = runchecks-	[checklink, checkcontent, checkunwritable, inlocationlog]--unannexed :: FilePath -> Assertion-unannexed = runchecks [checkregularfile, checkcontent, checkwritable]--withTestEnv :: Bool -> (IO TestEnv -> TestTree) -> TestTree-withTestEnv forcedirect = withResource prepare release-  where-	prepare = do-		testenv <- prepareTestEnv forcedirect-		case tryIngredients [consoleTestReporter] mempty (initTests testenv) of-			Nothing -> error "No tests found!?"-			Just act -> unlessM act $-				error "init tests failed! cannot continue"-		return testenv-	release = releaseTestEnv--releaseTestEnv :: TestEnv -> IO ()-releaseTestEnv _env = cleanup' True tmpdir--prepareTestEnv :: Bool -> IO TestEnv-prepareTestEnv forcedirect = do-	whenM (doesDirectoryExist tmpdir) $-		error $ "The temporary directory " ++ tmpdir ++ " already exists; cannot run test suite."--	currdir <- getCurrentDirectory-	p <- Utility.Env.getEnvDefault "PATH" ""--	environ <- Utility.Env.getEnvironment-	let newenv =-		-- Ensure that the just-built git annex is used.-		[ ("PATH", currdir ++ [searchPathSeparator] ++ p)-		, ("TOPDIR", currdir)-		-- Avoid git complaining if it cannot determine the user's-		-- email address, or exploding if it doesn't know the user's-		-- name.-		, ("GIT_AUTHOR_EMAIL", "test@example.com")-		, ("GIT_AUTHOR_NAME", "git-annex test")-		, ("GIT_COMMITTER_EMAIL", "test@example.com")-		, ("GIT_COMMITTER_NAME", "git-annex test")-		-- force gpg into batch mode for the tests-		, ("GPG_BATCH", "1")-		, ("FORCEDIRECT", if forcedirect then "1" else "")-		]--	return $ M.fromList newenv `M.union` M.fromList environ--changeToTmpDir :: TestEnv -> FilePath -> IO ()-changeToTmpDir testenv t = do-	let topdir = fromMaybe "" $ M.lookup "TOPDIR" testenv+main :: [String] -> IO ()+main ps = do+	let tests = testGroup "Tests"+		-- Test both direct and indirect mode.+		-- Windows is only going to use direct mode,+		-- so don't test twice.+		[ properties+#ifndef mingw32_HOST_OS+		, withTestEnv True $ unitTests "(direct)"+		, withTestEnv False $ unitTests "(indirect)"+#else+		, withTestEnv False $ unitTests ""+#endif+		]++	-- Can't use tasty's defaultMain because one of the command line+	-- parameters is "test".+	let pinfo = info (helper <*> suiteOptionParser ingredients tests)+		( fullDesc <> header "Builtin test suite" )+	opts <- parseOpts (prefs idm) pinfo ps+	case tryIngredients ingredients opts tests of+		Nothing -> error "No tests found!?"+		Just act -> ifM act+			( exitSuccess+			, do+				putStrLn "  (This could be due to a bug in git-annex, or an incompatability"+				putStrLn "   with utilities, such as git, installed on this system.)"+				exitFailure+			)+  where+	parseOpts pprefs pinfo args =+#if MIN_VERSION_optparse_applicative(0,10,0)+		case execParserPure pprefs pinfo args of+			(Options.Applicative.Failure failure) -> do+				let (msg, _exit) = renderFailure failure "git-annex test"+				error msg+			v -> handleParseResult v+#else+		handleParseResult $ execParserPure pprefs pinfo args+#endif++ingredients :: [Ingredient]+ingredients =+	[ rerunningTests [consoleTestReporter]+	, listingTests+	]++properties :: TestTree+properties = localOption (QuickCheckTests 1000) $ testGroup "QuickCheck"+	[ testProperty "prop_idempotent_deencode_git" Git.Filename.prop_idempotent_deencode+	, testProperty "prop_idempotent_deencode" Utility.Format.prop_idempotent_deencode+	, testProperty "prop_idempotent_fileKey" Locations.prop_idempotent_fileKey+	, testProperty "prop_idempotent_key_encode" Types.Key.prop_idempotent_key_encode+	, testProperty "prop_idempotent_key_decode" Types.Key.prop_idempotent_key_decode+	, testProperty "prop_idempotent_shellEscape" Utility.SafeCommand.prop_idempotent_shellEscape+	, testProperty "prop_idempotent_shellEscape_multiword" Utility.SafeCommand.prop_idempotent_shellEscape_multiword+	, testProperty "prop_logs_sane" Logs.prop_logs_sane+	, testProperty "prop_idempotent_configEscape" Logs.Remote.prop_idempotent_configEscape+	, testProperty "prop_parse_show_Config" Logs.Remote.prop_parse_show_Config+	, testProperty "prop_parentDir_basics" Utility.Path.prop_parentDir_basics+	, testProperty "prop_relPathDirToFile_basics" Utility.Path.prop_relPathDirToFile_basics+	, testProperty "prop_relPathDirToFile_regressionTest" Utility.Path.prop_relPathDirToFile_regressionTest+	, testProperty "prop_cost_sane" Config.Cost.prop_cost_sane+	, testProperty "prop_matcher_sane" Utility.Matcher.prop_matcher_sane+	, testProperty "prop_HmacSha1WithCipher_sane" Crypto.prop_HmacSha1WithCipher_sane+	, testProperty "prop_TimeStamp_sane" Logs.MapLog.prop_TimeStamp_sane+	, testProperty "prop_addMapLog_sane" Logs.MapLog.prop_addMapLog_sane+	, testProperty "prop_verifiable_sane" Utility.Verifiable.prop_verifiable_sane+	, testProperty "prop_segment_regressionTest" Utility.Misc.prop_segment_regressionTest+	, testProperty "prop_read_write_transferinfo" Logs.Transfer.prop_read_write_transferinfo+	, testProperty "prop_read_show_inodecache" Utility.InodeCache.prop_read_show_inodecache+	, testProperty "prop_parse_show_log" Logs.Presence.prop_parse_show_log+	, testProperty "prop_read_show_TrustLevel" Types.TrustLevel.prop_read_show_TrustLevel+	, testProperty "prop_parse_show_TrustLog" Logs.Trust.prop_parse_show_TrustLog+	, testProperty "prop_hashes_stable" Utility.Hash.prop_hashes_stable+	, testProperty "prop_schedule_roundtrips" Utility.Scheduled.prop_schedule_roundtrips+	, testProperty "prop_past_sane" Utility.Scheduled.prop_past_sane+	, testProperty "prop_duration_roundtrips" Utility.HumanTime.prop_duration_roundtrips+	, testProperty "prop_metadata_sane" Types.MetaData.prop_metadata_sane+	, testProperty "prop_metadata_serialize" Types.MetaData.prop_metadata_serialize+	, testProperty "prop_branchView_legal" Logs.View.prop_branchView_legal+	, testProperty "prop_view_roundtrips" Annex.View.prop_view_roundtrips+	, testProperty "prop_viewedFile_rountrips" Annex.View.ViewedFile.prop_viewedFile_roundtrips+	]++{- These tests set up the test environment, but also test some basic parts+ - of git-annex. They are always run before the unitTests. -}+initTests :: TestTree+initTests = testGroup "Init Tests"+	[ testCase "init" test_init+	, testCase "add" test_add+	]++unitTests :: String -> TestTree+unitTests note = testGroup ("Unit Tests " ++ note)+	[ testCase "add sha1dup" test_add_sha1dup+	, testCase "add extras" test_add_extras+	, testCase "reinject" test_reinject+	, testCase "unannex (no copy)" test_unannex_nocopy+	, testCase "unannex (with copy)" test_unannex_withcopy+	, testCase "drop (no remote)" test_drop_noremote+	, testCase "drop (with remote)" test_drop_withremote+	, testCase "drop (untrusted remote)" test_drop_untrustedremote+	, testCase "get" test_get+	, testCase "move" test_move+	, testCase "copy" test_copy+	, testCase "lock" test_lock+	, testCase "edit (no pre-commit)" test_edit+	, testCase "edit (pre-commit)" test_edit_precommit+	, testCase "partial commit" test_partial_commit+	, testCase "fix" test_fix+	, testCase "trust" test_trust+	, testCase "fsck (basics)" test_fsck_basic+	, testCase "fsck (bare)" test_fsck_bare+	, testCase "fsck (local untrusted)" test_fsck_localuntrusted+	, testCase "fsck (remote untrusted)" test_fsck_remoteuntrusted+	, testCase "migrate" test_migrate+	, testCase "migrate (via gitattributes)" test_migrate_via_gitattributes+	, testCase "unused" test_unused+	, testCase "describe" test_describe+	, testCase "find" test_find+	, testCase "merge" test_merge+	, testCase "info" test_info+	, testCase "version" test_version+	, testCase "sync" test_sync+	, testCase "union merge regression" test_union_merge_regression+	, testCase "conflict resolution" test_conflict_resolution+	, testCase "conflict resolution movein regression" test_conflict_resolution_movein_regression+	, testCase "conflict resolution (mixed directory and file)" test_mixed_conflict_resolution+	, testCase "conflict resolution symlink bit" test_conflict_resolution_symlink_bit+	, testCase "conflict resolution (uncommitted local file)" test_uncommitted_conflict_resolution+	, testCase "conflict resolution (removed file)" test_remove_conflict_resolution+	, testCase "conflict resolution (nonannexed file)" test_nonannexed_file_conflict_resolution+	, testCase "conflict resolution (nonannexed symlink)" test_nonannexed_symlink_conflict_resolution+	, testCase "map" test_map+	, testCase "uninit" test_uninit+	, testCase "uninit (in git-annex branch)" test_uninit_inbranch+	, testCase "upgrade" test_upgrade+	, testCase "whereis" test_whereis+	, testCase "hook remote" test_hook_remote+	, testCase "directory remote" test_directory_remote+	, testCase "rsync remote" test_rsync_remote+	, testCase "bup remote" test_bup_remote+	, testCase "crypto" test_crypto+	, testCase "preferred content" test_preferred_content+	, testCase "add subdirs" test_add_subdirs+	]++-- this test case create the main repo+test_init :: Assertion+test_init = innewrepo $ do+	git_annex "init" [reponame] @? "init failed"+	handleforcedirect+  where+	reponame = "test repo"++-- this test case runs in the main repo, to set up a basic+-- annexed file that later tests will use+test_add :: Assertion+test_add = inmainrepo $ do+	writeFile annexedfile $ content annexedfile+	git_annex "add" [annexedfile] @? "add failed"+	annexed_present annexedfile+	writeFile sha1annexedfile $ content sha1annexedfile+	git_annex "add" [sha1annexedfile, "--backend=SHA1"] @? "add with SHA1 failed"+	annexed_present sha1annexedfile+	checkbackend sha1annexedfile backendSHA1+	ifM (annexeval Config.isDirect)+		( do+			writeFile ingitfile $ content ingitfile+			not <$> boolSystem "git" [Param "add", File ingitfile] @? "git add failed to fail in direct mode"+			nukeFile ingitfile+			git_annex "sync" [] @? "sync failed"+		, do+			writeFile ingitfile $ content ingitfile+			boolSystem "git" [Param "add", File ingitfile] @? "git add failed"+			boolSystem "git" [Params "commit -q -m commit"] @? "git commit failed"+			git_annex "add" [ingitfile] @? "add ingitfile should be no-op"+			unannexed ingitfile+		)++test_add_sha1dup :: Assertion+test_add_sha1dup = intmpclonerepo $ do+	writeFile sha1annexedfiledup $ content sha1annexedfiledup+	git_annex "add" [sha1annexedfiledup, "--backend=SHA1"] @? "add of second file with same SHA1 failed"+	annexed_present sha1annexedfiledup+	annexed_present sha1annexedfile++test_add_extras :: Assertion+test_add_extras = intmpclonerepo $ do+	writeFile wormannexedfile $ content wormannexedfile+	git_annex "add" [wormannexedfile, "--backend=WORM"] @? "add with WORM failed"+	annexed_present wormannexedfile+	checkbackend wormannexedfile backendWORM++test_reinject :: Assertion+test_reinject = intmpclonerepoInDirect $ do+	git_annex "drop" ["--force", sha1annexedfile] @? "drop failed"+	writeFile tmp $ content sha1annexedfile+	r <- annexeval $ Types.Backend.getKey backendSHA1+		Types.KeySource.KeySource { Types.KeySource.keyFilename = tmp, Types.KeySource.contentLocation = tmp, Types.KeySource.inodeCache = Nothing }+	let key = Types.Key.key2file $ fromJust r+	git_annex "reinject" [tmp, sha1annexedfile] @? "reinject failed"+	git_annex "fromkey" [key, sha1annexedfiledup] @? "fromkey failed for dup"+	annexed_present sha1annexedfiledup+  where+	tmp = "tmpfile"++test_unannex_nocopy :: Assertion+test_unannex_nocopy = intmpclonerepo $ do+	annexed_notpresent annexedfile+	git_annex "unannex" [annexedfile] @? "unannex failed with no copy"+	annexed_notpresent annexedfile++test_unannex_withcopy :: Assertion+test_unannex_withcopy = intmpclonerepo $ do+	git_annex "get" [annexedfile] @? "get failed"+	annexed_present annexedfile+	git_annex "unannex" [annexedfile, sha1annexedfile] @? "unannex failed"+	unannexed annexedfile+	git_annex "unannex" [annexedfile] @? "unannex failed on non-annexed file"+	unannexed annexedfile+	unlessM (annexeval Config.isDirect) $ do+		git_annex "unannex" [ingitfile] @? "unannex ingitfile should be no-op"+		unannexed ingitfile++test_drop_noremote :: Assertion+test_drop_noremote = intmpclonerepo $ do+	git_annex "get" [annexedfile] @? "get failed"+	boolSystem "git" [Params "remote rm origin"]+		@? "git remote rm origin failed"+	not <$> git_annex "drop" [annexedfile] @? "drop wrongly succeeded with no known copy of file"+	annexed_present annexedfile+	git_annex "drop" ["--force", annexedfile] @? "drop --force failed"+	annexed_notpresent annexedfile+	git_annex "drop" [annexedfile] @? "drop of dropped file failed"+	unlessM (annexeval Config.isDirect) $ do+		git_annex "drop" [ingitfile] @? "drop ingitfile should be no-op"+		unannexed ingitfile++test_drop_withremote :: Assertion+test_drop_withremote = intmpclonerepo $ do+	git_annex "get" [annexedfile] @? "get failed"+	annexed_present annexedfile+	git_annex "numcopies" ["2"] @? "numcopies config failed"+	not <$> git_annex "drop" [annexedfile] @? "drop succeeded although numcopies is not satisfied"+	git_annex "numcopies" ["1"] @? "numcopies config failed"+	git_annex "drop" [annexedfile] @? "drop failed though origin has copy"+	annexed_notpresent annexedfile+	inmainrepo $ annexed_present annexedfile++test_drop_untrustedremote :: Assertion+test_drop_untrustedremote = intmpclonerepo $ do+	git_annex "untrust" ["origin"] @? "untrust of origin failed"+	git_annex "get" [annexedfile] @? "get failed"+	annexed_present annexedfile+	not <$> git_annex "drop" [annexedfile] @? "drop wrongly suceeded with only an untrusted copy of the file"+	annexed_present annexedfile+	inmainrepo $ annexed_present annexedfile++test_get :: Assertion+test_get = intmpclonerepo $ do+	inmainrepo $ annexed_present annexedfile+	annexed_notpresent annexedfile+	git_annex "get" [annexedfile] @? "get of file failed"+	inmainrepo $ annexed_present annexedfile+	annexed_present annexedfile+	git_annex "get" [annexedfile] @? "get of file already here failed"+	inmainrepo $ annexed_present annexedfile+	annexed_present annexedfile+	unlessM (annexeval Config.isDirect) $ do+		inmainrepo $ unannexed ingitfile+		unannexed ingitfile+		git_annex "get" [ingitfile] @? "get ingitfile should be no-op"+		inmainrepo $ unannexed ingitfile+		unannexed ingitfile++test_move :: Assertion+test_move = intmpclonerepo $ do+	annexed_notpresent annexedfile+	inmainrepo $ annexed_present annexedfile+	git_annex "move" ["--from", "origin", annexedfile] @? "move --from of file failed"+	annexed_present annexedfile+	inmainrepo $ annexed_notpresent annexedfile+	git_annex "move" ["--from", "origin", annexedfile] @? "move --from of file already here failed"+	annexed_present annexedfile+	inmainrepo $ annexed_notpresent annexedfile+	git_annex "move" ["--to", "origin", annexedfile] @? "move --to of file failed"+	inmainrepo $ annexed_present annexedfile+	annexed_notpresent annexedfile+	git_annex "move" ["--to", "origin", annexedfile] @? "move --to of file already there failed"+	inmainrepo $ annexed_present annexedfile+	annexed_notpresent annexedfile+	unlessM (annexeval Config.isDirect) $ do+		unannexed ingitfile+		inmainrepo $ unannexed ingitfile+		git_annex "move" ["--to", "origin", ingitfile] @? "move of ingitfile should be no-op"+		unannexed ingitfile+		inmainrepo $ unannexed ingitfile+		git_annex "move" ["--from", "origin", ingitfile] @? "move of ingitfile should be no-op"+		unannexed ingitfile+		inmainrepo $ unannexed ingitfile++test_copy :: Assertion+test_copy = intmpclonerepo $ do+	annexed_notpresent annexedfile+	inmainrepo $ annexed_present annexedfile+	git_annex "copy" ["--from", "origin", annexedfile] @? "copy --from of file failed"+	annexed_present annexedfile+	inmainrepo $ annexed_present annexedfile+	git_annex "copy" ["--from", "origin", annexedfile] @? "copy --from of file already here failed"+	annexed_present annexedfile+	inmainrepo $ annexed_present annexedfile+	git_annex "copy" ["--to", "origin", annexedfile] @? "copy --to of file already there failed"+	annexed_present annexedfile+	inmainrepo $ annexed_present annexedfile+	git_annex "move" ["--to", "origin", annexedfile] @? "move --to of file already there failed"+	annexed_notpresent annexedfile+	inmainrepo $ annexed_present annexedfile+	unlessM (annexeval Config.isDirect) $ do+		unannexed ingitfile+		inmainrepo $ unannexed ingitfile+		git_annex "copy" ["--to", "origin", ingitfile] @? "copy of ingitfile should be no-op"+		unannexed ingitfile+		inmainrepo $ unannexed ingitfile+		git_annex "copy" ["--from", "origin", ingitfile] @? "copy of ingitfile should be no-op"+		checkregularfile ingitfile+		checkcontent ingitfile++test_preferred_content :: Assertion+test_preferred_content = intmpclonerepo $ do+	annexed_notpresent annexedfile+	-- get --auto only looks at numcopies when preferred content is not+	-- set, and with 1 copy existing, does not get the file.+	git_annex "get" ["--auto", annexedfile] @? "get --auto of file failed with default preferred content"+	annexed_notpresent annexedfile++	git_annex "wanted" [".", "standard"] @? "set expression to standard failed"+	git_annex "group" [".", "client"] @? "set group to standard failed"+	git_annex "get" ["--auto", annexedfile] @? "get --auto of file failed for client"+	annexed_present annexedfile+	git_annex "ungroup" [".", "client"] @? "ungroup failed"++	git_annex "wanted" [".", "standard"] @? "set expression to standard failed"+	git_annex "group" [".", "manual"] @? "set group to manual failed"+	-- drop --auto with manual leaves the file where it is+	git_annex "drop" ["--auto", annexedfile] @? "drop --auto of file failed with manual preferred content"+	annexed_present annexedfile+	git_annex "drop" [annexedfile] @? "drop of file failed"+	annexed_notpresent annexedfile+	-- get --auto with manual does not get the file+	git_annex "get" ["--auto", annexedfile] @? "get --auto of file failed with manual preferred content"+	annexed_notpresent annexedfile+	git_annex "ungroup" [".", "client"] @? "ungroup failed"+	+	git_annex "wanted" [".", "exclude=*"] @? "set expression to exclude=* failed"+	git_annex "get" [annexedfile] @? "get of file failed"+	annexed_present annexedfile+	git_annex "drop" ["--auto", annexedfile] @? "drop --auto of file failed with exclude=*"+	annexed_notpresent annexedfile+	git_annex "get" ["--auto", annexedfile] @? "get --auto of file failed with exclude=*"+	annexed_notpresent annexedfile++test_lock :: Assertion+test_lock = intmpclonerepoInDirect $ do+	-- regression test: unlock of not present file should skip it+	annexed_notpresent annexedfile+	not <$> git_annex "unlock" [annexedfile] @? "unlock failed to fail with not present file"+	annexed_notpresent annexedfile++	git_annex "get" [annexedfile] @? "get of file failed"+	annexed_present annexedfile+	git_annex "unlock" [annexedfile] @? "unlock failed"		+	unannexed annexedfile+	-- write different content, to verify that lock+	-- throws it away+	changecontent annexedfile+	writeFile annexedfile $ content annexedfile ++ "foo"+	not <$> git_annex "lock" [annexedfile] @? "lock failed to fail without --force"+	git_annex "lock" ["--force", annexedfile] @? "lock --force failed"+	annexed_present annexedfile+	git_annex "unlock" [annexedfile] @? "unlock failed"		+	unannexed annexedfile+	changecontent annexedfile+	git_annex "add" [annexedfile] @? "add of modified file failed"+	runchecks [checklink, checkunwritable] annexedfile+	c <- readFile annexedfile+	assertEqual "content of modified file" c (changedcontent annexedfile)+	r' <- git_annex "drop" [annexedfile]+	not r' @? "drop wrongly succeeded with no known copy of modified file"++test_edit :: Assertion+test_edit = test_edit' False++test_edit_precommit :: Assertion+test_edit_precommit = test_edit' True++test_edit' :: Bool -> Assertion+test_edit' precommit = intmpclonerepoInDirect $ do+	git_annex "get" [annexedfile] @? "get of file failed"+	annexed_present annexedfile+	git_annex "edit" [annexedfile] @? "edit failed"+	unannexed annexedfile+	changecontent annexedfile+	boolSystem "git" [Param "add", File annexedfile]+		@? "git add of edited file failed"+	if precommit+		then git_annex "pre-commit" []+			@? "pre-commit failed"+		else boolSystem "git" [Params "commit -q -m contentchanged"]+			@? "git commit of edited file failed"+	runchecks [checklink, checkunwritable] annexedfile+	c <- readFile annexedfile+	assertEqual "content of modified file" c (changedcontent annexedfile)+	not <$> git_annex "drop" [annexedfile] @? "drop wrongly succeeded with no known copy of modified file"++test_partial_commit :: Assertion+test_partial_commit = intmpclonerepoInDirect $ do+	git_annex "get" [annexedfile] @? "get of file failed"+	annexed_present annexedfile+	git_annex "unlock" [annexedfile] @? "unlock failed"+	not <$> boolSystem "git" [Params "commit -q -m test", File annexedfile]+		@? "partial commit of unlocked file not blocked by pre-commit hook"++test_fix :: Assertion+test_fix = intmpclonerepoInDirect $ do+	annexed_notpresent annexedfile+	git_annex "fix" [annexedfile] @? "fix of not present failed"+	annexed_notpresent annexedfile+	git_annex "get" [annexedfile] @? "get of file failed"+	annexed_present annexedfile+	git_annex "fix" [annexedfile] @? "fix of present file failed"+	annexed_present annexedfile+	createDirectory subdir+	boolSystem "git" [Param "mv", File annexedfile, File subdir]+		@? "git mv failed"+	git_annex "fix" [newfile] @? "fix of moved file failed"+	runchecks [checklink, checkunwritable] newfile+	c <- readFile newfile+	assertEqual "content of moved file" c (content annexedfile)+  where+	subdir = "s"+	newfile = subdir ++ "/" ++ annexedfile++test_trust :: Assertion+test_trust = intmpclonerepo $ do+	git_annex "trust" [repo] @? "trust failed"+	trustcheck Logs.Trust.Trusted "trusted 1"+	git_annex "trust" [repo] @? "trust of trusted failed"+	trustcheck Logs.Trust.Trusted "trusted 2"+	git_annex "untrust" [repo] @? "untrust failed"+	trustcheck Logs.Trust.UnTrusted "untrusted 1"+	git_annex "untrust" [repo] @? "untrust of untrusted failed"+	trustcheck Logs.Trust.UnTrusted "untrusted 2"+	git_annex "dead" [repo] @? "dead failed"+	trustcheck Logs.Trust.DeadTrusted "deadtrusted 1"+	git_annex "dead" [repo] @? "dead of dead failed"+	trustcheck Logs.Trust.DeadTrusted "deadtrusted 2"+	git_annex "semitrust" [repo] @? "semitrust failed"+	trustcheck Logs.Trust.SemiTrusted "semitrusted 1"+	git_annex "semitrust" [repo] @? "semitrust of semitrusted failed"+	trustcheck Logs.Trust.SemiTrusted "semitrusted 2"+  where+	repo = "origin"+	trustcheck expected msg = do+		present <- annexeval $ do+			l <- Logs.Trust.trustGet expected+			u <- Remote.nameToUUID repo+			return $ u `elem` l+		assertBool msg present++test_fsck_basic :: Assertion+test_fsck_basic = intmpclonerepo $ do+	git_annex "fsck" [] @? "fsck failed"+	git_annex "numcopies" ["2"] @? "numcopies config failed"+	fsck_should_fail "numcopies unsatisfied"+	git_annex "numcopies" ["1"] @? "numcopies config failed"+	corrupt annexedfile+	corrupt sha1annexedfile+  where+	corrupt f = do+		git_annex "get" [f] @? "get of file failed"+		Utility.FileMode.allowWrite f+		writeFile f (changedcontent f)+		ifM (annexeval Config.isDirect)+			( git_annex "fsck" [] @? "fsck failed in direct mode with changed file content"+			, not <$> git_annex "fsck" [] @? "fsck failed to fail with corrupted file content"+			)+		git_annex "fsck" [] @? "fsck unexpectedly failed again; previous one did not fix problem with " ++ f++test_fsck_bare :: Assertion+test_fsck_bare = intmpbareclonerepo $+	git_annex "fsck" [] @? "fsck failed"++test_fsck_localuntrusted :: Assertion+test_fsck_localuntrusted = intmpclonerepo $ do+	git_annex "get" [annexedfile] @? "get failed"+	git_annex "untrust" ["origin"] @? "untrust of origin repo failed"+	git_annex "untrust" ["."] @? "untrust of current repo failed"+	fsck_should_fail "content only available in untrusted (current) repository"+	git_annex "trust" ["."] @? "trust of current repo failed"+	git_annex "fsck" [annexedfile] @? "fsck failed on file present in trusted repo"++test_fsck_remoteuntrusted :: Assertion+test_fsck_remoteuntrusted = intmpclonerepo $ do+	git_annex "numcopies" ["2"] @? "numcopies config failed"+	git_annex "get" [annexedfile] @? "get failed"+	git_annex "get" [sha1annexedfile] @? "get failed"+	git_annex "fsck" [] @? "fsck failed with numcopies=2 and 2 copies"+	git_annex "untrust" ["origin"] @? "untrust of origin failed"+	fsck_should_fail "content not replicated to enough non-untrusted repositories"++fsck_should_fail :: String -> Assertion+fsck_should_fail m = not <$> git_annex "fsck" []+	@? "fsck failed to fail with " ++ m++test_migrate :: Assertion+test_migrate = test_migrate' False++test_migrate_via_gitattributes :: Assertion+test_migrate_via_gitattributes = test_migrate' True++test_migrate' :: Bool -> Assertion+test_migrate' usegitattributes = intmpclonerepoInDirect $ do+	annexed_notpresent annexedfile+	annexed_notpresent sha1annexedfile+	git_annex "migrate" [annexedfile] @? "migrate of not present failed"+	git_annex "migrate" [sha1annexedfile] @? "migrate of not present failed"+	git_annex "get" [annexedfile] @? "get of file failed"+	git_annex "get" [sha1annexedfile] @? "get of file failed"+	annexed_present annexedfile+	annexed_present sha1annexedfile+	if usegitattributes+		then do+			writeFile ".gitattributes" "* annex.backend=SHA1"+			git_annex "migrate" [sha1annexedfile]+				@? "migrate sha1annexedfile failed"+			git_annex "migrate" [annexedfile]+				@? "migrate annexedfile failed"+		else do+			git_annex "migrate" [sha1annexedfile, "--backend", "SHA1"]+				@? "migrate sha1annexedfile failed"+			git_annex "migrate" [annexedfile, "--backend", "SHA1"]+				@? "migrate annexedfile failed"+	annexed_present annexedfile+	annexed_present sha1annexedfile+	checkbackend annexedfile backendSHA1+	checkbackend sha1annexedfile backendSHA1++	-- check that reversing a migration works+	writeFile ".gitattributes" "* annex.backend=SHA256"+	git_annex "migrate" [sha1annexedfile]+		@? "migrate sha1annexedfile failed"+	git_annex "migrate" [annexedfile]+		@? "migrate annexedfile failed"+	annexed_present annexedfile+	annexed_present sha1annexedfile+	checkbackend annexedfile backendSHA256+	checkbackend sha1annexedfile backendSHA256++test_unused :: Assertion+-- This test is broken in direct mode+test_unused = intmpclonerepoInDirect $ do+	-- keys have to be looked up before files are removed+	annexedfilekey <- annexeval $ findkey annexedfile+	sha1annexedfilekey <- annexeval $ findkey sha1annexedfile+	git_annex "get" [annexedfile] @? "get of file failed"+	git_annex "get" [sha1annexedfile] @? "get of file failed"+	checkunused [] "after get"+	boolSystem "git" [Params "rm -fq", File annexedfile] @? "git rm failed"+	checkunused [] "after rm"+	boolSystem "git" [Params "commit -q -m foo"] @? "git commit failed"+	checkunused [] "after commit"+	-- unused checks origin/master; once it's gone it is really unused+	boolSystem "git" [Params "remote rm origin"] @? "git remote rm origin failed"+	checkunused [annexedfilekey] "after origin branches are gone"+	boolSystem "git" [Params "rm -fq", File sha1annexedfile] @? "git rm failed"+	boolSystem "git" [Params "commit -q -m foo"] @? "git commit failed"+	checkunused [annexedfilekey, sha1annexedfilekey] "after rm sha1annexedfile"++	-- good opportunity to test dropkey also+	git_annex "dropkey" ["--force", Types.Key.key2file annexedfilekey]+		@? "dropkey failed"+	checkunused [sha1annexedfilekey] ("after dropkey --force " ++ Types.Key.key2file annexedfilekey)++	not <$> git_annex "dropunused" ["1"] @? "dropunused failed to fail without --force"+	git_annex "dropunused" ["--force", "1"] @? "dropunused failed"+	checkunused [] "after dropunused"+	not <$> git_annex "dropunused" ["--force", "10", "501"] @? "dropunused failed to fail on bogus numbers"++	-- unused used to miss symlinks that were not staged and pointed +	-- at annexed content, and think that content was unused+	writeFile "unusedfile" "unusedcontent"+	git_annex "add" ["unusedfile"] @? "add of unusedfile failed"+	unusedfilekey <- annexeval $ findkey "unusedfile"+	renameFile "unusedfile" "unusedunstagedfile"+	boolSystem "git" [Params "rm -qf", File "unusedfile"] @? "git rm failed"+	checkunused [] "with unstaged link"+	removeFile "unusedunstagedfile"+	checkunused [unusedfilekey] "with unstaged link deleted"++	-- unused used to miss symlinks that were deleted or modified+	-- manually, but commited as such.+	writeFile "unusedfile" "unusedcontent"+	git_annex "add" ["unusedfile"] @? "add of unusedfile failed"+	boolSystem "git" [Param "add", File "unusedfile"] @? "git add failed"+	unusedfilekey' <- annexeval $ findkey "unusedfile"+	checkunused [] "with staged deleted link"+	boolSystem "git" [Params "rm -qf", File "unusedfile"] @? "git rm failed"+	checkunused [unusedfilekey'] "with staged link deleted"++	-- unused used to miss symlinks that were deleted or modified+	-- manually, but not staged as such.+	writeFile "unusedfile" "unusedcontent"+	git_annex "add" ["unusedfile"] @? "add of unusedfile failed"+	boolSystem "git" [Param "add", File "unusedfile"] @? "git add failed"+	unusedfilekey'' <- annexeval $ findkey "unusedfile"+	checkunused [] "with unstaged deleted link"+	removeFile "unusedfile"+	checkunused [unusedfilekey''] "with unstaged link deleted"++  where+	checkunused expectedkeys desc = do+		git_annex "unused" [] @? "unused failed"+		unusedmap <- annexeval $ Logs.Unused.readUnusedMap ""+		let unusedkeys = M.elems unusedmap+		assertEqual ("unused keys differ " ++ desc)+			(sort expectedkeys) (sort unusedkeys)+	findkey f = do+		r <- Backend.lookupFile f+		return $ fromJust r++test_describe :: Assertion+test_describe = intmpclonerepo $ do+	git_annex "describe" [".", "this repo"] @? "describe 1 failed"+	git_annex "describe" ["origin", "origin repo"] @? "describe 2 failed"++test_find :: Assertion+test_find = intmpclonerepo $ do+	annexed_notpresent annexedfile+	git_annex_expectoutput "find" [] []+	git_annex "get" [annexedfile] @? "get failed"+	annexed_present annexedfile+	annexed_notpresent sha1annexedfile+	git_annex_expectoutput "find" [] [annexedfile]+	git_annex_expectoutput "find" ["--exclude", annexedfile, "--and", "--exclude", sha1annexedfile] []+	git_annex_expectoutput "find" ["--include", annexedfile] [annexedfile]+	git_annex_expectoutput "find" ["--not", "--in", "origin"] []+	git_annex_expectoutput "find" ["--copies", "1", "--and", "--not", "--copies", "2"] [sha1annexedfile]+	git_annex_expectoutput "find" ["--inbackend", "SHA1"] [sha1annexedfile]+	git_annex_expectoutput "find" ["--inbackend", "WORM"] []++	{- --include=* should match files in subdirectories too,+	 - and --exclude=* should exclude them. -}+	createDirectory "dir"+	writeFile "dir/subfile" "subfile"+	git_annex "add" ["dir"] @? "add of subdir failed"+	git_annex_expectoutput "find" ["--include", "*", "--exclude", annexedfile, "--exclude", sha1annexedfile] ["dir/subfile"]+	git_annex_expectoutput "find" ["--exclude", "*"] []++test_merge :: Assertion+test_merge = intmpclonerepo $+	git_annex "merge" [] @? "merge failed"++test_info :: Assertion+test_info = intmpclonerepo $ do+	json <- git_annex_output "info" ["--json"]+	case Text.JSON.decodeStrict json :: Text.JSON.Result (Text.JSON.JSObject Text.JSON.JSValue) of+		Text.JSON.Ok _ -> return ()+		Text.JSON.Error e -> assertFailure e++test_version :: Assertion+test_version = intmpclonerepo $+	git_annex "version" [] @? "version failed"++test_sync :: Assertion+test_sync = intmpclonerepo $ do+	git_annex "sync" [] @? "sync failed"+	{- Regression test for bug fixed in +	 - 7b0970b340d7faeb745c666146c7f701ec71808f, where in direct mode+	 - sync committed the symlink standin file to the annex. -}+	git_annex_expectoutput "find" ["--in", "."] []++{- Regression test for union merge bug fixed in+ - 0214e0fb175a608a49b812d81b4632c081f63027 -}+test_union_merge_regression :: Assertion+test_union_merge_regression =+	{- We need 3 repos to see this bug. -}+	withtmpclonerepo False $ \r1 ->+		withtmpclonerepo False $ \r2 ->+			withtmpclonerepo False $ \r3 -> do+				forM_ [r1, r2, r3] $ \r -> indir r $ do+					when (r /= r1) $+						boolSystem "git" [Params "remote add r1", File ("../../" ++ r1)] @? "remote add"+					when (r /= r2) $+						boolSystem "git" [Params "remote add r2", File ("../../" ++ r2)] @? "remote add"+					when (r /= r3) $+						boolSystem "git" [Params "remote add r3", File ("../../" ++ r3)] @? "remote add"+					git_annex "get" [annexedfile] @? "get failed"+					boolSystem "git" [Params "remote rm origin"] @? "remote rm"+				forM_ [r3, r2, r1] $ \r -> indir r $+					git_annex "sync" [] @? "sync failed"+				forM_ [r3, r2] $ \r -> indir r $+					git_annex "drop" ["--force", annexedfile] @? "drop failed"+				indir r1 $ do+					git_annex "sync" [] @? "sync failed in r1"+					git_annex_expectoutput "find" ["--in", "r3"] []+					{- This was the bug. The sync+					 - mangled location log data and it+					 - thought the file was still in r2 -}+					git_annex_expectoutput "find" ["--in", "r2"] []++{- Regression test for the automatic conflict resolution bug fixed+ - in f4ba19f2b8a76a1676da7bb5850baa40d9c388e2. -}+test_conflict_resolution_movein_regression :: Assertion+test_conflict_resolution_movein_regression = withtmpclonerepo False $ \r1 -> +	withtmpclonerepo False $ \r2 -> do+		let rname r = if r == r1 then "r1" else "r2"+		forM_ [r1, r2] $ \r -> indir r $ do+			{- Get all files, see check below. -}+			git_annex "get" [] @? "get failed"+			disconnectOrigin+		pair r1 r2+		forM_ [r1, r2] $ \r -> indir r $ do+			{- Set up a conflict. -}+			let newcontent = content annexedfile ++ rname r+			ifM (annexeval Config.isDirect)+				( writeFile annexedfile newcontent+				, do+					git_annex "unlock" [annexedfile] @? "unlock failed"		+					writeFile annexedfile newcontent+				)+		{- Sync twice in r1 so it gets the conflict resolution+		 - update from r2 -}+		forM_ [r1, r2, r1] $ \r -> indir r $+			git_annex "sync" ["--force"] @? "sync failed in " ++ rname r+		{- After the sync, it should be possible to get all+		 - files. This includes both sides of the conflict,+		 - although the filenames are not easily predictable.+		 -+		 - The bug caused, in direct mode, one repo to+		 - be missing the content of the file that had+		 - been put in it. -}+		forM_ [r1, r2] $ \r -> indir r $ do+			git_annex "get" [] @? "unable to get all files after merge conflict resolution in " ++ rname r++{- Simple case of conflict resolution; 2 different versions of annexed+ - file. -}+test_conflict_resolution :: Assertion+test_conflict_resolution = +	withtmpclonerepo False $ \r1 ->+		withtmpclonerepo False $ \r2 -> do+			indir r1 $ do+				disconnectOrigin+				writeFile conflictor "conflictor1"+				git_annex "add" [conflictor] @? "add conflicter failed"+				git_annex "sync" [] @? "sync failed in r1"+			indir r2 $ do+				disconnectOrigin+				writeFile conflictor "conflictor2"+				git_annex "add" [conflictor] @? "add conflicter failed"+				git_annex "sync" [] @? "sync failed in r2"+			pair r1 r2+			forM_ [r1,r2,r1] $ \r -> indir r $+				git_annex "sync" [] @? "sync failed"+			checkmerge "r1" r1+			checkmerge "r2" r2+  where+	conflictor = "conflictor"+	variantprefix = conflictor ++ ".variant"+	checkmerge what d = do+		l <- getDirectoryContents d+		let v = filter (variantprefix `isPrefixOf`) l+		length v == 2+			@? (what ++ " not exactly 2 variant files in: " ++ show l)+		conflictor `notElem` l @? ("conflictor still present after conflict resolution")+		indir d $ do+			git_annex "get" v @? "get failed"+			git_annex_expectoutput "find" v v+++{- Check merge conflict resolution when one side is an annexed+ - file, and the other is a directory. -}+test_mixed_conflict_resolution :: Assertion+test_mixed_conflict_resolution = do+	check True+	check False+  where+	check inr1 = withtmpclonerepo False $ \r1 ->+		withtmpclonerepo False $ \r2 -> do+			indir r1 $ do+				disconnectOrigin+				writeFile conflictor "conflictor"+				git_annex "add" [conflictor] @? "add conflicter failed"+				git_annex "sync" [] @? "sync failed in r1"+			indir r2 $ do+				disconnectOrigin+				createDirectory conflictor+				writeFile subfile "subfile"+				git_annex "add" [conflictor] @? "add conflicter failed"+				git_annex "sync" [] @? "sync failed in r2"+			pair r1 r2+			let l = if inr1 then [r1, r2] else [r2, r1]+			forM_ l $ \r -> indir r $+				git_annex "sync" [] @? "sync failed in mixed conflict"+			checkmerge "r1" r1+			checkmerge "r2" r2+	conflictor = "conflictor"+	subfile = conflictor </> "subfile"+	variantprefix = conflictor ++ ".variant"+	checkmerge what d = do+		doesDirectoryExist (d </> conflictor) @? (d ++ " conflictor directory missing")+		l <- getDirectoryContents d+		let v = filter (variantprefix `isPrefixOf`) l+		not (null v)+			@? (what ++ " conflictor variant file missing in: " ++ show l )+		length v == 1+			@? (what ++ " too many variant files in: " ++ show v)+		indir d $ do+			git_annex "get" (conflictor:v) @? ("get failed in " ++ what)+			git_annex_expectoutput "find" [conflictor] [Git.FilePath.toInternalGitPath subfile]+			git_annex_expectoutput "find" v v++{- Check merge conflict resolution when both repos start with an annexed+ - file; one modifies it, and the other deletes it. -}+test_remove_conflict_resolution :: Assertion+test_remove_conflict_resolution = do+	check True+	check False+  where+	check inr1 = withtmpclonerepo False $ \r1 ->+		withtmpclonerepo False $ \r2 -> do+			indir r1 $ do+				disconnectOrigin+				writeFile conflictor "conflictor"+				git_annex "add" [conflictor] @? "add conflicter failed"+				git_annex "sync" [] @? "sync failed in r1"+			indir r2 $+				disconnectOrigin+			pair r1 r2+			indir r2 $ do+				git_annex "sync" [] @? "sync failed in r2"+				git_annex "get" [conflictor]+					@? "get conflictor failed"+				unlessM (annexeval Config.isDirect) $ do+					git_annex "unlock" [conflictor]+						@? "unlock conflictor failed"+				writeFile conflictor "newconflictor"+			indir r1 $+				nukeFile conflictor+			let l = if inr1 then [r1, r2, r1] else [r2, r1, r2]+			forM_ l $ \r -> indir r $+				git_annex "sync" [] @? "sync failed"+			checkmerge "r1" r1+			checkmerge "r2" r2+	conflictor = "conflictor"+	variantprefix = conflictor ++ ".variant"+	checkmerge what d = do+		l <- getDirectoryContents d+		let v = filter (variantprefix `isPrefixOf`) l+		not (null v)+			@? (what ++ " conflictor variant file missing in: " ++ show l )+		length v == 1+			@? (what ++ " too many variant files in: " ++ show v)++{- Check merge confalict resolution when a file is annexed in one repo,+ - and checked directly into git in the other repo.+ -+ - This test requires indirect mode to set it up, but tests both direct and+ - indirect mode.+ -}+test_nonannexed_file_conflict_resolution :: Assertion+test_nonannexed_file_conflict_resolution = do+	check True False+	check False False+	check True True+	check False True+  where+	check inr1 switchdirect = withtmpclonerepo False $ \r1 ->+		withtmpclonerepo False $ \r2 ->+			whenM (isInDirect r1 <&&> isInDirect r2) $ do+				indir r1 $ do+					disconnectOrigin+					writeFile conflictor "conflictor"+					git_annex "add" [conflictor] @? "add conflicter failed"+					git_annex "sync" [] @? "sync failed in r1"+				indir r2 $ do+					disconnectOrigin+					writeFile conflictor nonannexed_content+					boolSystem "git" [Params "add", File conflictor] @? "git add conflictor failed"+					git_annex "sync" [] @? "sync failed in r2"+				pair r1 r2+				let l = if inr1 then [r1, r2] else [r2, r1]+				forM_ l $ \r -> indir r $ do+					when switchdirect $+						git_annex "direct" [] @? "failed switching to direct mode"+					git_annex "sync" [] @? "sync failed"+				checkmerge ("r1" ++ show switchdirect) r1+				checkmerge ("r2" ++ show switchdirect) r2+	conflictor = "conflictor"+	nonannexed_content = "nonannexed"+	variantprefix = conflictor ++ ".variant"+	checkmerge what d = do+		l <- getDirectoryContents d+		let v = filter (variantprefix `isPrefixOf`) l+		not (null v)+			@? (what ++ " conflictor variant file missing in: " ++ show l )+		length v == 1+			@? (what ++ " too many variant files in: " ++ show v)+		conflictor `elem` l @? (what ++ " conflictor file missing in: " ++ show l)+		s <- catchMaybeIO (readFile (d </> conflictor))+		s == Just nonannexed_content+			@? (what ++ " wrong content for nonannexed file: " ++ show s)+++{- Check merge confalict resolution when a file is annexed in one repo,+ - and is a non-git-annex symlink in the other repo.+ -+ - Test can only run when coreSymlinks is supported, because git needs to+ - be able to check out the non-git-annex symlink.+ -}+test_nonannexed_symlink_conflict_resolution :: Assertion+test_nonannexed_symlink_conflict_resolution = do+	check True False+	check False False+	check True True+	check False True+  where+	check inr1 switchdirect = withtmpclonerepo False $ \r1 ->+		withtmpclonerepo False $ \r2 ->+			whenM (checkRepo (Types.coreSymlinks <$> Annex.getGitConfig) r1+			       <&&> isInDirect r1 <&&> isInDirect r2) $ do+				indir r1 $ do+					disconnectOrigin+					writeFile conflictor "conflictor"+					git_annex "add" [conflictor] @? "add conflicter failed"+					git_annex "sync" [] @? "sync failed in r1"+				indir r2 $ do+					disconnectOrigin+					createSymbolicLink symlinktarget "conflictor"+					boolSystem "git" [Params "add", File conflictor] @? "git add conflictor failed"+					git_annex "sync" [] @? "sync failed in r2"+				pair r1 r2+				let l = if inr1 then [r1, r2] else [r2, r1]+				forM_ l $ \r -> indir r $ do+					when switchdirect $+						git_annex "direct" [] @? "failed switching to direct mode"+					git_annex "sync" [] @? "sync failed"+				checkmerge ("r1" ++ show switchdirect) r1+				checkmerge ("r2" ++ show switchdirect) r2+	conflictor = "conflictor"+	symlinktarget = "dummy-target"+	variantprefix = conflictor ++ ".variant"+	checkmerge what d = do+		l <- getDirectoryContents d+		let v = filter (variantprefix `isPrefixOf`) l+		not (null v)+			@? (what ++ " conflictor variant file missing in: " ++ show l )+		length v == 1+			@? (what ++ " too many variant files in: " ++ show v)+		conflictor `elem` l @? (what ++ " conflictor file missing in: " ++ show l)+		s <- catchMaybeIO (readSymbolicLink (d </> conflictor))+		s == Just symlinktarget+			@? (what ++ " wrong target for nonannexed symlink: " ++ show s)++{- Check merge conflict resolution when there is a local file,+ - that is not staged or committed, that conflicts with what's being added+ - from the remmote.+ -+ - Case 1: Remote adds file named conflictor; local has a file named+ - conflictor.+ -+ - Case 2: Remote adds conflictor/file; local has a file named conflictor.+ -}+test_uncommitted_conflict_resolution :: Assertion+test_uncommitted_conflict_resolution = do+	check conflictor+	check (conflictor </> "file")+  where+	check remoteconflictor = withtmpclonerepo False $ \r1 ->+		withtmpclonerepo False $ \r2 -> do+			indir r1 $ do+				disconnectOrigin+				createDirectoryIfMissing True (parentDir remoteconflictor)+				writeFile remoteconflictor annexedcontent+				git_annex "add" [conflictor] @? "add remoteconflicter failed"+				git_annex "sync" [] @? "sync failed in r1"+			indir r2 $ do+				disconnectOrigin+				writeFile conflictor localcontent+			pair r1 r2+			indir r2 $ ifM (annexeval Config.isDirect)+				( do+					git_annex "sync" [] @? "sync failed"+					let local = conflictor ++ localprefix+					doesFileExist local @? (local ++ " missing after merge")+					s <- readFile local+					s == localcontent @? (local ++ " has wrong content: " ++ s)+					git_annex "get" [conflictor] @? "get failed"+					doesFileExist remoteconflictor @? (remoteconflictor ++ " missing after merge")+					s' <- readFile remoteconflictor+					s' == annexedcontent @? (remoteconflictor ++ " has wrong content: " ++ s)+				-- this case is intentionally not handled+				-- in indirect mode, since the user+				-- can recover on their own easily+				, not <$> git_annex "sync" [] @? "sync failed to fail"+				)+	conflictor = "conflictor"+	localprefix = ".variant-local"+	localcontent = "local"+	annexedcontent = "annexed"++{- On Windows/FAT, repeated conflict resolution sometimes + - lost track of whether a file was a symlink. + -}+test_conflict_resolution_symlink_bit :: Assertion+test_conflict_resolution_symlink_bit =+	withtmpclonerepo False $ \r1 ->+		withtmpclonerepo False $ \r2 ->+			withtmpclonerepo False $ \r3 -> do+				indir r1 $ do+					writeFile conflictor "conflictor"+					git_annex "add" [conflictor] @? "add conflicter failed"+					git_annex "sync" [] @? "sync failed in r1"+					check_is_link conflictor "r1"+				indir r2 $ do+					createDirectory conflictor+					writeFile (conflictor </> "subfile") "subfile"+					git_annex "add" [conflictor] @? "add conflicter failed"+					git_annex "sync" [] @? "sync failed in r2"+					check_is_link (conflictor </> "subfile") "r2"+				indir r3 $ do+					writeFile conflictor "conflictor"+					git_annex "add" [conflictor] @? "add conflicter failed"+					git_annex "sync" [] @? "sync failed in r1"+					check_is_link (conflictor </> "subfile") "r3"+  where+	conflictor = "conflictor"+	check_is_link f what = do+		git_annex_expectoutput "find" ["--include=*", f] [Git.FilePath.toInternalGitPath f]+		l <- annexeval $ Annex.inRepo $ Git.LsTree.lsTreeFiles Git.Ref.headRef [f]+		all (\i -> Git.Types.toBlobType (Git.LsTree.mode i) == Just Git.Types.SymlinkBlob) l+			@? (what ++ " " ++ f ++ " lost symlink bit after merge: " ++ show l)++{- Set up repos as remotes of each other. -}+pair :: FilePath -> FilePath -> Assertion+pair r1 r2 = forM_ [r1, r2] $ \r -> indir r $ do+	when (r /= r1) $+		boolSystem "git" [Params "remote add r1", File ("../../" ++ r1)] @? "remote add"+	when (r /= r2) $+		boolSystem "git" [Params "remote add r2", File ("../../" ++ r2)] @? "remote add"++test_map :: Assertion+test_map = intmpclonerepo $ do+	-- set descriptions, that will be looked for in the map+	git_annex "describe" [".", "this repo"] @? "describe 1 failed"+	git_annex "describe" ["origin", "origin repo"] @? "describe 2 failed"+	-- --fast avoids it running graphviz, not a build dependency+	git_annex "map" ["--fast"] @? "map failed"++test_uninit :: Assertion+test_uninit = intmpclonerepo $ do+	git_annex "get" [] @? "get failed"+	annexed_present annexedfile+	_ <- git_annex "uninit" [] -- exit status not checked; does abnormal exit+	checkregularfile annexedfile+	doesDirectoryExist ".git" @? ".git vanished in uninit"++test_uninit_inbranch :: Assertion+test_uninit_inbranch = intmpclonerepoInDirect $ do+	boolSystem "git" [Params "checkout git-annex"] @? "git checkout git-annex"+	not <$> git_annex "uninit" [] @? "uninit failed to fail when git-annex branch was checked out"++test_upgrade :: Assertion+test_upgrade = intmpclonerepo $+	git_annex "upgrade" [] @? "upgrade from same version failed"++test_whereis :: Assertion+test_whereis = intmpclonerepo $ do+	annexed_notpresent annexedfile+	git_annex "whereis" [annexedfile] @? "whereis on non-present file failed"+	git_annex "untrust" ["origin"] @? "untrust failed"+	not <$> git_annex "whereis" [annexedfile] @? "whereis on non-present file only present in untrusted repo failed to fail"+	git_annex "get" [annexedfile] @? "get failed"+	annexed_present annexedfile+	git_annex "whereis" [annexedfile] @? "whereis on present file failed"++test_hook_remote :: Assertion+test_hook_remote = intmpclonerepo $ do+#ifndef mingw32_HOST_OS+	git_annex "initremote" (words "foo type=hook encryption=none hooktype=foo") @? "initremote failed"+	createDirectory dir+	git_config "annex.foo-store-hook" $+		"cp $ANNEX_FILE " ++ loc+	git_config "annex.foo-retrieve-hook" $+		"cp " ++ loc ++ " $ANNEX_FILE"+	git_config "annex.foo-remove-hook" $+		"rm -f " ++ loc+	git_config "annex.foo-checkpresent-hook" $+		"if [ -e " ++ loc ++ " ]; then echo $ANNEX_KEY; fi"+	git_annex "get" [annexedfile] @? "get of file failed"+	annexed_present annexedfile+	git_annex "copy" [annexedfile, "--to", "foo"] @? "copy --to hook remote failed"+	annexed_present annexedfile+	git_annex "drop" [annexedfile, "--numcopies=2"] @? "drop failed"+	annexed_notpresent annexedfile+	git_annex "move" [annexedfile, "--from", "foo"] @? "move --from hook remote failed"+	annexed_present annexedfile+	not <$> git_annex "drop" [annexedfile, "--numcopies=2"] @? "drop failed to fail"+	annexed_present annexedfile+  where+	dir = "dir"+	loc = dir ++ "/$ANNEX_KEY"+	git_config k v = boolSystem "git" [Param "config", Param k, Param v]+		@? "git config failed"+#else+	-- this test doesn't work in Windows TODO+	noop+#endif++test_directory_remote :: Assertion+test_directory_remote = intmpclonerepo $ do+	createDirectory "dir"+	git_annex "initremote" (words "foo type=directory encryption=none directory=dir") @? "initremote failed"+	git_annex "get" [annexedfile] @? "get of file failed"+	annexed_present annexedfile+	git_annex "copy" [annexedfile, "--to", "foo"] @? "copy --to directory remote failed"+	annexed_present annexedfile+	git_annex "drop" [annexedfile, "--numcopies=2"] @? "drop failed"+	annexed_notpresent annexedfile+	git_annex "move" [annexedfile, "--from", "foo"] @? "move --from directory remote failed"+	annexed_present annexedfile+	not <$> git_annex "drop" [annexedfile, "--numcopies=2"] @? "drop failed to fail"+	annexed_present annexedfile++test_rsync_remote :: Assertion+test_rsync_remote = intmpclonerepo $ do+	createDirectory "dir"+	git_annex "initremote" (words "foo type=rsync encryption=none rsyncurl=dir") @? "initremote failed"+	git_annex "get" [annexedfile] @? "get of file failed"+	annexed_present annexedfile+	git_annex "copy" [annexedfile, "--to", "foo"] @? "copy --to rsync remote failed"+	annexed_present annexedfile+	git_annex "drop" [annexedfile, "--numcopies=2"] @? "drop failed"+	annexed_notpresent annexedfile+	git_annex "move" [annexedfile, "--from", "foo"] @? "move --from rsync remote failed"+	annexed_present annexedfile+	not <$> git_annex "drop" [annexedfile, "--numcopies=2"] @? "drop failed to fail"+	annexed_present annexedfile++test_bup_remote :: Assertion+test_bup_remote = intmpclonerepo $ when Build.SysConfig.bup $ do+	dir <- absPath "dir" -- bup special remote needs an absolute path+	createDirectory dir+	git_annex "initremote" (words $ "foo type=bup encryption=none buprepo="++dir) @? "initremote failed"+	git_annex "get" [annexedfile] @? "get of file failed"+	annexed_present annexedfile+	git_annex "copy" [annexedfile, "--to", "foo"] @? "copy --to bup remote failed"+	annexed_present annexedfile+	git_annex "drop" [annexedfile, "--numcopies=2"] @? "drop failed"+	annexed_notpresent annexedfile+	git_annex "copy" [annexedfile, "--from", "foo"] @? "copy --from bup remote failed"+	annexed_present annexedfile+	git_annex "move" [annexedfile, "--from", "foo"] @? "move --from bup remote failed"+	annexed_present annexedfile++-- gpg is not a build dependency, so only test when it's available+test_crypto :: Assertion+#ifndef mingw32_HOST_OS+test_crypto = do+	testscheme "shared"+	testscheme "hybrid"+	testscheme "pubkey"+  where+	testscheme scheme = intmpclonerepo $ whenM (Utility.Path.inPath Utility.Gpg.gpgcmd) $ do+		Utility.Gpg.testTestHarness @? "test harness self-test failed"+		Utility.Gpg.testHarness $ do+			createDirectory "dir"+			let a cmd = git_annex cmd $+				[ "foo"+				, "type=directory"+				, "encryption=" ++ scheme+				, "directory=dir"+				, "highRandomQuality=false"+				] ++ if scheme `elem` ["hybrid","pubkey"]+					then ["keyid=" ++ Utility.Gpg.testKeyId]+					else []+			a "initremote" @? "initremote failed"+			not <$> a "initremote" @? "initremote failed to fail when run twice in a row"+			a "enableremote" @? "enableremote failed"+			a "enableremote" @? "enableremote failed when run twice in a row"+			git_annex "get" [annexedfile] @? "get of file failed"+			annexed_present annexedfile+			git_annex "copy" [annexedfile, "--to", "foo"] @? "copy --to encrypted remote failed"+			(c,k) <- annexeval $ do+				uuid <- Remote.nameToUUID "foo"+				rs <- Logs.Remote.readRemoteLog+				Just k <- Backend.lookupFile annexedfile+				return (fromJust $ M.lookup uuid rs, k)+			let key = if scheme `elem` ["hybrid","pubkey"]+					then Just $ Utility.Gpg.KeyIds [Utility.Gpg.testKeyId]+					else Nothing+			testEncryptedRemote scheme key c [k] @? "invalid crypto setup"+	+			annexed_present annexedfile+			git_annex "drop" [annexedfile, "--numcopies=2"] @? "drop failed"+			annexed_notpresent annexedfile+			git_annex "move" [annexedfile, "--from", "foo"] @? "move --from encrypted remote failed"+			annexed_present annexedfile+			not <$> git_annex "drop" [annexedfile, "--numcopies=2"] @? "drop failed to fail"+			annexed_present annexedfile+	{- Ensure the configuration complies with the encryption scheme, and+	 - that all keys are encrypted properly for the given directory remote. -}+	testEncryptedRemote scheme ks c keys = case Remote.Helper.Encryptable.extractCipher c of+		Just cip@Crypto.SharedCipher{} | scheme == "shared" && isNothing ks ->+			checkKeys cip Nothing+		Just cip@(Crypto.EncryptedCipher encipher v ks')+			| checkScheme v && keysMatch ks' ->+				checkKeys cip (Just v) <&&> checkCipher encipher ks'+		_ -> return False+	  where+		keysMatch (Utility.Gpg.KeyIds ks') =+			maybe False (\(Utility.Gpg.KeyIds ks2) ->+					sort (nub ks2) == sort (nub ks')) ks+		checkCipher encipher = Utility.Gpg.checkEncryptionStream encipher . Just+		checkScheme Types.Crypto.Hybrid = scheme == "hybrid"+		checkScheme Types.Crypto.PubKey = scheme == "pubkey"+		checkKeys cip mvariant = do+			cipher <- Crypto.decryptCipher cip+			files <- filterM doesFileExist $+				map ("dir" </>) $ concatMap (key2files cipher) keys+			return (not $ null files) <&&> allM (checkFile mvariant) files+		checkFile mvariant filename =+			Utility.Gpg.checkEncryptionFile filename $+				if mvariant == Just Types.Crypto.PubKey then ks else Nothing+		key2files cipher = Locations.keyPaths .+			Crypto.encryptKey Types.Crypto.HmacSha1 cipher+#else+test_crypto = putStrLn "gpg testing not implemented on Windows"+#endif++test_add_subdirs :: Assertion+test_add_subdirs = intmpclonerepo $ do+	createDirectory "dir"+	writeFile ("dir" </> "foo") $ "dir/" ++ content annexedfile+	git_annex "add" ["dir"] @? "add of subdir failed"++	{- Regression test for Windows bug where symlinks were not+	 - calculated correctly for files in subdirs. -}+	git_annex "sync" [] @? "sync failed"+	l <- annexeval $ decodeBS <$> Annex.CatFile.catObject (Git.Types.Ref "HEAD:dir/foo")+	"../.git/annex/" `isPrefixOf` l @? ("symlink from subdir to .git/annex is wrong: " ++ l)++	createDirectory "dir2"+	writeFile ("dir2" </> "foo") $ content annexedfile+	setCurrentDirectory "dir"+	git_annex "add" [".." </> "dir2"] @? "add of ../subdir failed"++-- This is equivilant to running git-annex, but it's all run in-process+-- so test coverage collection works.+git_annex :: String -> [String] -> IO Bool+git_annex command params = do+	-- catch all errors, including normally fatal errors+	r <- try run::IO (Either SomeException ())+	case r of+		Right _ -> return True+		Left _ -> return False+  where+	run = GitAnnex.run (command:"-q":params)++{- Runs git-annex and returns its output. -}+git_annex_output :: String -> [String] -> IO String+git_annex_output command params = do+	got <- Utility.Process.readProcess "git-annex" (command:params)+	-- Since the above is a separate process, code coverage stats are+	-- not gathered for things run in it.+	-- Run same command again, to get code coverage.+	_ <- git_annex command params+	return got++git_annex_expectoutput :: String -> [String] -> [String] -> IO ()+git_annex_expectoutput command params expected = do+	got <- lines <$> git_annex_output command params+	got == expected @? ("unexpected value running " ++ command ++ " " ++ show params ++ " -- got: " ++ show got ++ " expected: " ++ show expected)++-- Runs an action in the current annex. Note that shutdown actions+-- are not run; this should only be used for actions that query state.+annexeval :: Types.Annex a -> IO a+annexeval a = do+	s <- Annex.new =<< Git.CurrentRepo.get+	Annex.eval s $ do+		Annex.setOutput Types.Messages.QuietOutput+		a++innewrepo :: Assertion -> Assertion+innewrepo a = withgitrepo $ \r -> indir r a++inmainrepo :: Assertion -> Assertion+inmainrepo = indir mainrepodir++intmpclonerepo :: Assertion -> Assertion+intmpclonerepo a = withtmpclonerepo False $ \r -> indir r a++intmpclonerepoInDirect :: Assertion -> Assertion+intmpclonerepoInDirect a = intmpclonerepo $+	ifM isdirect+		( putStrLn "not supported in direct mode; skipping"+		, a+		)+  where+	isdirect = annexeval $ do+		Annex.Init.initialize Nothing+		Config.isDirect++checkRepo :: Types.Annex a -> FilePath -> IO a+checkRepo getval d = do+	s <- Annex.new =<< Git.Construct.fromPath d+	Annex.eval s getval++isInDirect :: FilePath -> IO Bool+isInDirect = checkRepo (not <$> Config.isDirect)++intmpbareclonerepo :: Assertion -> Assertion+intmpbareclonerepo a = withtmpclonerepo True $ \r -> indir r a++withtmpclonerepo :: Bool -> (FilePath -> Assertion) -> Assertion+withtmpclonerepo bare a = do+	dir <- tmprepodir+	bracket (clonerepo mainrepodir dir bare) cleanup a++disconnectOrigin :: Assertion+disconnectOrigin = boolSystem "git" [Params "remote rm origin"] @? "remote rm"++withgitrepo :: (FilePath -> Assertion) -> Assertion+withgitrepo = bracket (setuprepo mainrepodir) return++indir :: FilePath -> Assertion -> Assertion+indir dir a = do+	currdir <- getCurrentDirectory+	-- Assertion failures throw non-IO errors; catch+	-- any type of error and change back to currdir before+	-- rethrowing.+	r <- bracket_ (changeToTmpDir dir) (setCurrentDirectory currdir)+		(try a::IO (Either SomeException ()))+	case r of+		Right () -> return ()+		Left e -> throwM e++setuprepo :: FilePath -> IO FilePath+setuprepo dir = do+	cleanup dir+	ensuretmpdir+	boolSystem "git" [Params "init -q", File dir] @? "git init failed"+	configrepo dir+	return dir++-- clones are always done as local clones; we cannot test ssh clones+clonerepo :: FilePath -> FilePath -> Bool -> IO FilePath+clonerepo old new bare = do+	cleanup new+	ensuretmpdir+	let b = if bare then " --bare" else ""+	boolSystem "git" [Params ("clone -q" ++ b), File old, File new] @? "git clone failed"+	configrepo new+	indir new $+		git_annex "init" ["-q", new] @? "git annex init failed"+	unless bare $+		indir new $+			handleforcedirect+	return new++configrepo :: FilePath -> IO ()+configrepo dir = indir dir $ do+	-- ensure git is set up to let commits happen+	boolSystem "git" [Params "config user.name", Param "Test User"] @? "git config failed"+	boolSystem "git" [Params "config user.email test@example.com"] @? "git config failed"+	-- avoid signed commits by test suite+	boolSystem "git" [Params "config commit.gpgsign false"] @? "git config failed"++handleforcedirect :: IO ()+handleforcedirect = whenM ((==) "1" <$> Utility.Env.getEnvDefault "FORCEDIRECT" "") $+	git_annex "direct" ["-q"] @? "git annex direct failed"+	+ensuretmpdir :: IO ()+ensuretmpdir = do+	e <- doesDirectoryExist tmpdir+	unless e $+		createDirectory tmpdir++cleanup :: FilePath -> IO ()+cleanup = cleanup' False++cleanup' :: Bool -> FilePath -> IO ()+cleanup' final dir = whenM (doesDirectoryExist dir) $ do+	Command.Uninit.prepareRemoveAnnexDir dir+	-- This sometimes fails on Windows, due to some files+	-- being still opened by a subprocess.+	catchIO (removeDirectoryRecursive dir) $ \e ->+		when final $ do+			print e+			putStrLn "sleeping 10 seconds and will retry directory cleanup"+			Utility.ThreadScheduler.threadDelaySeconds (Utility.ThreadScheduler.Seconds 10)+			whenM (doesDirectoryExist dir) $+				removeDirectoryRecursive dir+	+checklink :: FilePath -> Assertion+checklink f = do+	s <- getSymbolicLinkStatus f+	-- in direct mode, it may be a symlink, or not, depending+	-- on whether the content is present.+	unlessM (annexeval Config.isDirect) $+		isSymbolicLink s @? f ++ " is not a symlink"++checkregularfile :: FilePath -> Assertion+checkregularfile f = do+	s <- getSymbolicLinkStatus f+	isRegularFile s @? f ++ " is not a normal file"+	return ()++checkcontent :: FilePath -> Assertion+checkcontent f = do+	c <- Utility.Exception.catchDefaultIO "could not read file" $ readFile f+	assertEqual ("checkcontent " ++ f) (content f) c++checkunwritable :: FilePath -> Assertion+checkunwritable f = unlessM (annexeval Config.isDirect) $ do+	-- Look at permissions bits rather than trying to write or+	-- using fileAccess because if run as root, any file can be+	-- modified despite permissions.+	s <- getFileStatus f+	let mode = fileMode s+	when (mode == mode `unionFileModes` ownerWriteMode) $+		assertFailure $ "able to modify annexed file's " ++ f ++ " content"++checkwritable :: FilePath -> Assertion+checkwritable f = do+	r <- tryIO $ writeFile f $ content f+	case r of+		Left _ -> assertFailure $ "unable to modify " ++ f+		Right _ -> return ()++checkdangling :: FilePath -> Assertion+checkdangling f = ifM (annexeval Config.crippledFileSystem)+	( return () -- probably no real symlinks to test+	, do+		r <- tryIO $ readFile f+		case r of+			Left _ -> return () -- expected; dangling link+			Right _ -> assertFailure $ f ++ " was not a dangling link as expected"+	)++checklocationlog :: FilePath -> Bool -> Assertion+checklocationlog f expected = do+	thisuuid <- annexeval Annex.UUID.getUUID+	r <- annexeval $ Backend.lookupFile f+	case r of+		Just k -> do+			uuids <- annexeval $ Remote.keyLocations k+			assertEqual ("bad content in location log for " ++ f ++ " key " ++ Types.Key.key2file k ++ " uuid " ++ show thisuuid)+				expected (thisuuid `elem` uuids)+		_ -> assertFailure $ f ++ " failed to look up key"++checkbackend :: FilePath -> Types.Backend -> Assertion+checkbackend file expected = do+	b <- annexeval $ maybe (return Nothing) (Backend.getBackend file) +		=<< Backend.lookupFile file+	assertEqual ("backend for " ++ file) (Just expected) b++inlocationlog :: FilePath -> Assertion+inlocationlog f = checklocationlog f True++notinlocationlog :: FilePath -> Assertion+notinlocationlog f = checklocationlog f False++runchecks :: [FilePath -> Assertion] -> FilePath -> Assertion+runchecks [] _ = return ()+runchecks (a:as) f = do+	a f+	runchecks as f++annexed_notpresent :: FilePath -> Assertion+annexed_notpresent = runchecks+	[checklink, checkdangling, notinlocationlog]++annexed_present :: FilePath -> Assertion+annexed_present = runchecks+	[checklink, checkcontent, checkunwritable, inlocationlog]++unannexed :: FilePath -> Assertion+unannexed = runchecks [checkregularfile, checkcontent, checkwritable]++withTestEnv :: Bool -> TestTree -> TestTree+withTestEnv forcedirect = withResource prepare release . const+  where+	prepare = do+		setTestEnv forcedirect+		case tryIngredients [consoleTestReporter] mempty initTests of+			Nothing -> error "No tests found!?"+			Just act -> unlessM act $+				error "init tests failed! cannot continue"+		return ()+	release _ = cleanup' True tmpdir++setTestEnv :: Bool -> IO ()+setTestEnv forcedirect = do+	whenM (doesDirectoryExist tmpdir) $+		error $ "The temporary directory " ++ tmpdir ++ " already exists; cannot run test suite."++	currdir <- getCurrentDirectory+	p <- Utility.Env.getEnvDefault "PATH" ""++	mapM_ (\(var, val) -> Utility.Env.setEnv var val True)+		-- Ensure that the just-built git annex is used.+		[ ("PATH", currdir ++ [searchPathSeparator] ++ p)+		, ("TOPDIR", currdir)+		-- Avoid git complaining if it cannot determine the user's+		-- email address, or exploding if it doesn't know the user's+		-- name.+		, ("GIT_AUTHOR_EMAIL", "test@example.com")+		, ("GIT_AUTHOR_NAME", "git-annex test")+		, ("GIT_COMMITTER_EMAIL", "test@example.com")+		, ("GIT_COMMITTER_NAME", "git-annex test")+		-- force gpg into batch mode for the tests+		, ("GPG_BATCH", "1")+		, ("FORCEDIRECT", if forcedirect then "1" else "")+		]++changeToTmpDir :: FilePath -> IO ()+changeToTmpDir t = do+	topdir <- Utility.Env.getEnvDefault "TOPDIR" (error "TOPDIR not set") 	setCurrentDirectory $ topdir ++ "/" ++ t  tmpdir :: String
Utility/Daemon.hs view
@@ -21,8 +21,6 @@ #ifndef mingw32_HOST_OS import System.Posix import Control.Concurrent.Async-#else-import System.Exit #endif  #ifndef mingw32_HOST_OS
Utility/DirWatcher/FSEvents.hs view
@@ -19,9 +19,9 @@ 	unlessM fileLevelEventsSupported $ 		error "Need at least OSX 10.7.0 for file-level FSEvents" 	scan dir-	eventStreamCreate [dir] 1.0 True True True handle+	eventStreamCreate [dir] 1.0 True True True dispatch   where-	handle evt+	dispatch evt 		| ignoredPath ignored (eventPath evt) = noop 		| otherwise = do 			{- More than one flag may be set, if events occurred
Utility/DirWatcher/Win32Notify.hs view
@@ -17,10 +17,10 @@ watchDir dir ignored scanevents hooks = do 	scan dir 	wm <- initWatchManager-	void $ watchDirectory wm dir True [Create, Delete, Modify, Move] handle+	void $ watchDirectory wm dir True [Create, Delete, Modify, Move] dispatch 	return wm   where-	handle evt+	dispatch evt 		| ignoredPath ignored (filePath evt) = noop 		| otherwise = case evt of 			(Deleted _ _)
Utility/InodeCache.hs view
@@ -7,6 +7,7 @@  -}  {-# LANGUAGE CPP #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}  module Utility.InodeCache ( 	InodeCache,@@ -182,7 +183,10 @@ 		SentinalStatus (not unchanged) tsdelta 	  where #ifdef mingw32_HOST_OS-		unchanged = oldinode == newinode && oldsize == newsize+		-- Since mtime can appear to change when the time zone is+		-- changed in windows, we cannot look at the mtime for the+		-- sentinal file.+		unchanged = oldinode == newinode && oldsize == newsize && (newmtime == newmtime) 		tsdelta = TSDelta $ do 			-- Run when generating an InodeCache,  			-- to get the current delta.
Utility/Path.hs view
@@ -21,6 +21,7 @@ import qualified System.FilePath.Posix as Posix #else import System.Posix.Files+import Utility.Exception #endif  import qualified "MissingH" System.Path as MissingH@@ -255,7 +256,9 @@ fileNameLengthLimit _ = return 255 #else fileNameLengthLimit dir = do-	l <- fromIntegral <$> getPathVar dir FileNameLimit+	-- getPathVar can fail due to statfs(2) overflow+	l <- catchDefaultIO 0 $+		fromIntegral <$> getPathVar dir FileNameLimit 	if l <= 0 		then return 255 		else return $ minimum [l, 255]
Utility/Rsync.hs view
@@ -5,6 +5,8 @@  - License: BSD-2-clause  -} +{-# LANGUAGE CPP #-}+ module Utility.Rsync where  import Common@@ -53,12 +55,18 @@  {- On Windows, rsync is from Cygwin, and expects to get Cygwin formatted  - paths to files. (It thinks that C:foo refers to a host named "C").- - Fix up all Files in the Params appropriately. -}+ - Fix up the Params appropriately. -} rsyncParamsFixup :: [CommandParam] -> [CommandParam]+#ifdef mingw32_HOST_OS rsyncParamsFixup = map fixup   where 	fixup (File f) = File (toCygPath f)+	fixup (Param s)+		| rsyncUrlIsPath s = Param (toCygPath s) 	fixup p = p+#else+rsyncParamsFixup = id+#endif  {- Checks if an rsync url involves the remote shell (ssh or rsh).  - Use of such urls with rsync requires additional shell@@ -78,6 +86,9 @@ {- Checks if a rsync url is really just a local path. -} rsyncUrlIsPath :: String -> Bool rsyncUrlIsPath s+#ifdef mingw32_HOST_OS+	| not (null (takeDrive s)) = True+#endif 	| rsyncUrlIsShell s = False 	| otherwise = ':' `notElem` s @@ -87,7 +98,7 @@  - The params must enable rsync's --progress mode for this to work.  -} rsyncProgress :: MeterUpdate -> [CommandParam] -> IO Bool-rsyncProgress meterupdate = commandMeter parseRsyncProgress meterupdate "rsync"+rsyncProgress meterupdate = commandMeter parseRsyncProgress meterupdate "rsync" . rsyncParamsFixup  {- Strategy: Look for chunks prefixed with \r (rsync writes a \r before  - the first progress output, and each thereafter). The first number
Utility/Touch.hsc view
@@ -13,11 +13,25 @@ 	touch ) where +#include <sys/types.h>+#include <sys/stat.h>+#include <fcntl.h>+#include <sys/time.h>++#ifndef _BSD_SOURCE+#define _BSD_SOURCE+#endif++#if (defined UTIME_OMIT && defined UTIME_NOW && defined AT_FDCWD && defined AT_SYMLINK_NOFOLLOW)+#define use_utimensat 1+ import Utility.FileSystemEncoding +import Control.Monad (when) import Foreign+#endif+ import Foreign.C-import Control.Monad (when)  newtype TimeSpec = TimeSpec CTime @@ -28,16 +42,7 @@ touch :: FilePath -> TimeSpec -> Bool -> IO () touch file mtime = touchBoth file mtime mtime -#include <sys/types.h>-#include <sys/stat.h>-#include <fcntl.h>-#include <sys/time.h>--#ifndef _BSD_SOURCE-#define _BSD_SOURCE-#endif--#if (defined UTIME_OMIT && defined UTIME_NOW && defined AT_FDCWD && defined AT_SYMLINK_NOFOLLOW)+#ifdef use_utimensat  at_fdcwd :: CInt at_fdcwd = #const AT_FDCWD
Utility/UserInfo.hs view
@@ -13,8 +13,10 @@ 	myUserGecos, ) where -import Control.Applicative import System.PosixCompat+#ifndef mingw32_HOST_OS+import Control.Applicative+#endif  import Utility.Env 
Utility/libdiskfree.c view
@@ -8,12 +8,10 @@ /* Include appropriate headers for the OS, and define what will be used to  * check the free space. */ #if defined(__APPLE__)+# define _DARWIN_FEATURE_64_BIT_INODE 1 # include <sys/param.h> # include <sys/mount.h>-/* In newer OSX versions, statfs64 is deprecated, in favor of statfs,- * which is 64 bit only with a build option -- but statfs64 still works,- * and this keeps older OSX also supported. */-# define STATCALL statfs64+# define STATCALL statfs # define STATSTRUCT statfs64 #else #if defined (__FreeBSD__)
Utility/libmounts.c view
@@ -63,7 +63,7 @@ 	_mntent.mnt_dir = mntbuf->f_mntonname; 	_mntent.mnt_type = mntbuf->f_fstypename; -	_mntent.mnt_opts = '\0';+	_mntent.mnt_opts = NULL; 	_mntent.mnt_freq = 0; 	_mntent.mnt_passno = 0; 
debian/changelog view
@@ -1,3 +1,20 @@+git-annex (5.20141231) unstable; urgency=medium++  * vicfg: Avoid crashing on badly encoded config data.+  * Work around statfs() overflow on some XFS systems.+  * sync: Now supports remote groups, the same way git remote update does.+  * setpresentkey: A new plumbing-level command.+  * Run shutdown cleanup actions even if there were failures processing+    the command. Among other fixes, this means that addurl will stage+    added files even if adding one of the urls fails.+  * bittorrent: Fix locking problem when using addurl file://+  * Windows: Fix local rsync filepath munging (fixes 26 test suite failures).+  * Windows: Got the rsync special remote working.+  * Windows: Fix handling of views of filenames containing '%'+  * OSX: Switched away from deprecated statfs64 interface.++ -- Joey Hess <id@joeyh.name>  Wed, 31 Dec 2014 15:15:46 -0400+ git-annex (5.20141219) unstable; urgency=medium    * Webapp: When adding a new box.com remote, use the new style chunking.
debian/control view
@@ -78,7 +78,7 @@ 	git-remote-gcrypt (>= 0.20130908-6), 	llvm-3.4 [armel armhf], Maintainer: Gergely Nagy <algernon@madhouse-project.org>-Standards-Version: 3.9.5+Standards-Version: 3.9.6 Vcs-Git: git://git.kitenet.net/git-annex Homepage: http://git-annex.branchable.com/ XS-Testsuite: autopkgtest
doc/design/caching_database.mdwn view
@@ -32,6 +32,27 @@ 4. Store incremental fsck info in db. 5. Replace .map files with 3. for direct mode. +## sqlite or not?++sqllite seems like the most likely thing to work. But it does involve ugh,+SQL. And even if that's hidden by a layer like persistent, it's still going+to involve some technical debt (eg, database migrations).++It would be great if there were some haskell thing like acid-state+that I could use instead. But, acid-sate needs to load the whole+DB into memory. In the comments of+[[bugs/incremental_fsck_should_not_use_sticky_bit]] I examined several+other haskell database-like things, and found them all wanting, except for+possibly TCache.++TODO: This seems promising; investigate it:+<https://awelonblue.wordpress.com/2014/12/19/vcache-an-acid-state-killer/>  +It uses LMDB, which is a C library, and its PVar is a variable named by a+bytestring, so it's essentially a key/value store where the values can be+arbitrary Haskell data types. Since git-annex already has Keys, and most+of the need for the database is to look up some cached value for a Key,+this seems like a pretty good fit!+ ## case study: persistent with sqllite  Here's a non-normalized database schema in persistent's syntax.
+ doc/devblog/day_241-242__end_of_year_cleanup.mdwn view
@@ -0,0 +1,22 @@+Took a holiday week off from git-annex development, and started a new side+project building [shell-monad](http://joeyh.name/code/shell-monad/), which+might eventually be used in some parts of git-annex that generate shell+scripts.++Message backlog is 165 and I have not dove back into it, but I have started+spinning back up the development engines in preparation for new year+takeoff. ++Yesterday, added some minor new features -- `git annex sync` now+supports git remote groups, and I added a new plumbing command+`setpresentkey` for those times when you really need to mess with+git-annex's internal bookkeeping. Also cleaned up a lot of build warning+messages on OSX and Windows.++Today, first some improvements to make `addurl` more robust.+Then the rest of the day was spent on Windows. Fixed (again)+the Windows port's problem with rsync hating DOS style filenames. Got+the rsync special remote fully working on Windows for the first time.++Best of all, got the Windows autobuilder to run the test+suite successfully, and fixed a couple test suite failures on Windows.
+ doc/forum/Copying_and_dropping_right_after.mdwn view
@@ -0,0 +1,18 @@+Hello,++I have three repos horus (client, this one), astarte (transfer, remote) and external_2tb (client, connected usb). On a git annex sync --content it first copies the content to external and astarte and then dropping the content from astarte right after. ++    copy FLAC/Corvus Corax - Cantus Buranus/Corvus Corax - 08 - Sol solo.flac copy FLAC/Corvus Corax - Cantus Buranus/Corvus Corax - 08 - Sol solo.flac (to external_2TB...) +    Corvus Corax - 08 - Sol solo.flac+         33,541,833 100%  257.72MB/s    0:00:00 (xfr#1, to-chk=0/1)+    ok+    copy FLAC/Corvus Corax - Cantus Buranus/Corvus Corax - 08 - Sol solo.flac copy FLAC/Corvus Corax - Cantus Buranus/Corvus Corax - 08 - Sol solo.flac (checking astarte...) (to astarte...) +    Corvus Corax - 08 - Sol solo.flac+        33,541,833 100%  437.82kB/s    0:01:14 (xfr#1, to-chk=0/1)+    ok+    drop astarte FLAC/Corvus Corax - Cantus Buranus/Corvus Corax - 08 - Sol solo.flac ok++Why copying it anyway?++Regards,+Florian
+ doc/forum/Disk_usage_during___96__import__96__.mdwn view
@@ -0,0 +1,5 @@+Does `git-annex import` move data to the working directory before moving it to `.git/annex/objects`?++The reason I'm asking is that I use the split SSD/HDD setup with some annexes, i.e., everything resides on an SSD except for the git-annex objects directory.++If git-annex wrote imported data to the working directoy (on the SSD) first and moved it to the objects directory (on the HDD) later, it would cause lots of unnecessary writes to the SSD.
doc/git-annex.mdwn view
@@ -31,7 +31,7 @@ # EXAMPLES  	# git annex get video/hackity_hack_and_kaxxt.mov-	get video/_why_hackity_hack_and_kaxxt.mov (not available)+	get video/hackity_hack_and_kaxxt.mov (not available) 	  I was unable to access these remotes: server 	  Try making some of these repositories available: 	  	5863d8c0-d9a9-11df-adb2-af51e6559a49  -- my home file server@@ -143,8 +143,9 @@ * `sync [remote ...]`    Use this command when you want to synchronize the local repository with-  one or more of its remotes. You can specify the remotes to sync with by-  name; the default is to sync with all remotes.+  one or more of its remotes. You can specify the remotes (or remote+  groups) to sync with by name; the default if none are specified is to+  sync with all remotes.   Or specify `--fast` to sync with the remotes with the   lowest annex-cost value. @@ -946,6 +947,11 @@   It is fed instructions about the keys to transfer using an internal   stdio protocol, which is intentionally not documented (as it may change   at any time).++* `setpresentkey key uuid [1|0]`++  This plumbing-level command changes git-annex's records about whether+  the specified key is present in a remote with the specified uuid.  * `rekey [file key ...]` 
doc/install/Android.mdwn view
@@ -30,8 +30,5 @@    This builds a chroot with a `builder` user.    The rest of the build will run in this chroot as that user. 2. In the chroot, run `standalone/android/install-haskell-packages`-   Note that this will break from time to time as new versions of packages-   are released, and the patches it applies have to be updated when-   this happens. 3. Finally, once the chroot is set up, you can build an Android binary    with `make android`, and `make androidapp` will build the complete APK.
+ doc/install/Debian/comment_11_b44ed53973ac26eedd3838df28f74a7e._comment view
@@ -0,0 +1,7 @@+[[!comment format=mdwn+ username="chris"+ subject="Easy"+ date="2014-12-23T08:18:31Z"+ content="""+Easy to install.+"""]]
doc/install/Windows.mdwn view
@@ -9,12 +9,10 @@ problems and parts that don't work. See [[todo/windows_support]] for current status. -The autobuilder is not currently able to run the test suite, so-testing git-annex on Windows is up to you! To check that the build of-git-annex works in your Windows system, you are encouraged to run the test-suite before using git-annex on real data. After installation, run `git-annex test`. There will be a lot of output; the important thing is that it-should end with "All tests passed".+To verify that the build of git-annex works in your Windows system, you are+encouraged to run the test suite before using git-annex on real data. After+installation, run `git annex test`. There will be a lot of output; the+important thing is that it should end with "All tests passed".  ## autobuilds 
− doc/news/version_5.20141024.mdwn
@@ -1,21 +0,0 @@-git-annex 5.20141024 released with [[!toggle text="these changes"]]-[[!toggleable text="""-   * vicfg: Deleting configurations now resets to the default, where-     before it has no effect.-   * Remove hurd stuff from cabal file, since hackage currently rejects-     it, and the test suite fails on hurd.-   * initremote: Don't allow creating a special remote that has the same-     name as an existing git remote.-   * Windows: Use haskell setenv library to clean up several ugly workarounds-     for inability to manipulate the environment on windows. This includes-     making git-annex not re-exec itself on start on windows, and making the-     test suite on Windows run tests without forking.-   * glacier: Fix pipe setup when calling glacier-cli to retrieve an object.-   * info: When run on a single annexed file, displays some info about the-     file, including its key and size.-   * info: When passed the name or uuid of a remote, displays info about that-     remote. Remotes that support encryption, chunking, or embedded-     creds will include that in their info.-   * enableremote: When the remote has creds, update the local creds cache-     file. Before, the old version of the creds could be left there, and-     would continue to be used."""]]
+ doc/news/version_5.20141231.mdwn view
@@ -0,0 +1,14 @@+git-annex 5.20141231 released with [[!toggle text="these changes"]]+[[!toggleable text="""+   * vicfg: Avoid crashing on badly encoded config data.+   * Work around statfs() overflow on some XFS systems.+   * sync: Now supports remote groups, the same way git remote update does.+   * setpresentkey: A new plumbing-level command.+   * Run shutdown cleanup actions even if there were failures processing+     the command. Among other fixes, this means that addurl will stage+     added files even if adding one of the urls fails.+   * bittorrent: Fix locking problem when using addurl file://+   * Windows: Fix local rsync filepath munging (fixes 26 test suite failures).+   * Windows: Got the rsync special remote working.+   * Windows: Fix handling of views of filenames containing '%'+   * OSX: Switched away from deprecated statfs64 interface."""]]
doc/tips/publishing_your_files_to_the_public.mdwn view
@@ -46,7 +46,7 @@ The same applies to all the filters you can do with git-annex.  For example, let's share links to all the files whose _author_'s name starts with "Mario" and are, in fact, stored at your public-s3 remote.-However, instead of just a list of links we will output a markdown-formatted list of the filenames linked to their S3 files:+However, instead of just a list of links we will output a markdown-formatted list of the filenames linked to their S3 urls:      for filename in (git annex find --metadata "author=Mario*" --and --in public-s3)        echo "* ["$filename"](https://public-annex.s3.amazonaws.com/"(git annex lookupkey $filename)")"
+ doc/tips/transmission_integration.sh view
@@ -0,0 +1,48 @@+#! /bin/sh++# This simple script will make sure files downloaded by the+# [Transmission BitTorrent client](https://www.transmissionbt.com/) will+# be added into git-annex.+#+# To enable it, install it to /usr/local/bin and add the following to+# your settings.json:+#    "script-torrent-done-enabled": true,+#    "script-torrent-done-filename": "/usr/local/bin/transmission-git-annex-add",+# -- [[anarcat]]++set -e++# environment from transmission:+# TR_APP_VERSION+# TR_TIME_LOCALTIME+# TR_TORRENT_DIR+# TR_TORRENT_HASH+# TR_TORRENT_ID+# TR_TORRENT_NAME+# source: https://trac.transmissionbt.com/wiki/Scripts++if [ -z "$TR_APP_VERSION" ]; then+  echo "missing expected $TR_APP_VERSION from Transmission"+  exit 1+fi++message="transmission adding torrent '$TR_TORRENT_NAME'++TR_APP_VERSION: $TR_APP_VERSION+TR_TIME_LOCALTIME: $TR_TIME_LOCALTIME+TR_TORRENT_DIR: $TR_TORRENT_DIR+TR_TORRENT_HASH: $TR_TORRENT_HASH+TR_TORRENT_ID: $TR_TORRENT_ID+TR_TORRENT_NAME: $TR_TORRENT_NAME+"++# heredocs preserve newlines+cat <<EOF+$message+EOF+# add the actual torrent and commit whatever's left to commit+cd "$TR_TORRENT_DIR"+git annex add "$TR_TORRENT_NAME" && \+git commit -F- <<EOF+$message+EOF
+ doc/todo/parallel_get/comment_1_5b7517214148731f81be6e61233ce13c._comment view
@@ -0,0 +1,9 @@+[[!comment format=mdwn+ username="https://www.google.com/accounts/o8/id?id=AItOawnx8kHW66N3BqmkVpgtXDlYMvr8TJ5VvfY"+ nickname="Yaroslav"+ subject="spinning wheel"+ date="2014-12-22T20:33:44Z"+ content="""+Just tried torrents backend -- it works -- THANKS!!!+But amount of output dumped upon user is somewhat outstanding (I can't even scroll terminal back far enough for 1 file fetch).  May be for such backends, where no easy/reasonable way to estimate progress it would be possible at least to have some spinning wheel animation which would react (spin) to any output received from the corresponding downloader/backend?  (unless in debug mode in which normal output probably should be shown as well)+"""]]
+ doc/todo/parallel_get/comment_2_c8548608023ef3d95035fe97164c8cd7._comment view
@@ -0,0 +1,12 @@+[[!comment format=mdwn+ username="https://www.google.com/accounts/o8/id?id=AItOawnx8kHW66N3BqmkVpgtXDlYMvr8TJ5VvfY"+ nickname="Yaroslav"+ subject="even less verbose"+ date="2014-12-23T16:50:36Z"+ content="""+While working on this one, might be worth even reserving even a quieter mode of operation which would e.g. just report a # of already processed files. e.g.++\"0% done: fetched 100 out of 1,234,567 files\"++;-) ?+"""]]
+ doc/todo/parallel_get/comment_3_36bfc494c34a6701c4780d13d669ff71._comment view
@@ -0,0 +1,8 @@+[[!comment format=mdwn+ username="https://www.google.com/accounts/o8/id?id=AItOawnx8kHW66N3BqmkVpgtXDlYMvr8TJ5VvfY"+ nickname="Yaroslav"+ subject="comment 3"+ date="2014-12-23T16:52:43Z"+ content="""+actually a similar or exactly the same summary line might be worth appearing in the \"regular\" mode as well to give user better estimate of overall progress.  If total size is known, it would also be nice if overall % in size (not just a # of items) was reported+"""]]
+ doc/todo/remote_groups_support_for_sync.mdwn view
@@ -0,0 +1,5 @@+`git remote update $group` looks at the $group.away git config and fetches+from the listed remotes. It would be useful if `git annex sync $group` did the same.+--[[Joey]]++[[done]]
+ doc/todo/replace_dataenc_with_sandi.mdwn view
@@ -0,0 +1,4 @@+<https://github.com/joeyh/git-annex/pull/15>++sandi is available in jessie, but not wheezy, so this is pending+EOL of wheezy support. --[[Joey]]
doc/todo/windows_support.mdwn view
@@ -57,9 +57,6 @@  ## minor problems -* rsync special remotes with a rsyncurl of a local directory are known-  buggy. (git-annex tells rsync C:foo and it thinks it means a remote host-  named C...) * webapp lets user choose to encrypt repo, and generate gpg key,   before checking that gcrypt is not installed * Ssh connection caching does not work on Windows, so `git annex get`
+ doc/users/chris.mdwn view
@@ -0,0 +1,1 @@+Visit my page <a href="http://www.cybr.eu">Cybr</a> or my private page <a href="http://www.ca84.com">ca84</a> if you like to contact me.
git-annex.1 view
@@ -28,7 +28,7 @@ .PP .SH EXAMPLES  # git annex get video/hackity_hack_and_kaxxt.mov- get video/_why_hackity_hack_and_kaxxt.mov (not available)+ get video/hackity_hack_and_kaxxt.mov (not available)    I was unable to access these remotes: server    Try making some of these repositories available:    	5863d8c0\-d9a9\-11df\-adb2\-af51e6559a49  \-\- my home file server@@ -129,8 +129,9 @@ .IP .IP "\fBsync [remote ...]\fP" Use this command when you want to synchronize the local repository with-one or more of its remotes. You can specify the remotes to sync with by-name; the default is to sync with all remotes.+one or more of its remotes. You can specify the remotes (or remote+groups) to sync with by name; the default if none are specified is to+sync with all remotes. Or specify \fB\-\-fast\fP to sync with the remotes with the lowest annex\-cost value. .IP@@ -873,6 +874,10 @@ It is fed instructions about the keys to transfer using an internal stdio protocol, which is intentionally not documented (as it may change at any time).+.IP+.IP "\fBsetpresentkey key uuid [1|0]\fP"+This plumbing\-level command changes git\-annex's records about whether+the specified key is present in a remote with the specified uuid. .IP .IP "\fBrekey [file key ...]\fP" This plumbing\-level command is similar to migrate, but you specify
git-annex.cabal view
@@ -1,5 +1,5 @@ Name: git-annex-Version: 5.20141219+Version: 5.20141231 Cabal-Version: >= 1.8 License: GPL-3 Maintainer: Joey Hess <joey@kitenet.net>
standalone/windows/build.sh view
@@ -74,7 +74,14 @@  # Test git-annex # (doesn't currently work well on autobuilder, reason unknown)-rm -rf .t PATH="$(pwd)/dist/build/git-annex/:$PATH" export PATH-withcyg dist/build/git-annex/git-annex.exe test || true+mkdir -p c:/WINDOWS/Temp/git-annex-test/+cd c:/WINDOWS/Temp/git-annex-test/+if withcyg git-annex.exe test; then+	rm -rf .t+else+	rm -rf .t+	echo "Test suite failure; failing build!"+	false+fi