summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex/Content/Direct.hs8
-rw-r--r--Annex/Direct.hs9
-rw-r--r--Command/Add.hs6
-rw-r--r--doc/design/assistant/desymlink.mdwn5
4 files changed, 19 insertions, 9 deletions
diff --git a/Annex/Content/Direct.hs b/Annex/Content/Direct.hs
index 5e33a8951..64182ddc6 100644
--- a/Annex/Content/Direct.hs
+++ b/Annex/Content/Direct.hs
@@ -54,16 +54,18 @@ changeAssociatedFiles key transform = do
removeAssociatedFile :: Key -> FilePath -> Annex [FilePath]
removeAssociatedFile key file = do
- fs <- changeAssociatedFiles key $ filter (/= file)
+ fs <- changeAssociatedFiles key $ filter (/= normalise file)
when (null fs) $
logStatus key InfoMissing
return fs
addAssociatedFile :: Key -> FilePath -> Annex [FilePath]
addAssociatedFile key file = changeAssociatedFiles key $ \files ->
- if file `elem` files
+ if file' `elem` files
then files
- else file:files
+ else file':files
+ where
+ file' = normalise file
{- Checks if a file in the tree, associated with a key, has not been modified.
-
diff --git a/Annex/Direct.hs b/Annex/Direct.hs
index 3846b0a9e..77a544257 100644
--- a/Annex/Direct.hs
+++ b/Annex/Direct.hs
@@ -153,7 +153,12 @@ mergeDirectCleanup d oldsha newsha = do
nukeFile f
void $ catchMaybeIO $ removeDirectory $ parentDir f
- {- Key symlinks are replaced with their content, if it's available. -}
+ {- The symlink is created from the key, rather than moving in the
+ - symlink created in the temp directory by the merge. This because
+ - a conflicted merge will write to some other file in the temp
+ - directory.
+ -
+ - Symlinks are replaced with their content, if it's available. -}
movein k f = do
l <- calcGitLink f k
liftIO $ replaceFile f $ const $
@@ -175,7 +180,7 @@ toDirectGen :: Key -> FilePath -> Annex (Maybe (Annex ()))
toDirectGen k f = do
loc <- inRepo $ gitAnnexLocation k
createContentDir loc -- thaws directory too
- locs <- filter (/= f) <$> addAssociatedFile k f
+ locs <- filter (/= normalise f) <$> addAssociatedFile k f
case locs of
[] -> ifM (liftIO $ doesFileExist loc)
( return $ Just $ do
diff --git a/Command/Add.hs b/Command/Add.hs
index 7fa7cb3a8..edb2f9cf4 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -27,9 +27,9 @@ def = [command "add" paramPaths seek "add files to annex"]
seek :: [CommandSeek]
seek = [withFilesNotInGit start, withFilesUnlocked start]
-{- The add subcommand annexes a file, storing it in a backend, and then
- - moving it into the annex directory and setting up the symlink pointing
- - to its content. -}
+{- 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
+ - the symlink pointing to its content. -}
start :: FilePath -> CommandStart
start file = notBareRepo $ ifAnnexed file fixup add
where
diff --git a/doc/design/assistant/desymlink.mdwn b/doc/design/assistant/desymlink.mdwn
index 54b7c9800..f2ba914bc 100644
--- a/doc/design/assistant/desymlink.mdwn
+++ b/doc/design/assistant/desymlink.mdwn
@@ -87,6 +87,9 @@ is converted to a real file when it becomes present.
* Deal with files changing as they're being transferred from a direct mode
repository to another git repository. The remote repo currently will
accept the bad data and update the location log to say it has the key.
+
+## done
+
* `git annex sync` updates the key to files mappings for files changed,
but needs much other work to handle direct mode:
* Generate git commit, without running `git commit`, because it will
@@ -104,4 +107,4 @@ is converted to a real file when it becomes present.
repo, replace the symlink with the direct file (either moving out
of `.git/annex/objects/` or hard-linking if the same key is present
elsewhere in the tree. **done**
- * handle merge conflicts on direct mode files
+ * handle merge conflicts on direct mode files **done**