diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-05-16 15:30:40 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-05-16 15:30:40 -0400 |
commit | bb482c2f54c38a8b1d08ed7762e50ae46ed1bbac (patch) | |
tree | aef7255b4b11d76f12739bb89d928a0ade27b6fa /Command | |
parent | 3b33e39dbd444ccada4598598abc6da40880d9e6 (diff) |
add: Adding a v6 pointer file used to annex it; now the pointer file is added to git as-is.
(git add of a pointer file already did the right thing)
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Add.hs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Command/Add.hs b/Command/Add.hs index 194e34de0..d6a2e5bf7 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -17,7 +17,9 @@ import qualified Annex.Queue import qualified Database.Keys import Config import Annex.FileMatcher +import Annex.Link import Annex.Version +import Git.FilePath cmd :: Command cmd = notBareRepo $ withGlobalOptions (jobsOption : jsonOption : fileMatchingOptions) $ @@ -80,8 +82,15 @@ addFile file = do return True start :: FilePath -> CommandStart -start file = ifAnnexed file addpresent add +start file = do + ifM versionSupportsUnlockedPointers + ( do + mk <- liftIO $ isPointerFile file + maybe go fixuppointer mk + , go + ) where + go = ifAnnexed file addpresent add add = do ms <- liftIO $ catchMaybeIO $ getSymbolicLinkStatus file case ms of @@ -114,9 +123,14 @@ start file = ifAnnexed file addpresent add -- the annexed symlink is present but not yet added to git showStart "add" file liftIO $ removeFile file - next $ next $ do - addLink file key Nothing + addLink file key Nothing + next $ next $ cleanup key =<< inAnnex key + fixuppointer key = do + -- the pointer file is present, but not yet added to git + showStart "add" file + Database.Keys.addAssociatedFile key =<< inRepo (toTopFilePath file) + next $ next $ addFile file perform :: FilePath -> CommandPerform perform file = do |