avoid confusing git with a modified ctime in clean filter

Linking the file to the tmp dir was not necessary in the clean
filter, and it caused the ctime to change, which caused git to think
the file was changed. This caused git status to get slow as it kept
re-cleaning unchanged files.
This commit is contained in:
Joey Hess 2016-01-07 17:39:59 -04:00
parent b1a1b40a15
commit 4b819bee2b
Failed to extract signature
4 changed files with 47 additions and 27 deletions

View file

@ -115,7 +115,11 @@ start file = ifAnnexed file addpresent add
perform :: FilePath -> CommandPerform
perform file = do
lockingfile <- not <$> isDirect
lockDown lockingfile file >>= ingest >>= go
let cfg = LockDownConfig
{ lockingFile = lockingfile
, hardlinkFileTmp = True
}
lockDown cfg file >>= ingest >>= go
where
go (Just key, cache) = next $ cleanup file key cache True
go (Nothing, _) = stop

View file

@ -72,7 +72,7 @@ clean file = do
then liftIO $ B.hPut stdout b
else ifM (shouldAnnex file)
( liftIO . emitPointer
=<< go =<< ingest =<< lockDown False file
=<< go =<< ingest =<< lockDown cfg file
, liftIO $ B.hPut stdout b
)
stop
@ -81,6 +81,10 @@ clean file = do
logStatus k InfoPresent
return k
go _ = error "could not add file to the annex"
cfg = LockDownConfig
{ lockingFile = False
, hardlinkFileTmp = False
}
shouldAnnex :: FilePath -> Annex Bool
shouldAnnex file = do