summaryrefslogtreecommitdiff
path: root/Command/Add.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-07 16:15:30 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-07 16:15:30 -0400
commit032ee546c9cda12b4b85c05001220d47e8bbba4d (patch)
tree3e6957962b84167fdffa3ff5adf4c8bef1c337dd /Command/Add.hs
parentf3d2bf2cda1462dcb1a5bbc81505823dd5c057ec (diff)
add: Stage symlinks the same as git add would, even if they are not a link to annexed content.
Diffstat (limited to 'Command/Add.hs')
-rw-r--r--Command/Add.hs19
1 files changed, 12 insertions, 7 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index d53ba91ad..5f6f06cdb 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -66,10 +66,13 @@ startSmall :: FilePath -> CommandStart
startSmall file = do
showStart "add" file
showNote "non-large file; adding content to git repository"
- next $ do
- params <- forceParams
- Annex.Queue.addCommand "add" (params++[Param "--"]) [file]
- next $ return True
+ next $ performAdd file
+
+performAdd :: FilePath -> CommandPerform
+performAdd file = do
+ params <- forceParams
+ Annex.Queue.addCommand "add" (params++[Param "--"]) [file]
+ next $ return True
{- The add subcommand annexes a file, generating a key for it using a
- backend, and then moving it into the annex directory and setting up
@@ -81,11 +84,13 @@ start file = ifAnnexed file addpresent add
ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file
case ms of
Nothing -> stop
- Just s
- | isSymbolicLink s || not (isRegularFile s) -> stop
+ Just s
+ | not (isRegularFile s) && not (isSymbolicLink s) -> stop
| otherwise -> do
showStart "add" file
- next $ perform file
+ next $ if isSymbolicLink s
+ then performAdd file
+ else perform file
addpresent key = ifM isDirect
( do
ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file