fix http proxying for a local git remote with a relative path

git-annex-shell expects an absolute path
This commit is contained in:
Joey Hess 2024-07-28 13:31:30 -04:00
parent 41667ad36b
commit bdde6d829c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 12 additions and 6 deletions

View file

@ -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 :: ConsumeStdin -> Git.Repo -> String -> [CommandParam] -> [(Field, String)] -> Annex (Maybe (FilePath, [CommandParam]))
git_annex_shell cs r command params fields git_annex_shell cs r command params fields
| not $ Git.repoIsUrl r = do | not $ Git.repoIsUrl r = do
shellopts <- getshellopts dir <- liftIO $ absPath (Git.repoPath r)
shellopts <- getshellopts dir
return $ Just (shellcmd, shellopts ++ fieldopts) return $ Just (shellcmd, shellopts ++ fieldopts)
| Git.repoIsSsh r = do | Git.repoIsSsh r = do
gc <- Annex.getRemoteGitConfig r gc <- Annex.getRemoteGitConfig r
u <- getRepoUUID r u <- getRepoUUID r
shellopts <- getshellopts shellopts <- getshellopts (Git.repoPath r)
let sshcmd = unwords $ let sshcmd = unwords $
fromMaybe shellcmd (remoteAnnexShell gc) fromMaybe shellcmd (remoteAnnexShell gc)
: map shellEscape (toCommand shellopts) ++ : map shellEscape (toCommand shellopts) ++
@ -58,9 +59,8 @@ git_annex_shell cs r command params fields
Just <$> toRepo cs r gc sshcmd Just <$> toRepo cs r gc sshcmd
| otherwise = return Nothing | otherwise = return Nothing
where where
dir = Git.repoPath r
shellcmd = "git-annex-shell" shellcmd = "git-annex-shell"
getshellopts = do getshellopts dir = do
debugenabled <- Annex.getRead Annex.debugenabled debugenabled <- Annex.getRead Annex.debugenabled
debugselector <- Annex.getRead Annex.debugselector debugselector <- Annex.getRead Annex.debugselector
let params' = case (debugenabled, debugselector) of let params' = case (debugenabled, debugselector) of

View file

@ -28,8 +28,6 @@ Planned schedule of work:
## work notes ## 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, * An interrupted `git-annex copy --to` a cluster via the http server,
when repeated, fails. The http server outputs "transfer already in when repeated, fails. The http server outputs "transfer already in
progress, or unable to take transfer lock". Apparently a second 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. * 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 * Use `sendfile()` to avoid data copying overhead when
`receiveBytes` is being fed right into `sendBytes`. `receiveBytes` is being fed right into `sendBytes`.
Library to use: Library to use: