git style filename quoting controlled by core.quotePath
This is by no means complete, but escaping filenames in actionItemDesc does cover most commands. Note that for ActionItemBranchFilePath, the value is branch:file, and I choose to only quote the file part (if necessary). I considered quoting the whole thing. But, branch names cannot contain control characters, and while they can contain unicode, git coes not quote unicode when displaying branch names. So, it would be surprising for git-annex to quote unicode in a branch name. The find command is the most obvious command that still needs to be dealt with. There are probably other places that filenames also get displayed, eg embedded in error messages. Some other commands use ActionItemOther with a filename, I think that ActionItemOther should either be pre-sanitized, or should explicitly not be used for filenames, so that needs more work. When --json is used, unicode does not get escaped, but control characters were already escaped in json. (Key escaping may turn out to be needed, but I'm ignoring that for now.) Sponsored-by: unqueued on Patreon
This commit is contained in:
parent
81bc57322f
commit
d689a5b338
11 changed files with 78 additions and 45 deletions
|
@ -15,6 +15,7 @@ import Logs.Transfer
|
|||
import Utility.DirWatcher
|
||||
import Utility.DirWatcher.Types
|
||||
import qualified Remote
|
||||
import qualified Annex
|
||||
import Annex.Perms
|
||||
|
||||
import Control.Concurrent
|
||||
|
@ -62,7 +63,8 @@ onAdd file = case parseTransferFile file of
|
|||
where
|
||||
go _ Nothing = noop -- transfer already finished
|
||||
go t (Just info) = do
|
||||
debug [ "transfer starting:", describeTransfer t info ]
|
||||
qp <- liftAnnex $ coreQuotePath <$> Annex.getGitConfig
|
||||
debug [ "transfer starting:", describeTransfer qp t info ]
|
||||
r <- liftAnnex $ Remote.remoteFromUUID $ transferUUID t
|
||||
updateTransferInfo t info { transferRemote = r }
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import Logs.Transfer
|
|||
import Types.Remote
|
||||
import qualified Remote
|
||||
import qualified Types.Remote as Remote
|
||||
import qualified Annex
|
||||
import Annex.Wanted
|
||||
import Utility.TList
|
||||
|
||||
|
@ -139,7 +140,8 @@ enqueue reason schedule t info
|
|||
| otherwise = go snocTList
|
||||
where
|
||||
go modlist = whenM (add modlist) $ do
|
||||
debug [ "queued", describeTransfer t info, ": " ++ reason ]
|
||||
qp <- liftAnnex $ coreQuotePath <$> Annex.getGitConfig
|
||||
debug [ "queued", describeTransfer qp t info, ": " ++ reason ]
|
||||
notifyTransfer
|
||||
add modlist = do
|
||||
q <- getAssistant transferQueue
|
||||
|
|
|
@ -123,14 +123,16 @@ genTransfer t info = case transferRemote info of
|
|||
return Nothing
|
||||
, ifM (liftAnnex $ shouldTransfer t info)
|
||||
( do
|
||||
debug [ "Transferring:" , describeTransfer t info ]
|
||||
qp <- liftAnnex $ coreQuotePath <$> Annex.getGitConfig
|
||||
debug [ "Transferring:" , describeTransfer qp t info ]
|
||||
notifyTransfer
|
||||
let sd = remoteAnnexStallDetection
|
||||
(Remote.gitconfig remote)
|
||||
return $ Just (t, info, go remote sd)
|
||||
, do
|
||||
qp <- liftAnnex $ coreQuotePath <$> Annex.getGitConfig
|
||||
debug [ "Skipping unnecessary transfer:",
|
||||
describeTransfer t info ]
|
||||
describeTransfer qp t info ]
|
||||
void $ removeTransfer t
|
||||
finishedTransfer t (Just info)
|
||||
return Nothing
|
||||
|
@ -241,9 +243,11 @@ finishedTransfer t (Just info)
|
|||
Later (transferKey t) (associatedFile info) Upload
|
||||
| otherwise = dodrops True
|
||||
where
|
||||
dodrops fromhere = handleDrops
|
||||
("drop wanted after " ++ describeTransfer t info)
|
||||
fromhere (transferKey t) (associatedFile info) []
|
||||
dodrops fromhere = do
|
||||
qp <- liftAnnex $ coreQuotePath <$> Annex.getGitConfig
|
||||
handleDrops
|
||||
("drop wanted after " ++ describeTransfer qp t info)
|
||||
fromhere (transferKey t) (associatedFile info) []
|
||||
finishedTransfer _ _ = noop
|
||||
|
||||
{- Pause a running transfer. -}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue