{"thread":{"id":"12188","subject":"[PATCH 2/2] Add support for host aliases in config files","startedAt":"2008-02-19T04:28:38Z","lastAt":"2008-02-20T19:44:53Z","messageCount":11,"participants":["Daniel Barkalow","Jon Loeliger","Johannes Schindelin","Junio C Hamano","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"69230","messageId":"alpine.LNX.1.00.0802182317520.5816@iabervon.org","threadId":"12188","inReplyTo":null,"subject":"[PATCH 2/2] Add support for host aliases in config files","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-02-19T04:28:38Z","receivedAt":"2008-02-19T04:28:38Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"This allows users with different preferences for access methods to the\nsame remote repositories to rewrite each other's URLs by pattern\nmatching across a large set of similiarly set up repositories to each\nget the desired access.\n\nFor example, if you don't have a kernel.org account, you might want\nsettings like:\n\n[host \"kernel.org\"]\n      base = git://git.kernel.org/pub/\n      rewritebase = master.kernel.org:/pub\n\nThen, if you give git a URL like:\n\n  master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git\n\nit will act like you gave it:\n\n  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git\n\nand you can cut-and-paste pull requests in email without fixing them\nby hand, for example.\n\nSigned-off-by: Daniel Barkalow <barkalow@iabervon.org>\n---\nI believe this takes care of all the comments I've gotten on this patch.\n\nI looked at how the documentation appears in (for example) git-fetch.1 \nwith the change to urls.txt, and it looks informative to me and not \nunbalanced. Of course, in order to be perfectly accurate, git clone needs \nto be converted to using the same code as everything else, because it \nwon't yet actually support these alises, unfortunately for my dreams of \nbeing able to set up a default host and then have \"git clone :module\" work.\n\n Documentation/config.txt |   23 ++++++++++\n Documentation/urls.txt   |   25 +++++++++++\n remote.c                 |  102 ++++++++++++++++++++++++++++++++++++++++++++-\n 3 files changed, 147 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex f2f6a77..7a9cba4 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -646,6 +646,29 @@ help.format::\n \tValues 'man', 'info', 'web' and 'html' are supported. 'man' is\n \tthe default. 'web' and 'html' are the same.\n \n+host.<name>.*::\n+\tThese options provide a way to rewrite URLs when there is a\n+\tpattern of URLs with a common prefix which should be replaced\n+\twith a different prefix. For every 'rewritebase' prefix given,\n+\tany URL git receives that starts with that prefix will be\n+\trewritten to have the 'base' prefix instead. In cases where\n+\tsome site serves a large number of repositories, and serves\n+\tthem with multiple access methods, and some users need to use\n+\tdifferent access methods, this feature allows people to\n+\tspecify any of the equivalent URLs and have git automatically\n+\trewrite the URL to the best alternative for the particular\n+\tuser, even for a never-before-seen repository on the site. The\n+\teffect of multiple matching rewritebase prefixes is undefined.\n+\n+host.<name>.base::\n+\tThe base URL which should be used for this particular\n+\thost.\n+\n+host.<name>.rewritebase::\n+\tAdditional base URLs which refer to this host. If a URL\n+\tmatches this, any access to it will use the URL formed with\n+\tthe corresponding base URL instead of the given URL.\n+\n http.proxy::\n \tOverride the HTTP proxy, normally configured using the 'http_proxy'\n \tenvironment variable (see linkgit:curl[1]).  This can be overridden\ndiff --git a/Documentation/urls.txt b/Documentation/urls.txt\nindex 81ac17f..11c05db 100644\n--- a/Documentation/urls.txt\n+++ b/Documentation/urls.txt\n@@ -44,3 +44,28 @@ endif::git-clone[]\n ifdef::git-clone[]\n They are equivalent, except the former implies --local option.\n endif::git-clone[]\n+\n+\n+If there are a large number of similarly-named remote repositories and\n+you want to use a different format for them (such that the URLs you\n+use will be rewritten into URLs that work), you can create a\n+configuration section of the form:\n+\n+------------\n+\t[host \"<host>\"]\n+\t\tbase = <actual url base>\n+\t\trewritebase = <other url base>\n+------------\n+\n+If you have a section:\n+\n+------------\n+\t[host \"xz\"]\n+\t\tbase = git://git.host.xz/\n+\t\trewritebase = host.xz:/path/to/\n+\t\trewritebase = work:\n+------------\n+\n+a URL like \"work:repo.git\" or like \"host.xz:/path/to/repo.git\" will be\n+rewritten in any context that takes a URL to be\n+\"git://git.host.xz/repo.git\".\ndiff --git a/remote.c b/remote.c\nindex 457d8a4..fc83e2d 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -2,6 +2,14 @@\n #include \"remote.h\"\n #include \"refs.h\"\n \n+struct host {\n+\tconst char *name;\n+\tconst char *base;\n+\tconst char **alias;\n+\tint alias_nr;\n+\tint alias_alloc;\n+};\n+\n static struct remote **remotes;\n static int remotes_alloc;\n static int remotes_nr;\n@@ -13,9 +21,33 @@ static int branches_nr;\n static struct branch *current_branch;\n static const char *default_remote_name;\n \n+static struct host **hosts;\n+static int hosts_alloc;\n+static int hosts_nr;\n+\n #define BUF_SIZE (2048)\n static char buffer[BUF_SIZE];\n \n+static const char *alias_url(const char *url)\n+{\n+\tint i, j;\n+\tfor (i = 0; i < hosts_nr; i++) {\n+\t\tif (!hosts[i])\n+\t\t\tcontinue;\n+\t\tfor (j = 0; j < hosts[i]->alias_nr; j++) {\n+\t\t\tif (!prefixcmp(url, hosts[i]->alias[j])) {\n+\t\t\t\tchar *ret = malloc(strlen(hosts[i]->base) -\n+\t\t\t\t\t\t   strlen(hosts[i]->alias[j]) +\n+\t\t\t\t\t\t   strlen(url) + 1);\n+\t\t\t\tstrcpy(ret, hosts[i]->base);\n+\t\t\t\tstrcat(ret, url + strlen(hosts[i]->alias[j]));\n+\t\t\t\treturn ret;\n+\t\t\t}\n+\t\t}\n+\t}\n+\treturn url;\n+}\n+\n static void add_push_refspec(struct remote *remote, const char *ref)\n {\n \tALLOC_GROW(remote->push_refspec,\n@@ -38,6 +70,11 @@ static void add_url(struct remote *remote, const char *url)\n \tremote->url[remote->url_nr++] = url;\n }\n \n+static void add_url_alias(struct remote *remote, const char *url)\n+{\n+\tadd_url(remote, alias_url(url));\n+}\n+\n static struct remote *make_remote(const char *name, int len)\n {\n \tstruct remote *ret;\n@@ -95,6 +132,35 @@ static struct branch *make_branch(const char *name, int len)\n \treturn ret;\n }\n \n+static struct host *make_host(const char *name, int len)\n+{\n+\tstruct host *ret;\n+\tint i;\n+\n+\tfor (i = 0; i < hosts_nr; i++) {\n+\t\tif (len ? (!strncmp(name, hosts[i]->name, len) &&\n+\t\t\t   !hosts[i]->name[len]) :\n+\t\t    !strcmp(name, hosts[i]->name))\n+\t\t\treturn hosts[i];\n+\t}\n+\n+\tALLOC_GROW(hosts, hosts_nr + 1, hosts_alloc);\n+\tret = xcalloc(1, sizeof(struct host));\n+\thosts[hosts_nr++] = ret;\n+\tif (len)\n+\t\tret->name = xstrndup(name, len);\n+\telse\n+\t\tret->name = xstrdup(name);\n+\n+\treturn ret;\n+}\n+\n+static void add_alias(struct host *host, const char *name)\n+{\n+\tALLOC_GROW(host->alias, host->alias_nr + 1, host->alias_alloc);\n+\thost->alias[host->alias_nr++] = name;\n+}\n+\n static void read_remotes_file(struct remote *remote)\n {\n \tFILE *f = fopen(git_path(\"remotes/%s\", remote->name), \"r\");\n@@ -128,7 +194,7 @@ static void read_remotes_file(struct remote *remote)\n \n \t\tswitch (value_list) {\n \t\tcase 0:\n-\t\t\tadd_url(remote, xstrdup(s));\n+\t\t\tadd_url_alias(remote, xstrdup(s));\n \t\t\tbreak;\n \t\tcase 1:\n \t\t\tadd_push_refspec(remote, xstrdup(s));\n@@ -180,7 +246,7 @@ static void read_branches_file(struct remote *remote)\n \t} else {\n \t\tbranch = \"refs/heads/master\";\n \t}\n-\tadd_url(remote, p);\n+\tadd_url_alias(remote, p);\n \tadd_fetch_refspec(remote, branch);\n \tremote->fetch_tags = 1; /* always auto-follow */\n }\n@@ -210,6 +276,23 @@ static int handle_config(const char *key, const char *value)\n \t\t}\n \t\treturn 0;\n \t}\n+\tif (!prefixcmp(key, \"host.\")) {\n+\t\tstruct host *host;\n+\t\tname = key + 5;\n+\t\tsubkey = strrchr(name, '.');\n+\t\tif (!subkey)\n+\t\t\treturn 0;\n+\t\thost = make_host(name, subkey - name);\n+\t\tif (!strcmp(subkey, \".base\")) {\n+\t\t\tif (!value)\n+\t\t\t\treturn config_error_nonbool(key);\n+\t\t\thost->base = xstrdup(value);\n+\t\t} else if (!strcmp(subkey, \".rewritebase\")) {\n+\t\t\tif (!value)\n+\t\t\t\treturn config_error_nonbool(key);\n+\t\t\tadd_alias(host, xstrdup(value));\n+\t\t}\n+\t}\n \tif (prefixcmp(key,  \"remote.\"))\n \t\treturn 0;\n \tname = key + 7;\n@@ -261,6 +344,18 @@ static int handle_config(const char *key, const char *value)\n \treturn 0;\n }\n \n+static void alias_all_urls(void)\n+{\n+\tint i, j;\n+\tfor (i = 0; i < remotes_nr; i++) {\n+\t\tif (!remotes[i])\n+\t\t\tcontinue;\n+\t\tfor (j = 0; j < remotes[i]->url_nr; j++) {\n+\t\t\tremotes[i]->url[j] = alias_url(remotes[i]->url[j]);\n+\t\t}\n+\t}\n+}\n+\n static void read_config(void)\n {\n \tunsigned char sha1[20];\n@@ -277,6 +372,7 @@ static void read_config(void)\n \t\t\tmake_branch(head_ref + strlen(\"refs/heads/\"), 0);\n \t}\n \tgit_config(handle_config);\n+\talias_all_urls();\n }\n \n struct refspec *parse_ref_spec(int nr_refspec, const char **refspec)\n@@ -342,7 +438,7 @@ struct remote *remote_get(const char *name)\n \t\t\tread_branches_file(ret);\n \t}\n \tif (!ret->url)\n-\t\tadd_url(ret, name);\n+\t\tadd_url_alias(ret, name);\n \tif (!ret->url)\n \t\treturn NULL;\n \tret->fetch = parse_ref_spec(ret->fetch_refspec_nr, ret->fetch_refspec);\n-- \n1.5.4.1.191.gfbf10\n"},{"id":"69271","messageId":"47BAF18F.5040709@freescale.com","threadId":"12188","inReplyTo":"alpine.LNX.1.00.0802182317520.5816@iabervon.org","subject":"Re: [PATCH 2/2] Add support for host aliases in config files","fromName":"Jon Loeliger","fromEmail":"jdl@freescale.com","sentAt":"2008-02-19T15:11:11Z","receivedAt":"2008-02-19T15:11:11Z","isPatch":true,"sender":{"key":"jdl@jdl.com","avatar":"https://gravatar.com/avatar/75ce9a10b151acd2c28ec4ab2136dba7b2ff1634530bd04b155981a749d08a64?d=mp&s=160"},"body":"Daniel Barkalow wrote:\n> This allows users with different preferences for access methods to the\n> same remote repositories to rewrite each other's URLs by pattern\n> matching across a large set of similiarly set up repositories to each\n> get the desired access.\n> \n> For example, if you don't have a kernel.org account, you might want\n> settings like:\n> \n> [host \"kernel.org\"]\n>       base = git://git.kernel.org/pub/\n>       rewritebase = master.kernel.org:/pub\n> \n> Then, if you give git a URL like:\n> \n>   master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git\n> \n> it will act like you gave it:\n> \n>   git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git\n> \n> and you can cut-and-paste pull requests in email without fixing them\n> by hand, for example.\n> \n> Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>\n> ---\n\nSo, I may be dense, but I'm having a hard time distinguishing\nthe names \"base\" and \"rewritebase\" just from a User Interface\nperspective.  It's not clear to me which of those is the A and\nwhich is the B part in s/A/B/.  \"Rewritebase\" might be the \"from\"\nbasis, or it might be the \"to\" basis.  Can we come up with more\ndescriptive property names here?\n\nIs the rewrite always just prefix substitution/replacement?\nWhat if there was some generic path rewrite needed? (KISS? :-))\n\nAlso, is \"host\" really the right config key?  Maybe \"rewritehost\"?\nOr is this thought to be the basis of other (perhaps not rewrite\nrelated) properties of the same host as well?\n\nMaybe it's just me.\n\nThanks,\njdl\n"},{"id":"69275","messageId":"alpine.LSU.1.00.0802191547580.30505@racer.site","threadId":"12188","inReplyTo":"47BAF18F.5040709@freescale.com","subject":"Re: [PATCH 2/2] Add support for host aliases in config files","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-19T15:49:34Z","receivedAt":"2008-02-19T15:49:34Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 19 Feb 2008, Jon Loeliger wrote:\n\n> Daniel Barkalow wrote:\n>\n> > For example, if you don't have a kernel.org account, you might want \n> > settings like:\n> > \n> > [host \"kernel.org\"]\n> >       base = git://git.kernel.org/pub/\n> >       rewritebase = master.kernel.org:/pub\n> > \n> > Then, if you give git a URL like:\n> > \n> >   master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git\n> > \n> > it will act like you gave it:\n> > \n> >   git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git\n> > \n> > and you can cut-and-paste pull requests in email without fixing them \n> > by hand, for example.\n> > \n> > Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>\n> > ---\n> \n> So, I may be dense, but I'm having a hard time distinguishing the names \n> \"base\" and \"rewritebase\" just from a User Interface perspective.  It's \n> not clear to me which of those is the A and which is the B part in \n> s/A/B/.  \"Rewritebase\" might be the \"from\" basis, or it might be the \n> \"to\" basis.  Can we come up with more descriptive property names here?\n> \n> Is the rewrite always just prefix substitution/replacement?\n> What if there was some generic path rewrite needed? (KISS? :-))\n\nI just tried this:\n\n$ git config rewrite.\"master.kernel.org:/pub\".url \\\n\tgit://git.kernel.org/pub/\n\nand it worked.  IOW, the config will look like this:\n\n[rewrite \"master.kernel.org:/pub\"]\n        url = git://git.kernel.org/pub/\n\nSo maybe this is easier to grasp?\n\nCiao,\nDscho\n"},{"id":"69290","messageId":"alpine.LNX.1.00.0802191127080.19024@iabervon.org","threadId":"12188","inReplyTo":"47BAF18F.5040709@freescale.com","subject":"Re: [PATCH 2/2] Add support for host aliases in config files","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-02-19T16:45:03Z","receivedAt":"2008-02-19T16:45:03Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Tue, 19 Feb 2008, Jon Loeliger wrote:\n\n> Daniel Barkalow wrote:\n> > This allows users with different preferences for access methods to the\n> > same remote repositories to rewrite each other's URLs by pattern\n> > matching across a large set of similiarly set up repositories to each\n> > get the desired access.\n> > \n> > For example, if you don't have a kernel.org account, you might want\n> > settings like:\n> > \n> > [host \"kernel.org\"]\n> >       base = git://git.kernel.org/pub/\n> >       rewritebase = master.kernel.org:/pub\n> > \n> > Then, if you give git a URL like:\n> > \n> >   master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git\n> > \n> > it will act like you gave it:\n> > \n> >   git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git\n> > \n> > and you can cut-and-paste pull requests in email without fixing them\n> > by hand, for example.\n> > \n> > Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>\n> > ---\n> \n> So, I may be dense, but I'm having a hard time distinguishing\n> the names \"base\" and \"rewritebase\" just from a User Interface\n> perspective.  It's not clear to me which of those is the A and\n> which is the B part in s/A/B/.  \"Rewritebase\" might be the \"from\"\n> basis, or it might be the \"to\" basis.  Can we come up with more\n> descriptive property names here?\n\nrewritebase is the base you rewrite, which follows apache usage (which is \nwhere somebody got the term to suggest in an earlier round). It seems like \nit should be clear; am I obfuscating it by showing the options in the more \nbackwards order in the examples? If you've got an idea that people find \nmore clear, I'd be happy to change it (again).\n\n> Is the rewrite always just prefix substitution/replacement?\n> What if there was some generic path rewrite needed? (KISS? :-))\n\nIt's just prefix substitution. I suppose a future version could do \nsomething more clever (but it would probably also use variables named \n\"pattern\" instead of \"base\", so there shouldn't be any issues).\n\n> Also, is \"host\" really the right config key?  Maybe \"rewritehost\"?\n> Or is this thought to be the basis of other (perhaps not rewrite\n> related) properties of the same host as well?\n\nI think it's likely that other properties of the host could show up. I \nsuspect that uploadpack and receivepack would be useful host-wide if you \nwere using a lot of ad-hoc repository names on a big site. Rewriting the \nURLs is just the itch I had with this scope.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"69293","messageId":"alpine.LNX.1.00.0802191146000.19024@iabervon.org","threadId":"12188","inReplyTo":"alpine.LSU.1.00.0802191547580.30505@racer.site","subject":"Re: [PATCH 2/2] Add support for host aliases in config files","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-02-19T16:52:51Z","receivedAt":"2008-02-19T16:52:51Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Tue, 19 Feb 2008, Johannes Schindelin wrote:\n\n> Hi,\n> \n> On Tue, 19 Feb 2008, Jon Loeliger wrote:\n> \n> > Daniel Barkalow wrote:\n> >\n> > > For example, if you don't have a kernel.org account, you might want \n> > > settings like:\n> > > \n> > > [host \"kernel.org\"]\n> > >       base = git://git.kernel.org/pub/\n> > >       rewritebase = master.kernel.org:/pub\n> > > \n> > > Then, if you give git a URL like:\n> > > \n> > >   master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git\n> > > \n> > > it will act like you gave it:\n> > > \n> > >   git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git\n> > > \n> > > and you can cut-and-paste pull requests in email without fixing them \n> > > by hand, for example.\n> > > \n> > > Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>\n> > > ---\n> > \n> > So, I may be dense, but I'm having a hard time distinguishing the names \n> > \"base\" and \"rewritebase\" just from a User Interface perspective.  It's \n> > not clear to me which of those is the A and which is the B part in \n> > s/A/B/.  \"Rewritebase\" might be the \"from\" basis, or it might be the \n> > \"to\" basis.  Can we come up with more descriptive property names here?\n> > \n> > Is the rewrite always just prefix substitution/replacement?\n> > What if there was some generic path rewrite needed? (KISS? :-))\n> \n> I just tried this:\n> \n> $ git config rewrite.\"master.kernel.org:/pub\".url \\\n> \tgit://git.kernel.org/pub/\n> \n> and it worked.  IOW, the config will look like this:\n> \n> [rewrite \"master.kernel.org:/pub\"]\n>         url = git://git.kernel.org/pub/\n> \n> So maybe this is easier to grasp?\n\nIf you've also got people using http:// URLs, this would require giving \nthe preferred URL twice. And it doesn't help with possible future \nhost-based configuration, or a non-prefix pattern, if that came up some \nday.\n\nI suppose perhaps:\n\n[host \"git://git.kernel.org/pub/\"]\n\taka = \"master.kernel.org:/pub/\"\n\taka = \"http://www.kernel.org/pub/\"\n\nI'm a little worried about putting URLs in keys, but I don't know if \nthat's a reasonable worry.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"69317","messageId":"7vy79ghbob.fsf@gitster.siamese.dyndns.org","threadId":"12188","inReplyTo":"alpine.LNX.1.00.0802191127080.19024@iabervon.org","subject":"Re: [PATCH 2/2] Add support for host aliases in config files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-19T21:35:32Z","receivedAt":"2008-02-19T21:35:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Barkalow <barkalow@iabervon.org> writes:\n\n> On Tue, 19 Feb 2008, Jon Loeliger wrote:\n>\n>> Also, is \"host\" really the right config key?  Maybe \"rewritehost\"?\n>> Or is this thought to be the basis of other (perhaps not rewrite\n>> related) properties of the same host as well?\n>\n> I think it's likely that other properties of the host could show up. I \n> suspect that uploadpack and receivepack would be useful host-wide if you \n> were using a lot of ad-hoc repository names on a big site. Rewriting the \n> URLs is just the itch I had with this scope.\n\nI'd agree that per-host configuration may be useful, and your\n\"paths to programs\" may be a good example.  But I think it is\nplausible that a host needs multiple <rewritefrom,rewriteto>\ntuples.  Either your '[host \"$this_url\"] aka = $that_url' or\nDscho's earlier '[rewrite \"$this_url_to\"] url = $that_url' shows\nthat this is not about host but \"prefix part of URL\".\n"},{"id":"69337","messageId":"alpine.LNX.1.00.0802191856420.19024@iabervon.org","threadId":"12188","inReplyTo":"7vy79ghbob.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 2/2] Add support for host aliases in config files","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-02-20T00:02:04Z","receivedAt":"2008-02-20T00:02:04Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Tue, 19 Feb 2008, Junio C Hamano wrote:\n\n> Daniel Barkalow <barkalow@iabervon.org> writes:\n> \n> > On Tue, 19 Feb 2008, Jon Loeliger wrote:\n> >\n> >> Also, is \"host\" really the right config key?  Maybe \"rewritehost\"?\n> >> Or is this thought to be the basis of other (perhaps not rewrite\n> >> related) properties of the same host as well?\n> >\n> > I think it's likely that other properties of the host could show up. I \n> > suspect that uploadpack and receivepack would be useful host-wide if you \n> > were using a lot of ad-hoc repository names on a big site. Rewriting the \n> > URLs is just the itch I had with this scope.\n> \n> I'd agree that per-host configuration may be useful, and your\n> \"paths to programs\" may be a good example.  But I think it is\n> plausible that a host needs multiple <rewritefrom,rewriteto>\n> tuples.\n\nThat's probably true, even taking into account the option of having \nmultiple froms for the same to.\n\n> Either your '[host \"$this_url\"] aka = $that_url' or\n> Dscho's earlier '[rewrite \"$this_url_to\"] url = $that_url' shows\n> that this is not about host but \"prefix part of URL\".\n\nWell, it shows that it's *possible* to do this feature that way, although \nI'm not entirely convinced that it's best to do it like that. Are there \ncharacter set concerns with having urls in config keys?\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"69346","messageId":"alpine.LSU.1.00.0802200156560.8333@wbgn129.biozentrum.uni-wuerzburg.de","threadId":"12188","inReplyTo":"alpine.LNX.1.00.0802191856420.19024@iabervon.org","subject":"Re: [PATCH 2/2] Add support for host aliases in config files","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-20T01:01:34Z","receivedAt":"2008-02-20T01:01:34Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 19 Feb 2008, Daniel Barkalow wrote:\n\n> On Tue, 19 Feb 2008, Junio C Hamano wrote:\n> \n> > Either your '[host \"$this_url\"] aka = $that_url' or\n> > Dscho's earlier '[rewrite \"$this_url_to\"] url = $that_url' shows\n> > that this is not about host but \"prefix part of URL\".\n> \n> Well, it shows that it's *possible* to do this feature that way, \n> although I'm not entirely convinced that it's best to do it like that. \n\nI think in the interest of simplicity, you do not want to have an extra \n(arbitrary) key.\n\n> Are there character set concerns with having urls in config keys?\n\nI think not.  AFAICT the \"extended base var\" is allowed anything except \nfor newlines.  Everything else you can get at least escaped with '\\'.  If \nin doubt, consult get_extended_base_var() in config.c.\n\nHth,\nDscho\n"},{"id":"69348","messageId":"7vve4ke8up.fsf@gitster.siamese.dyndns.org","threadId":"12188","inReplyTo":"alpine.LSU.1.00.0802200156560.8333@wbgn129.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH 2/2] Add support for host aliases in config files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-20T01:04:46Z","receivedAt":"2008-02-20T01:04:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> ...  If \n> in doubt, consult get_extended_base_var() in config.c.\n\nPerhaps it is time for Documentation/technical/api-config.txt\n;-)?\n"},{"id":"69352","messageId":"alpine.LSU.1.00.0802200214140.8333@wbgn129.biozentrum.uni-wuerzburg.de","threadId":"12188","inReplyTo":"7vve4ke8up.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 2/2] Add support for host aliases in config files","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-20T01:14:46Z","receivedAt":"2008-02-20T01:14:46Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 19 Feb 2008, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > ...  If in doubt, consult get_extended_base_var() in config.c.\n> \n> Perhaps it is time for Documentation/technical/api-config.txt ;-)?\n\n*winces* I try to find the time...\n\nSorry,\nDscho\n"},{"id":"69397","messageId":"200802202044.54987.jnareb@gmail.com","threadId":"12188","inReplyTo":"alpine.LSU.1.00.0802191547580.30505@racer.site","subject":"Re: [PATCH 2/2] Add support for host aliases in config files","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-02-20T19:44:53Z","receivedAt":"2008-02-20T19:44:53Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Johannes Schindelin wrotr:\n \n> I just tried this:\n> \n> $ git config rewrite.\"master.kernel.org:/pub\".url \\\n> \tgit://git.kernel.org/pub/\n> \n> and it worked.  IOW, the config will look like this:\n> \n> [rewrite \"master.kernel.org:/pub\"]\n>         url = git://git.kernel.org/pub/\n> \n> So maybe this is easier to grasp?\n\nPerhaps that it is easier to grasp, but imho it is backwards,\nas it is inherently 1 -> 1 in <original> -> <rewritten>,\nwhile I think it is more common to have n -> 1, i.e. multiple\nURLs (aliases), multiple alternative \"spellings\" with one\ntried way to access repository.\n\n-- \nJakub Narebski\nPoland\n"}]}