summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
Diffstat (limited to 'Command')
-rw-r--r--Command/Unannex.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/Command/Unannex.hs b/Command/Unannex.hs
index 3fe4cf69c..4b803401e 100644
--- a/Command/Unannex.hs
+++ b/Command/Unannex.hs
@@ -53,11 +53,14 @@ wrapUnannex a = ifM isDirect
, Param "--no-verify"
, Param "-m", Param "content removed from git annex"
]
- cleanindex = do
- (diff, cleanup) <- inRepo $ DiffTree.diffIndex Git.Ref.headRef
- if null diff
- then void (liftIO cleanup) >> return True
- else void (liftIO cleanup) >> return False
+ cleanindex = ifM (inRepo Git.Ref.headExists)
+ ( do
+ (diff, cleanup) <- inRepo $ DiffTree.diffIndex Git.Ref.headRef
+ if null diff
+ then void (liftIO cleanup) >> return True
+ else void (liftIO cleanup) >> return False
+ , return False
+ )
start :: FilePath -> Key -> CommandStart
start file key = stopUnless (inAnnex key) $ do