diff options
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Add.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Command/Add.hs b/Command/Add.hs index 5c7054543..e2b6d04fe 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -75,14 +75,19 @@ start file = ifAnnexed file addpresent add showStart "add" file next $ perform file addpresent key = ifM isDirect - ( ifM (goodContent key file) ( stop , add ) + ( do + ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file + case ms of + Just s | isSymbolicLink s -> fixup key + _ -> ifM (goodContent key file) ( stop , add ) , fixup key ) fixup key = do - -- fixup from an interrupted add; the symlink - -- is present but not yet added to git + -- the annexed symlink is present but not yet added to git showStart "add" file liftIO $ removeFile file + whenM isDirect $ + void $ addAssociatedFile key file next $ next $ cleanup file key Nothing =<< inAnnex key {- The file that's being added is locked down before a key is generated, |