From a925465876fee3fa3568bbea29780ede7237c842 Mon Sep 17 00:00:00 2001 From: "asakurareiko@f3d908c71c009580228b264f63f21c7274df7476" Date: Tue, 27 Sep 2022 00:45:22 +0000 Subject: [PATCH] --- .../Using_git-annex_on_NTFS_with_WSL1.mdwn | 113 +++--------------- 1 file changed, 15 insertions(+), 98 deletions(-) diff --git a/doc/tips/Using_git-annex_on_NTFS_with_WSL1.mdwn b/doc/tips/Using_git-annex_on_NTFS_with_WSL1.mdwn index ac95ac2b6c..eb115d29b4 100644 --- a/doc/tips/Using_git-annex_on_NTFS_with_WSL1.mdwn +++ b/doc/tips/Using_git-annex_on_NTFS_with_WSL1.mdwn @@ -17,6 +17,9 @@ The following steps are tested on Windows 10 21h1 with Ubuntu 20 and are designe * `git config annex.freezecontent-command 'wsl-freezecontent %path'` * `git config annex.thawcontent-command 'wsl-thawcontent %path'` +
+wsl-freezecontent + ``` #!/usr/bin/env bash @@ -40,7 +43,10 @@ if [ "$?" -ne 0 ]; then fi ``` +
+
+wsl-thawcontent ``` #!/usr/bin/env bash @@ -61,106 +67,12 @@ if [ "$?" -ne 0 ]; then fi ``` +
** Patches ** -This patch allows permissions and freeze/thaw hooks to run on a crippled file system. - -``` -From 7f3da0dda841bf73645809d3919cff2a37cb21de Mon Sep 17 00:00:00 2001 -From: Reiko Asakura -Date: Sat, 23 Oct 2021 17:14:27 -0400 -Subject: [PATCH 2/2] Allow perms on crippled filesystem - ---- - Annex/Perms.hs | 22 +++++++++------------- - 1 file changed, 9 insertions(+), 13 deletions(-) - -diff --git a/Annex/Perms.hs b/Annex/Perms.hs -index 6681da7e0..e0c323d05 100644 ---- a/Annex/Perms.hs -+++ b/Annex/Perms.hs -@@ -61,7 +61,7 @@ setAnnexPerm :: Bool -> RawFilePath -> Annex () - setAnnexPerm = setAnnexPerm' Nothing - - setAnnexPerm' :: Maybe ([FileMode] -> FileMode -> FileMode) -> Bool -> RawFilePath -> Annex () --setAnnexPerm' modef isdir file = unlessM crippledFileSystem $ -+setAnnexPerm' modef isdir file = - withShared $ liftIO . go - where - go GroupShared = void $ tryIO $ modifyFileMode file $ modef' $ -@@ -89,7 +89,7 @@ resetAnnexFilePerm = resetAnnexPerm False - - usual modes. - -} - resetAnnexPerm :: Bool -> RawFilePath -> Annex () --resetAnnexPerm isdir file = unlessM crippledFileSystem $ do -+resetAnnexPerm isdir file = do - defmode <- liftIO defaultFileMode - let modef moremodes _oldmode = addModes moremodes defmode - setAnnexPerm' (Just modef) isdir file -@@ -154,7 +154,7 @@ createWorkTreeDirectory dir = do - - that happens with write permissions. - -} - freezeContent :: RawFilePath -> Annex () --freezeContent file = unlessM crippledFileSystem $ -+freezeContent file = - withShared $ \sr -> freezeContent' sr file - - freezeContent' :: SharedRepository -> RawFilePath -> Annex () -@@ -199,14 +199,12 @@ freezeContent'' sr file rv = do - - write permissions are ignored. - -} - checkContentWritePerm :: RawFilePath -> Annex (Maybe Bool) --checkContentWritePerm file = ifM crippledFileSystem -- ( return (Just True) -- , do -+checkContentWritePerm file = -+ do - rv <- getVersion - hasfreezehook <- hasFreezeHook - withShared $ \sr -> liftIO $ - checkContentWritePerm' sr file rv hasfreezehook -- ) - - checkContentWritePerm' :: SharedRepository -> RawFilePath -> Maybe RepoVersion -> Bool -> IO (Maybe Bool) - checkContentWritePerm' sr file rv hasfreezehook -@@ -252,10 +250,8 @@ thawContent' sr file = do - - crippled filesystem, the file may be frozen, so try to thaw its - - permissions. -} - thawPerms :: Annex () -> Annex () -> Annex () --thawPerms a hook = ifM crippledFileSystem -- ( void (tryNonAsync a) -- , hook >> a -- ) -+thawPerms a hook = -+ hook >> a - - {- Blocks writing to the directory an annexed file is in, to prevent the - - file accidentally being deleted. However, if core.sharedRepository -@@ -263,7 +259,7 @@ thawPerms a hook = ifM crippledFileSystem - - file. - -} - freezeContentDir :: RawFilePath -> Annex () --freezeContentDir file = unlessM crippledFileSystem $ do -+freezeContentDir file = do - fastDebug "Annex.Perms" ("freezing content directory " ++ fromRawFilePath dir) - withShared go - freezeHook dir -@@ -287,7 +283,7 @@ createContentDir dest = do - unlessM (liftIO $ R.doesPathExist dir) $ - createAnnexDirectory dir - -- might have already existed with restricted perms -- unlessM crippledFileSystem $ do -+ do - thawHook dir - liftIO $ allowWrite dir - where --- -2.30.2 - -``` - -This patch allows `git annex fix` on a crippled file system. +
+This patch allows `git annex fix` on a crippled file system. ``` From 65fe6e362dfbf2f54c8da5ca17c59af26de5ff83 Mon Sep 17 00:00:00 2001 @@ -189,10 +101,14 @@ index 39853c894..2d66c1461 100644 2.30.2 ``` +
** Usage tips ** -* Symlinks are invalid in Windows if created before the target file exists, such as after `git annex add` or `git annex get`. This can be fixed by recreating them with any method, such as delete them and `git checkout`. Below is a sample script. +* Symlinks are invalid in Windows if created before the target file exists, such as after `git annex add` or `git annex get`. This can be fixed by recreating them with any method, such as delete them and `git checkout`. + +
+Sample script to recreate all symlinks under the current directory ``` #!/usr/bin/env python3 @@ -211,6 +127,7 @@ def do(p): do(pathlib.Path('.')) ``` +
* Sometimes there will SQLite errors using multiple jobs but retrying will work most of the time.