avoid error on missing compute state in checkKey
authorJoey Hess <joeyh@joeyh.name>
Tue, 11 Mar 2025 15:49:47 +0000 (11:49 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 11 Mar 2025 15:49:47 +0000 (11:49 -0400)
This improves eg `git-annex move --to` a compute remote that does not
contain the key. Rather than erroring with "Missing compute state" when
it checks if the key is in the remote, it proceeds to trying to store to
it, which has a nice error message.

Remote/Compute.hs

index 3adec4bc5b65e19cda07128b3cbaaafc7f80df37..7ed6040cebaddb4e27d1d007f9de8177b38203c1 100644 (file)
@@ -756,9 +756,7 @@ avoidCycles outputkeys inputkey = filterM go
 checkKey :: RemoteStateHandle -> Key -> Annex Bool
 checkKey rs k = do
        states <- getComputeStatesUnsorted rs k
-       if null states
-               then giveup "Missing compute state"
-               else return True
+       return (not (null states))
 
 -- Unsetting the compute state will prevent computing the key.
 dropKey :: RemoteStateHandle -> Maybe SafeDropProof -> Key -> Annex ()