 a1432bce2f
			
		
	
	
	a1432bce2f
	
	
	
		
			
			This allows eg, putting .git/annex/tmp on a ram disk, if the disk IO of temp object files is too annoying (and if you don't want to keep partially transferred objects across reboots). .git/annex/misctmp must be on the same filesystem as the git work tree, since files are moved to there in a way that will not work cross-device, as well as symlinked into there. I first wanted to put the tmp objects in .git/annex/objects/tmp, but that would pose transition problems on upgrade when partially transferred objects existed. git annex info does not currently show the size of .git/annex/misctemp, since it should stay small. It would also be ok to make something clean it out, periodically.
		
			
				
	
	
		
			45 lines
		
	
	
	
		
			1.4 KiB
			
		
	
	
	
		
			Haskell
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
	
		
			1.4 KiB
			
		
	
	
	
		
			Haskell
		
	
	
	
	
	
| {- git-annex command
 | |
|  -
 | |
|  - Copyright 2010,2012 Joey Hess <joey@kitenet.net>
 | |
|  -
 | |
|  - Licensed under the GNU GPL version 3 or higher.
 | |
|  -}
 | |
| 
 | |
| module Command.DropUnused where
 | |
| 
 | |
| import Common.Annex
 | |
| import Command
 | |
| import qualified Annex
 | |
| import qualified Command.Drop
 | |
| import qualified Remote
 | |
| import qualified Git
 | |
| import Command.Unused (withUnusedMaps, UnusedMaps(..), startUnused)
 | |
| import Config.NumCopies
 | |
| 
 | |
| def :: [Command]
 | |
| def = [withOptions [Command.Drop.dropFromOption] $
 | |
| 	command "dropunused" (paramRepeating paramNumRange)
 | |
| 		seek SectionMaintenance "drop unused file content"]
 | |
| 
 | |
| seek :: CommandSeek
 | |
| seek ps = do
 | |
| 	numcopies <- getNumCopies
 | |
| 	withUnusedMaps (start numcopies) ps
 | |
| 
 | |
| start :: NumCopies -> UnusedMaps -> Int -> CommandStart
 | |
| start numcopies = startUnused "dropunused" (perform numcopies) (performOther gitAnnexBadLocation) (performOther gitAnnexTmpObjectLocation)
 | |
| 
 | |
| perform :: NumCopies -> Key -> CommandPerform
 | |
| perform numcopies key = maybe droplocal dropremote =<< Remote.byNameWithUUID =<< from
 | |
|   where
 | |
| 	dropremote r = do
 | |
| 		showAction $ "from " ++ Remote.name r
 | |
| 		Command.Drop.performRemote key numcopies r
 | |
| 	droplocal = Command.Drop.performLocal key numcopies Nothing
 | |
| 	from = Annex.getField $ optionName Command.Drop.dropFromOption
 | |
| 
 | |
| performOther :: (Key -> Git.Repo -> FilePath) -> Key -> CommandPerform
 | |
| performOther filespec key = do
 | |
| 	f <- fromRepo $ filespec key
 | |
| 	liftIO $ nukeFile f
 | |
| 	next $ return True
 |