set remote's annexUrl automatically
When the remote repository's git config file has annex.url set to an annex+http url.
This commit is contained in:
parent
c87cfe1e00
commit
bc9cc79e85
5 changed files with 35 additions and 21 deletions
|
@ -340,6 +340,12 @@ tryGitConfigRead autoinit r hasuuid
|
|||
-- optimisation.
|
||||
unless (fromMaybe False $ Git.Config.isBare r') $
|
||||
setremote setRemoteBare False
|
||||
-- When annex.url is set to a P2P http url,
|
||||
-- store in remote.name.annexUrl
|
||||
case Git.fromConfigValue <$> Git.Config.getMaybe (annexConfig "url") r' of
|
||||
Just u | isP2PHttpProtocolUrl u ->
|
||||
setremote (setConfig . annexUrlConfigKey) u
|
||||
_ -> noop
|
||||
return r'
|
||||
Left err -> do
|
||||
set_ignore "not usable by git-annex" False
|
||||
|
|
|
@ -109,6 +109,7 @@ data GitConfig = GitConfig
|
|||
, annexSyncMigrations :: Bool
|
||||
, annexDebug :: Bool
|
||||
, annexDebugFilter :: Maybe String
|
||||
, annexUrl :: Maybe String
|
||||
, annexWebOptions :: [String]
|
||||
, annexYoutubeDlOptions :: [String]
|
||||
, annexYoutubeDlCommand :: Maybe String
|
||||
|
@ -204,6 +205,7 @@ extractGitConfig configsource r = GitConfig
|
|||
, annexSyncMigrations = getbool (annexConfig "syncmigrations") True
|
||||
, annexDebug = getbool (annexConfig "debug") False
|
||||
, annexDebugFilter = getmaybe (annexConfig "debugfilter")
|
||||
, annexUrl = getmaybe (annexConfig "url")
|
||||
, annexWebOptions = getwords (annexConfig "web-options")
|
||||
, annexYoutubeDlOptions = getwords (annexConfig "youtube-dl-options")
|
||||
, annexYoutubeDlCommand = getmaybe (annexConfig "youtube-dl-command")
|
||||
|
|
|
@ -1242,6 +1242,13 @@ repository, using [[git-annex-config]]. See its man page for a list.)
|
|||
After changing this config, you need to re-run `git-annex init` for it
|
||||
to take effect.
|
||||
|
||||
* `annex.url`
|
||||
|
||||
When a remote has a http url, the first time git-annex uses the remote
|
||||
it will check if it can download its `.git/config` file. If it is able
|
||||
to, and the file has this config set to an "annex+http" or "annex+https"
|
||||
url, that url will be copied into `remote.<name>.annexUrl`.
|
||||
|
||||
* `annex.resolvemerge`
|
||||
|
||||
Set to false to prevent merge conflicts in the checked out branch
|
||||
|
|
|
@ -15,22 +15,26 @@ You will still need to run a web server to serve the git repository.
|
|||
[[API|design/p2p_protocol_over_http]], and it does it
|
||||
on a different port (9417 by default).
|
||||
|
||||
All you need to do on the server is to arrange to run
|
||||
`git-annex p2phttp` in your repository as a daemon, or service.
|
||||
Note that it should not be run as root, but as whatever user owns the
|
||||
repository. It has several options you can use to configure it, including
|
||||
controlling who can access the repository.
|
||||
You will need to arrange to run `git-annex p2phttp` in your repository as a
|
||||
daemon or service. Note that it should not be run as root, but as whatever
|
||||
user owns the repository. It has several options you can use to configure
|
||||
it, including controlling who can access the repository.
|
||||
|
||||
After cloning a repository, it's necessary to configure
|
||||
`remote.name.annexUrl` to an "annex+http" or "annex+https" url,
|
||||
so that git-annex knows where the API endpoint is.
|
||||
So there are two web servers, and thus two different urls.
|
||||
A remote will have `remote.name.url` set to the http url
|
||||
that git will use, and also have `remote.name.annexUrl` set to the url
|
||||
that git-annex will use to talk to `git-annex p2phttp`. That url
|
||||
looks like this:
|
||||
|
||||
annex+http://example.com/git-annex/bbdac17e-6633-4b27-8f7b-fb447d5bae7c
|
||||
|
||||
For example:
|
||||
The "annex+http" (or "annex+https") indicates that it's a git-annex API
|
||||
url, which defaults to being on port 9417 unless a different port is set.
|
||||
And the last part of the url is the annex.uuid of the repository.
|
||||
|
||||
git clone http://example.com/foo.git
|
||||
cd foo
|
||||
git config remote.origin.annexUrl annex+http://example.com/git-annex/bbdac17e-6633-4b27-8f7b-fb447d5bae7c
|
||||
git-annex get ...
|
||||
|
||||
The last part of the "annex+http" url is the annex.uuid of the
|
||||
remote repository.
|
||||
It would be annoying if every user who cloned your repository
|
||||
had to set `remote.name.annexUrl` manually. So there's a way to automate it.
|
||||
In the git config file of the repository, set `annex.url` to the "annex+http"
|
||||
(or "annex+https") url. The first time it uses a http remote, git-annex
|
||||
downloads the git config file, and sets `remote.name.annexUrl` to the value
|
||||
of annex.url.
|
||||
|
|
|
@ -28,11 +28,6 @@ Planned schedule of work:
|
|||
|
||||
## work notes
|
||||
|
||||
* When getting the remote .git/config of a http remote, check if
|
||||
annex.apiurl is set, and if so, set the remote's annexUrl automically.
|
||||
|
||||
git-annex-p2phttp could automatically set annex.apiurl as well.
|
||||
|
||||
* An interrupted PUT to cluster that has a node that is a special remote
|
||||
over http leaves open the connection to the cluster, so the next request
|
||||
opens another one.
|
||||
|
|
Loading…
Reference in a new issue