fix recompute --reproducible run on a VURL key

This avoids "Cannot generate a key for backend VURL", and makes it use
the usual hashing backend.
This commit is contained in:
Joey Hess 2025-03-12 11:48:29 -04:00
parent 0f998f0698
commit 0712ae020c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 7 additions and 2 deletions

View file

@ -52,6 +52,7 @@ optParser desc = AddComputedOptions
<*> parseReproducible <*> parseReproducible
newtype Reproducible = Reproducible { isReproducible :: Bool } newtype Reproducible = Reproducible { isReproducible :: Bool }
deriving (Show, Eq)
parseReproducible :: Parser (Maybe Reproducible) parseReproducible :: Parser (Maybe Reproducible)
parseReproducible = r <|> unr parseReproducible = r <|> unr

View file

@ -21,7 +21,7 @@ import Annex.GitShaKey
import Git.FilePath import Git.FilePath
import Logs.Location import Logs.Location
import Command.AddComputed (Reproducible(..), parseReproducible, getInputContent, getInputContent', addComputed) import Command.AddComputed (Reproducible(..), parseReproducible, getInputContent, getInputContent', addComputed)
import Backend (maybeLookupBackendVariety, unknownBackendVarietyMessage) import Backend (maybeLookupBackendVariety, unknownBackendVarietyMessage, chooseBackend)
import Types.Key import Types.Key
import qualified Data.Map as M import qualified Data.Map as M
@ -200,7 +200,11 @@ perform o r file origkey origstate = do
logStatus NoLiveUpdate origkey InfoMissing logStatus NoLiveUpdate origkey InfoMissing
return True return True
choosebackend _outputfile choosebackend outputfile
-- When converting a VURL to reproducible, can't use
-- the VURL backend.
| recomputingvurl && reproducible o == Just (Reproducible True) =
chooseBackend outputfile
-- Use the same backend as was used to compute it before, -- Use the same backend as was used to compute it before,
-- so if the computed file is the same, there will be -- so if the computed file is the same, there will be
-- no change. -- no change.