summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-06-20 21:47:27 -0700
committerJunio C Hamano <gitster@pobox.com>2009-06-20 21:47:27 -0700
commitdeded16d151ff0f7b80ed21a518928daff09c14c (patch)
tree3a835595f493e9894f84a43ac88d7e71c42f1cd4 /remote.c
parent974e6e42f7a66b69bd684af4f637ab064acfdf92 (diff)
parentce61595ea7eb3df22f6a943a38a273141f1af978 (diff)
downloadgit-deded16d151ff0f7b80ed21a518928daff09c14c.tar.gz
Merge branch 'mg/pushurl'
* mg/pushurl: avoid NULL dereference on failed malloc builtin-remote: Make "remote -v" display push urls builtin-remote: Show push urls as well technical/api-remote: Describe new struct remote member pushurl t5516: Check pushurl config setting Allow push and fetch urls to be different
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/remote.c b/remote.c
index 08a59644c0..9a0397ec57 100644
--- a/remote.c
+++ b/remote.c
@@ -106,6 +106,12 @@ static void add_url_alias(struct remote *remote, const char *url)
add_url(remote, alias_url(url));
}
+static void add_pushurl(struct remote *remote, const char *pushurl)
+{
+ ALLOC_GROW(remote->pushurl, remote->pushurl_nr + 1, remote->pushurl_alloc);
+ remote->pushurl[remote->pushurl_nr++] = pushurl;
+}
+
static struct remote *make_remote(const char *name, int len)
{
struct remote *ret;
@@ -379,6 +385,11 @@ static int handle_config(const char *key, const char *value, void *cb)
if (git_config_string(&v, key, value))
return -1;
add_url(remote, v);
+ } else if (!strcmp(subkey, ".pushurl")) {
+ const char *v;
+ if (git_config_string(&v, key, value))
+ return -1;
+ add_pushurl(remote, v);
} else if (!strcmp(subkey, ".push")) {
const char *v;
if (git_config_string(&v, key, value))
@@ -424,6 +435,9 @@ static void alias_all_urls(void)
for (j = 0; j < remotes[i]->url_nr; j++) {
remotes[i]->url[j] = alias_url(remotes[i]->url[j]);
}
+ for (j = 0; j < remotes[i]->pushurl_nr; j++) {
+ remotes[i]->pushurl[j] = alias_url(remotes[i]->pushurl[j]);
+ }
}
}