summaryrefslogtreecommitdiff
path: root/Command/SetKey.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-27 17:07:22 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-27 17:07:22 -0400
commite0518a4adc250da1ad088c4362016627e1effb08 (patch)
treea48b3906567e4ccd2de647e656669829c0ec1686 /Command/SetKey.hs
parente97d13e29b18c4522395996299651334cb221519 (diff)
Fix bug in setkey subcommand triggered by move --to.
Diffstat (limited to 'Command/SetKey.hs')
-rw-r--r--Command/SetKey.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Command/SetKey.hs b/Command/SetKey.hs
index 685872f73..55472ccae 100644
--- a/Command/SetKey.hs
+++ b/Command/SetKey.hs
@@ -35,7 +35,10 @@ perform :: FilePath -> Key -> SubCmdPerform
perform file key = do
-- the file might be on a different filesystem, so mv is used
-- rather than simply calling moveToObjectDir key file
- ok <- getViaTmp key $ \dest -> liftIO $ boolSystem "mv" [file, dest]
+ ok <- getViaTmp key $ \dest -> do
+ if dest /= file
+ then liftIO $ boolSystem "mv" [file, dest]
+ else return True
if ok
then return $ Just $ cleanup key
else error "mv failed!"