diff --git a/CHANGELOG b/CHANGELOG index a1c1032eef..235b49aacc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +git-annex (8.20211232) UNRELEASED; urgency=medium + + * export: When a non-annexed symlink is in the tree to be exported, skip it. + * import: When the previously exported tree contained a non-annexed symlink, + preserve it in the imported tree so it does not get deleted. + + -- Joey Hess Mon, 03 Jan 2022 14:01:14 -0400 + git-annex (8.20211231) upstream; urgency=medium * Improved support for using git-annex in a read-only repository, diff --git a/Command/Export.hs b/Command/Export.hs index bb848f42f1..6efbaf1002 100644 --- a/Command/Export.hs +++ b/Command/Export.hs @@ -479,7 +479,8 @@ removeEmptyDirectories r db loc ks newtype ExportFiltered t = ExportFiltered t -- | Filters the tree to annexed files that are preferred content of the --- remote, and also including non-annexed files, but not submodules. +-- remote, and also including non-annexed files, but not submodules or +-- non-annexed symlinks. -- -- A log is written with tree items that were filtered out, so they can -- be added back in when importing from the remote. @@ -505,17 +506,28 @@ filterExport r tree = logExportExcluded (uuid r) $ \logwriter -> do case toTreeItemType mode of -- Don't export submodule entries. Just TreeSubmodule -> excluded - _ -> case mmatcher of - Nothing -> return (Just ti) - Just matcher -> catKey sha >>= \case - Just k -> checkmatcher matcher k - -- Always export non-annexed files. - Nothing -> return (Just ti) + Just TreeSymlink -> checkkey True + _ -> checkkey False where excluded = do () <- liftIO $ logwriter ti return Nothing + checkkey issymlink = + case mmatcher of + Nothing + | issymlink -> catKey sha >>= \case + Just _ -> return (Just ti) + Nothing + | issymlink -> excluded + | otherwise -> return (Just ti) + | otherwise -> return (Just ti) + Just matcher -> catKey sha >>= \case + Just k -> checkmatcher matcher k + Nothing + | issymlink -> excluded + | otherwise -> return (Just ti) + checkmatcher matcher k = do let mi = MatchingInfo $ ProvidedInfo { providedFilePath = Just $ diff --git a/doc/bugs/adb_replaces_symlinks_by_plain_text_files.mdwn b/doc/bugs/adb_replaces_symlinks_by_plain_text_files.mdwn index e6bf632ddc..5e663589fb 100644 --- a/doc/bugs/adb_replaces_symlinks_by_plain_text_files.mdwn +++ b/doc/bugs/adb_replaces_symlinks_by_plain_text_files.mdwn @@ -26,3 +26,5 @@ Don't do anything if they are the same. Replace symlink by actual file if they differ. [[!meta title="export then import replaces non-annex symlinks by plain text files"]] + +> [[fixed|done]] by skipping syminks. --[[Joey]]