From 9463c439fa8f8dbc1cebae518263ab0e5604547c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 30 Sep 2013 12:48:40 -0400 Subject: fix direct mode switch permissions problem Similar to how a similar problem with indirect was earlier fixed. --- Command/Direct.hs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Command/Direct.hs') diff --git a/Command/Direct.hs b/Command/Direct.hs index 7835988b4..7485f41ce 100644 --- a/Command/Direct.hs +++ b/Command/Direct.hs @@ -7,6 +7,8 @@ module Command.Direct where +import Control.Exception.Extensible + import Common.Annex import Command import qualified Git @@ -15,6 +17,7 @@ import qualified Git.LsFiles import Config import Annex.Direct import Annex.Version +import Annex.Exception def :: [Command] def = [notBareRepo $ noDaemonRunning $ @@ -51,10 +54,17 @@ perform = do Nothing -> noop Just a -> do showStart "direct" f - a - showEndOk + r <- tryAnnex a + case r of + Left e -> warnlocked e + Right _ -> showEndOk return Nothing + warnlocked :: SomeException -> Annex () + warnlocked e = do + warning $ show e + warning "leaving this file as-is; correct this problem and run git annex fsck on it" + cleanup :: CommandCleanup cleanup = do showStart "direct" "" -- cgit v1.2.3