From bdde6d829c6d24b60d0ea7578d6ff08bcf3e72fc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 28 Jul 2024 13:31:30 -0400 Subject: [PATCH] fix http proxying for a local git remote with a relative path git-annex-shell expects an absolute path --- Remote/Helper/Ssh.hs | 8 ++++---- doc/todo/git-annex_proxies.mdwn | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Remote/Helper/Ssh.hs b/Remote/Helper/Ssh.hs index f3d1527fa7..3832a88568 100644 --- a/Remote/Helper/Ssh.hs +++ b/Remote/Helper/Ssh.hs @@ -44,12 +44,13 @@ toRepo cs r gc remotecmd = do git_annex_shell :: ConsumeStdin -> Git.Repo -> String -> [CommandParam] -> [(Field, String)] -> Annex (Maybe (FilePath, [CommandParam])) git_annex_shell cs r command params fields | not $ Git.repoIsUrl r = do - shellopts <- getshellopts + dir <- liftIO $ absPath (Git.repoPath r) + shellopts <- getshellopts dir return $ Just (shellcmd, shellopts ++ fieldopts) | Git.repoIsSsh r = do gc <- Annex.getRemoteGitConfig r u <- getRepoUUID r - shellopts <- getshellopts + shellopts <- getshellopts (Git.repoPath r) let sshcmd = unwords $ fromMaybe shellcmd (remoteAnnexShell gc) : map shellEscape (toCommand shellopts) ++ @@ -58,9 +59,8 @@ git_annex_shell cs r command params fields Just <$> toRepo cs r gc sshcmd | otherwise = return Nothing where - dir = Git.repoPath r shellcmd = "git-annex-shell" - getshellopts = do + getshellopts dir = do debugenabled <- Annex.getRead Annex.debugenabled debugselector <- Annex.getRead Annex.debugselector let params' = case (debugenabled, debugselector) of diff --git a/doc/todo/git-annex_proxies.mdwn b/doc/todo/git-annex_proxies.mdwn index ce22687b82..e51c725de3 100644 --- a/doc/todo/git-annex_proxies.mdwn +++ b/doc/todo/git-annex_proxies.mdwn @@ -28,8 +28,6 @@ Planned schedule of work: ## work notes -* http proxying for a local git remote seems to probably not work - * An interrupted `git-annex copy --to` a cluster via the http server, when repeated, fails. The http server outputs "transfer already in progress, or unable to take transfer lock". Apparently a second @@ -117,6 +115,14 @@ Planned schedule of work: * Optimise proxy speed. See design for ideas. +* Speed: A proxy to a local git repository spawns git-annex-shell + to communicate with it. It would be more efficient to operate + directly on the Remote. Especially when transferring content to/from it. + But: When a cluster has several nodes that are local git repositories, + and is sending data to all of them, this would need an alternate + interface than `storeKey`, which supports streaming, of chunks + of a ByteString. + * Use `sendfile()` to avoid data copying overhead when `receiveBytes` is being fed right into `sendBytes`. Library to use: