diff --git a/CHANGELOG b/CHANGELOG index 430825bf15..59ff625184 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,8 @@ git-annex (7.20190508) UNRELEASED; urgency=medium the description to "", now it will error out. * Android: Improve installation process when the user's login shell is not bash. + * When a remote is configured to be readonly, don't allow changing + what's exported to it. -- Joey Hess Mon, 06 May 2019 13:52:02 -0400 diff --git a/Remote/Helper/ReadOnly.hs b/Remote/Helper/ReadOnly.hs index d982786165..add92aa1e1 100644 --- a/Remote/Helper/ReadOnly.hs +++ b/Remote/Helper/ReadOnly.hs @@ -1,6 +1,6 @@ {- Adds readonly support to remotes. - - - Copyright 2013, 2015 Joey Hess + - Copyright 2013-2019 Joey Hess - - Licensed under the GNU AGPL version 3 or higher. -} @@ -28,6 +28,17 @@ adjustReadOnly r { storeKey = readonlyStoreKey , removeKey = readonlyRemoveKey , repairRepo = Nothing + , exportActions = exportActions r + { storeExport = readonlyStoreExport + , removeExport = readonlyRemoveExport + , removeExportDirectory = Just readonlyRemoveExportDirectory + , renameExport = readonlyRenameExport + } + , importActions = importActions r + { storeExportWithContentIdentifier = readonlyStoreExportWithContentIdentifiera + , removeExportWithContentIdentifier = readonlyRemoveExportWithContentIdentifier + , removeExportDirectoryWhenEmpty = Just readonlyRemoveExportDirectory + } } | otherwise = r @@ -40,7 +51,30 @@ readonlyRemoveKey _ = readonlyFail readonlyStorer :: Storer readonlyStorer _ _ _ = readonlyFail +readonlyStoreExport :: FilePath -> Key -> ExportLocation -> MeterUpdate -> Annex Bool +readonlyStoreExport _ _ _ _ = readonlyFail + +readonlyRemoveExport :: Key -> ExportLocation -> Annex Bool +readonlyRemoveExport _ _ = readonlyFail + +readonlyRemoveExportDirectory :: ExportDirectory -> Annex Bool +readonlyRemoveExportDirectory _ = readonlyFail + +readonlyRenameExport :: Key -> ExportLocation -> ExportLocation -> Annex (Maybe Bool) +readonlyRenameExport _ _ _ = return Nothing + +readonlyStoreExportWithContentIdentifier :: FilePath -> Key -> ExportLocation -> [ContentIdentifier] -> MeterUpdate -> Annex (Maybe ContentIdentifier) +readonlyStoreExportWithContentIdentifier _ _ _ _ _ = do + readonlyWarning + return Nothing + +removeExportWithContentIdentifier :: Key -> ExportLocation -> [ContentIdentifier] -> Annex Bool +removeExportWithContentIdentifier _ _ _ = readonlyFail + readonlyFail :: Annex Bool readonlyFail = do - warning "this remote is readonly" + readonlyWarning return False + +readonlyWarning :: Annex () +readonylWarning = warning "this remote is readonly" diff --git a/doc/bugs/regression__58___http_downloads_redirecting_to_ftp_are_no_longer_supported/.comment_1_5184c1b87e249f203541f610278ed08e._comment.swp b/doc/bugs/regression__58___http_downloads_redirecting_to_ftp_are_no_longer_supported/.comment_1_5184c1b87e249f203541f610278ed08e._comment.swp deleted file mode 100644 index 0f0043862f..0000000000 Binary files a/doc/bugs/regression__58___http_downloads_redirecting_to_ftp_are_no_longer_supported/.comment_1_5184c1b87e249f203541f610278ed08e._comment.swp and /dev/null differ