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.
|
-- optimisation.
|
||||||
unless (fromMaybe False $ Git.Config.isBare r') $
|
unless (fromMaybe False $ Git.Config.isBare r') $
|
||||||
setremote setRemoteBare False
|
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'
|
return r'
|
||||||
Left err -> do
|
Left err -> do
|
||||||
set_ignore "not usable by git-annex" False
|
set_ignore "not usable by git-annex" False
|
||||||
|
|
|
@ -109,6 +109,7 @@ data GitConfig = GitConfig
|
||||||
, annexSyncMigrations :: Bool
|
, annexSyncMigrations :: Bool
|
||||||
, annexDebug :: Bool
|
, annexDebug :: Bool
|
||||||
, annexDebugFilter :: Maybe String
|
, annexDebugFilter :: Maybe String
|
||||||
|
, annexUrl :: Maybe String
|
||||||
, annexWebOptions :: [String]
|
, annexWebOptions :: [String]
|
||||||
, annexYoutubeDlOptions :: [String]
|
, annexYoutubeDlOptions :: [String]
|
||||||
, annexYoutubeDlCommand :: Maybe String
|
, annexYoutubeDlCommand :: Maybe String
|
||||||
|
@ -204,6 +205,7 @@ extractGitConfig configsource r = GitConfig
|
||||||
, annexSyncMigrations = getbool (annexConfig "syncmigrations") True
|
, annexSyncMigrations = getbool (annexConfig "syncmigrations") True
|
||||||
, annexDebug = getbool (annexConfig "debug") False
|
, annexDebug = getbool (annexConfig "debug") False
|
||||||
, annexDebugFilter = getmaybe (annexConfig "debugfilter")
|
, annexDebugFilter = getmaybe (annexConfig "debugfilter")
|
||||||
|
, annexUrl = getmaybe (annexConfig "url")
|
||||||
, annexWebOptions = getwords (annexConfig "web-options")
|
, annexWebOptions = getwords (annexConfig "web-options")
|
||||||
, annexYoutubeDlOptions = getwords (annexConfig "youtube-dl-options")
|
, annexYoutubeDlOptions = getwords (annexConfig "youtube-dl-options")
|
||||||
, annexYoutubeDlCommand = getmaybe (annexConfig "youtube-dl-command")
|
, 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
|
After changing this config, you need to re-run `git-annex init` for it
|
||||||
to take effect.
|
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`
|
* `annex.resolvemerge`
|
||||||
|
|
||||||
Set to false to prevent merge conflicts in the checked out branch
|
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
|
[[API|design/p2p_protocol_over_http]], and it does it
|
||||||
on a different port (9417 by default).
|
on a different port (9417 by default).
|
||||||
|
|
||||||
All you need to do on the server is to arrange to run
|
You will need to arrange to run `git-annex p2phttp` in your repository as a
|
||||||
`git-annex p2phttp` in your repository as a daemon, or service.
|
daemon or service. Note that it should not be run as root, but as whatever
|
||||||
Note that it should not be run as root, but as whatever user owns the
|
user owns the repository. It has several options you can use to configure
|
||||||
repository. It has several options you can use to configure it, including
|
it, including controlling who can access the repository.
|
||||||
controlling who can access the repository.
|
|
||||||
|
|
||||||
After cloning a repository, it's necessary to configure
|
So there are two web servers, and thus two different urls.
|
||||||
`remote.name.annexUrl` to an "annex+http" or "annex+https" url,
|
A remote will have `remote.name.url` set to the http url
|
||||||
so that git-annex knows where the API endpoint is.
|
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:
|
||||||
|
|
||||||
For example:
|
annex+http://example.com/git-annex/bbdac17e-6633-4b27-8f7b-fb447d5bae7c
|
||||||
|
|
||||||
git clone http://example.com/foo.git
|
The "annex+http" (or "annex+https") indicates that it's a git-annex API
|
||||||
cd foo
|
url, which defaults to being on port 9417 unless a different port is set.
|
||||||
git config remote.origin.annexUrl annex+http://example.com/git-annex/bbdac17e-6633-4b27-8f7b-fb447d5bae7c
|
And the last part of the url is the annex.uuid of the repository.
|
||||||
git-annex get ...
|
|
||||||
|
|
||||||
The last part of the "annex+http" url is the annex.uuid of the
|
It would be annoying if every user who cloned your repository
|
||||||
remote 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
|
## 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
|
* 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
|
over http leaves open the connection to the cluster, so the next request
|
||||||
opens another one.
|
opens another one.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue