add comment

This commit is contained in:
Joey Hess 2023-03-23 15:29:53 -04:00
parent 3c5f4b89ca
commit d580ea2120
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -0,0 +1,36 @@
[[!comment format=mdwn
username="joey"
subject="""comment 2"""
date="2023-03-23T18:27:36Z"
content="""
Analysis: When parsing the relative url, git-annex ends up constructing a
Repo with location `LocalUnknown "./rsync://user@user.rsync.net:relative/path/to/repo.git"`
So, it thinks it's a local git repository, which of course does not exist,
so it skips syncing with it.
Why does it do that? Well:
ghci> import Network.URI
ghci> parseURI "rsync://user@user.rsync.net:relative/path/to/repo.git"
Nothing
And Git.GCrypt.encryptedRemote strips off the "gcrypt::",
leaving that.
ghci> r
Repo {location = LocalUnknown "/home/joey/tmp/bb", config = fromList [], fullconfig = fromList [], remoteName = Nothing, gitEnv = Nothing, gitEnvOverridesGitDir = False, gitGlobalOpts = [], gitDirSpecifiedExplicitly = False}
ghci> rr
Repo {location = Url gcrypt::rsync://user@user.rsync.net:relative/path/to/repo, config = fromList [], fullconfig = fromList [], remoteName = Just "test1", gitEnv = Nothing, gitEnvOverridesGitDir = False, gitGlobalOpts = [], gitDirSpecifiedExplicitly = False}
ghci> encryptedRemote r rr
Repo {location = LocalUnknown "/home/joey/tmp/bb/rsync://user@user.rsync.net:relative/path/to/repo.git", config = fromList [], fullconfig = fromList [], remoteName = Nothing, gitEnv = Nothing, gitEnvOverridesGitDir = False, gitGlobalOpts = [], gitDirSpecifiedExplicitly = False}
ghci> parseRemoteLocation "rsync://user@user.rsync.net:relative/path/to/repo" r
RemotePath "rsync://user@user.rsync.net:relative/path/to/repo"
parseRemoteLocation uses isURI and that does not parse as a valid URI.
So Git.GCrypt.encryptedRemote will need to force it to parse as an url in this case.
(I remember that I fixed git-remote-gcrypt to support absolute urls for related
reasons. Those relative nonstandard urls are not a good idea.)
"""]]