avoid exporting non-annexed symlinks
So that importing does not replace them with plain files. This works similarly to how the previous handling of submodules and matchers did, except that annexed symlinks still get exported as plain files of course, it's only non-annexed symlinks that it does not make sense to export. When symlinks have previously been exported, updating the export will unexport them after upgrading to this commit. Sponsored-by: Kevin Mueller on Patreon
This commit is contained in:
parent
0584e096d1
commit
7e2f5edd68
3 changed files with 29 additions and 7 deletions
|
@ -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 <id@joeyh.name> Mon, 03 Jan 2022 14:01:14 -0400
|
||||||
|
|
||||||
git-annex (8.20211231) upstream; urgency=medium
|
git-annex (8.20211231) upstream; urgency=medium
|
||||||
|
|
||||||
* Improved support for using git-annex in a read-only repository,
|
* Improved support for using git-annex in a read-only repository,
|
||||||
|
|
|
@ -479,7 +479,8 @@ removeEmptyDirectories r db loc ks
|
||||||
newtype ExportFiltered t = ExportFiltered t
|
newtype ExportFiltered t = ExportFiltered t
|
||||||
|
|
||||||
-- | Filters the tree to annexed files that are preferred content of the
|
-- | 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
|
-- A log is written with tree items that were filtered out, so they can
|
||||||
-- be added back in when importing from the remote.
|
-- 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
|
case toTreeItemType mode of
|
||||||
-- Don't export submodule entries.
|
-- Don't export submodule entries.
|
||||||
Just TreeSubmodule -> excluded
|
Just TreeSubmodule -> excluded
|
||||||
_ -> case mmatcher of
|
Just TreeSymlink -> checkkey True
|
||||||
Nothing -> return (Just ti)
|
_ -> checkkey False
|
||||||
Just matcher -> catKey sha >>= \case
|
|
||||||
Just k -> checkmatcher matcher k
|
|
||||||
-- Always export non-annexed files.
|
|
||||||
Nothing -> return (Just ti)
|
|
||||||
where
|
where
|
||||||
excluded = do
|
excluded = do
|
||||||
() <- liftIO $ logwriter ti
|
() <- liftIO $ logwriter ti
|
||||||
return Nothing
|
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
|
checkmatcher matcher k = do
|
||||||
let mi = MatchingInfo $ ProvidedInfo
|
let mi = MatchingInfo $ ProvidedInfo
|
||||||
{ providedFilePath = Just $
|
{ providedFilePath = Just $
|
||||||
|
|
|
@ -26,3 +26,5 @@ Don't do anything if they are the same.
|
||||||
Replace symlink by actual file if they differ.
|
Replace symlink by actual file if they differ.
|
||||||
|
|
||||||
[[!meta title="export then import replaces non-annex symlinks by plain text files"]]
|
[[!meta title="export then import replaces non-annex symlinks by plain text files"]]
|
||||||
|
|
||||||
|
> [[fixed|done]] by skipping syminks. --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue