From 60e30564338ebd9b18b5e229a9050478e5b8c423 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 2 Jun 2016 13:50:05 -0400 Subject: sync --content: Fix bug that caused transfers of files to be made to a git remote that does not have a UUID. This particularly impacted clones from gcrypt repositories. Added guard in Annex.Transfer to prevent this problem at a deeper level. I'm unhappy ith NoUUID, but having Maybe UUID instead wouldn't help either if nothing checked that there was a UUID. Since there legitimately need to be Remotes that do not have a UUID, I can't see a way to fix it at the type level, short making there be two separate types of Remotes. --- Annex/Transfer.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Annex') diff --git a/Annex/Transfer.hs b/Annex/Transfer.hs index 213de0648..78ef0e502 100644 --- a/Annex/Transfer.hs +++ b/Annex/Transfer.hs @@ -46,10 +46,17 @@ noObserver :: TransferObserver noObserver _ _ _ = noop upload :: Observable v => UUID -> Key -> AssociatedFile -> RetryDecider -> TransferObserver -> (MeterUpdate -> Annex v) -> NotifyWitness -> Annex v -upload u key f d o a _witness = runTransfer (Transfer Upload u key) f d o a +upload u key f d o a _witness = guardHaveUUID u $ + runTransfer (Transfer Upload u key) f d o a download :: Observable v => UUID -> Key -> AssociatedFile -> RetryDecider -> TransferObserver -> (MeterUpdate -> Annex v) -> NotifyWitness -> Annex v -download u key f d o a _witness = runTransfer (Transfer Download u key) f d o a +download u key f d o a _witness = guardHaveUUID u $ + runTransfer (Transfer Download u key) f d o a + +guardHaveUUID :: Observable v => UUID -> Annex v -> Annex v +guardHaveUUID u a + | u == NoUUID = return observeFailure + | otherwise = a {- Runs a transfer action. Creates and locks the lock file while the - action is running, and stores info in the transfer information -- cgit v1.2.3