convert TopFilePath to use RawFilePath
Adds a dependency on filepath-bytestring, an as yet unreleased fork of filepath that operates on RawFilePath. Git.Repo also changed to use RawFilePath for the path to the repo. This does eliminate some RawFilePath -> FilePath -> RawFilePath conversions. And filepath-bytestring's </> is probably faster. But I don't expect a major performance improvement from this. This is mostly groundwork for making Annex.Location use RawFilePath, which will allow for a conversion-free pipleline.
This commit is contained in:
parent
a7004375ec
commit
bdec7fed9c
97 changed files with 323 additions and 271 deletions
|
@ -28,22 +28,22 @@ seek ps = (withFilesInGit $ commandAction . whenAnnexed start) =<< workTreeItems
|
|||
start :: RawFilePath -> Key -> CommandStart
|
||||
start file key = stopUnless (inAnnex key) $
|
||||
starting "unannex" (mkActionItem (key, file)) $
|
||||
perform (fromRawFilePath file) key
|
||||
perform file key
|
||||
|
||||
perform :: FilePath -> Key -> CommandPerform
|
||||
perform :: RawFilePath -> Key -> CommandPerform
|
||||
perform file key = do
|
||||
liftIO $ removeFile file
|
||||
liftIO $ removeFile (fromRawFilePath file)
|
||||
inRepo $ Git.Command.run
|
||||
[ Param "rm"
|
||||
, Param "--cached"
|
||||
, Param "--force"
|
||||
, Param "--quiet"
|
||||
, Param "--"
|
||||
, File file
|
||||
, File (fromRawFilePath file)
|
||||
]
|
||||
next $ cleanup file key
|
||||
|
||||
cleanup :: FilePath -> Key -> CommandCleanup
|
||||
cleanup :: RawFilePath -> Key -> CommandCleanup
|
||||
cleanup file key = do
|
||||
Database.Keys.removeAssociatedFile key =<< inRepo (toTopFilePath file)
|
||||
src <- calcRepo $ gitAnnexLocation key
|
||||
|
@ -61,11 +61,12 @@ cleanup file key = do
|
|||
, copyfrom src
|
||||
)
|
||||
where
|
||||
file' = fromRawFilePath file
|
||||
copyfrom src =
|
||||
thawContent file `after` liftIO (copyFileExternal CopyAllMetaData src file)
|
||||
thawContent file' `after` liftIO (copyFileExternal CopyAllMetaData src file')
|
||||
hardlinkfrom src =
|
||||
-- creating a hard link could fall; fall back to copying
|
||||
ifM (liftIO $ catchBoolIO $ createLink src file >> return True)
|
||||
ifM (liftIO $ catchBoolIO $ createLink src file' >> return True)
|
||||
( return True
|
||||
, copyfrom src
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue