annex.addunlocked support for git-annex compute

And for git-annex recompute, add the file unlocked when the original is
unlocked.
This commit is contained in:
Joey Hess 2025-03-17 14:26:09 -04:00
parent de6e9f5beb
commit 23538ea17b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 58 additions and 42 deletions

View file

@ -23,8 +23,10 @@ import Logs.Location
import Command.AddComputed (Reproducible(..), parseReproducible, getInputContent, getInputContent', addComputed)
import Backend (maybeLookupBackendVariety, unknownBackendVarietyMessage, chooseBackend)
import Types.Key
import qualified Utility.RawFilePath as R
import qualified Data.Map as M
import System.PosixCompat.Files (isSymbolicLink)
cmd :: Command
cmd = notBareRepo $
@ -126,19 +128,22 @@ perform :: RecomputeOptions -> Remote -> OsPath -> Key -> Remote.Compute.Compute
perform o r file origkey origstate = do
program <- Remote.Compute.getComputeProgram r
reproducibleconfig <- getreproducibleconfig
originallocked <- liftIO $ isSymbolicLink
<$> R.getSymbolicLinkStatus (fromOsPath file)
showOutput
Remote.Compute.runComputeProgram program origstate
(Remote.Compute.ImmutableState False)
(getinputcontent program)
Nothing
(go program reproducibleconfig)
(go program reproducibleconfig originallocked)
next cleanup
where
go program reproducibleconfig result tmpdir ts = do
go program reproducibleconfig originallocked result tmpdir ts = do
checkbehaviorchange program
(Remote.Compute.computeState result)
addComputed Nothing r reproducibleconfig
choosebackend destfile False result tmpdir ts
choosebackend destfile False (Left originallocked)
result tmpdir ts
checkbehaviorchange program state = do
let check s w a b = forM_ (M.keys (w a)) $ \f ->