fromkey: create directory for pointer files too
authorKyle Meyer <kyle@kyleam.com>
Thu, 6 May 2021 15:11:14 +0000 (11:11 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 7 May 2021 15:10:06 +0000 (11:10 -0400)
fromkey creates leading directories for symbolic links.  Do the same
for pointer files.

Command/FromKey.hs

index eadb89fd1652edd07b4b8fab45abad92efaf6635..16ff1693f4bb3db424418da621ed8d498869409d 100644 (file)
@@ -106,6 +106,7 @@ perform matcher key file = lookupKeyNotHidden file >>= \case
                                        , matchKey = Just key
                                        }
                                else keyMatchInfoWithoutContent key file
+                       createWorkTreeDirectory (parentDir file)
                        ifM (addUnlocked matcher mi contentpresent)
                                ( do
                                        stagePointerFile file Nothing =<< hashPointerFile key
@@ -115,7 +116,6 @@ perform matcher key file = lookupKeyNotHidden file >>= \case
                                                else writepointer
                                , do
                                        link <- calcRepo $ gitAnnexLink file key
-                                       createWorkTreeDirectory (parentDir file)
                                        addAnnexLink link file
                                )
                        next $ return True