summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-05-16 15:30:40 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-05-16 15:30:40 -0400
commitbb482c2f54c38a8b1d08ed7762e50ae46ed1bbac (patch)
treeaef7255b4b11d76f12739bb89d928a0ade27b6fa
parent3b33e39dbd444ccada4598598abc6da40880d9e6 (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)
-rw-r--r--Command/Add.hs20
-rw-r--r--debian/changelog3
2 files changed, 20 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
diff --git a/debian/changelog b/debian/changelog
index e9de8bce8..1002dd0f2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,9 @@ git-annex (6.20160512) UNRELEASED; urgency=medium
assistant.
* assistant: Fix race in v6 mode that caused downloaded file content to
sometimes not replace pointer files.
+ * 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)
-- Joey Hess <id@joeyh.name> Wed, 11 May 2016 16:08:38 -0400