better indicate when special remotes do not support renameExport
Avoid a warning message when renameExport is not supported, and just fallback to deleting with a subsequent re-upload. Especially needed for importtree remotes, where renameExport needs to be disabled. This changes the external special remote protocol, but in a backwards-compatible way. A reply of UNSUPPORTED-REQUEST to an older version of git-annex will cause it to make renameExport return False.
This commit is contained in:
parent
c755788256
commit
2912429640
11 changed files with 62 additions and 53 deletions
|
@ -379,15 +379,16 @@ startMoveFromTempName r db ek f = do
|
|||
f' = getTopFilePath f
|
||||
|
||||
performRename :: Remote -> ExportHandle -> ExportKey -> ExportLocation -> ExportLocation -> CommandPerform
|
||||
performRename r db ek src dest = do
|
||||
ifM (renameExport (exportActions r) (asKey ek) src dest)
|
||||
( next $ cleanupRename r db ek src dest
|
||||
-- In case the special remote does not support renaming,
|
||||
-- unexport the src instead.
|
||||
, do
|
||||
performRename r db ek src dest =
|
||||
renameExport (exportActions r) (asKey ek) src dest >>= \case
|
||||
Just True -> next $ cleanupRename r db ek src dest
|
||||
Just False -> do
|
||||
warning "rename failed; deleting instead"
|
||||
performUnexport r db [ek] src
|
||||
)
|
||||
fallbackdelete
|
||||
-- Remote does not support renaming, so don't warn about it.
|
||||
Nothing -> fallbackdelete
|
||||
where
|
||||
fallbackdelete = performUnexport r db [ek] src
|
||||
|
||||
cleanupRename :: Remote -> ExportHandle -> ExportKey -> ExportLocation -> ExportLocation -> CommandCleanup
|
||||
cleanupRename r db ek src dest = do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue