export --json: Fill in the file field

Like import was using ActionItemWorkTreeFile, it's ok to use it for export,
even though it might not correspond with a file in the work tree.
And renamed it to ActionItemTreeFile to make that clearer.

Note that when an export has to rename files, it still uses
ActionItemOther, so file will still be null in that case, but as no file is
being transferred, that seems ok.
This commit is contained in:
Joey Hess 2021-03-12 14:09:19 -04:00
parent f87c63d998
commit 6481991208
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
10 changed files with 37 additions and 22 deletions

View file

@ -270,7 +270,7 @@ startExport r db cvar allfilledvar ti = do
loc = mkExportLocation f
f = getTopFilePath (Git.LsTree.file ti)
af = AssociatedFile (Just f)
ai = ActionItemOther (Just (fromRawFilePath f))
ai = ActionItemTreeFile f
si = SeekInput []
notrecordedpresent ek = (||)
<$> liftIO (notElem loc <$> getExportedLocation db ek)
@ -332,7 +332,7 @@ startUnexport r db f shas = do
where
loc = mkExportLocation f'
f' = getTopFilePath f
ai = ActionItemOther (Just (fromRawFilePath f'))
ai = ActionItemTreeFile f'
si = SeekInput []
startUnexport' :: Remote -> ExportHandle -> TopFilePath -> Key -> CommandStart
@ -342,7 +342,7 @@ startUnexport' r db f ek =
where
loc = mkExportLocation f'
f' = getTopFilePath f
ai = ActionItemOther (Just (fromRawFilePath f'))
ai = ActionItemTreeFile f'
si = SeekInput []
-- Unlike a usual drop from a repository, this does not check that
@ -384,7 +384,7 @@ startRecoverIncomplete r db sha oldf
| otherwise = do
ek <- exportKey sha
let loc = exportTempName ek
let ai = ActionItemOther (Just (fromRawFilePath (fromExportLocation loc)))
let ai = ActionItemTreeFile (fromExportLocation loc)
let si = SeekInput []
starting ("unexport " ++ name r) ai si $ do
liftIO $ removeExportedLocation db ek oldloc