Now you can store your remote information in the config file like this: [remote.upstream] url = me@xxxxxxxxxxx:the-project push = master:iceballs Signed-off-by: Johannes Schindelin <Johannes.Schindelin@xxxxxx> --- Obviously, this is on top of the patch to parse Pull: lines, too. builtin-push.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) e55eb69f6332087c45082e16ccbf4e510d721e29 diff --git a/builtin-push.c b/builtin-push.c index 4e659f0..e3131ed 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -72,6 +72,36 @@ #define MAX_REFSPECS 10 static int current_refspec = 0; static char *refspecs_[MAX_REFSPECS]; +static int repo_len = 0; +static const char *repo_ = NULL; +static int current_uri = 0; +static const char **uri_; + +static int get_value(const char* key, const char* value) +{ + if (!strncmp(key, "remote.", 7) && !strncmp(key + 7, repo_, repo_len)) { + if (!strcmp(key + 7 + repo_len, ".url")) + uri_[current_uri++] = strdup(value); + else if (!strcmp(key + 7 + repo_len, ".push") + && current_refspec < MAX_REFSPECS) + refspecs_[current_refspec++] = strdup(value); + } + + return 0; +} + +static int get_config_remotes_uri(const char *repo, const char *uri[MAX_URI]) +{ + repo_len = strlen(repo); + repo_ = repo; + current_uri = 0; + uri_ = uri; + + git_config(get_value); + + return current_uri; +} + static int get_remotes_uri(const char *repo, const char *uri[MAX_URI]) { int n = 0; @@ -153,6 +183,9 @@ static int get_uri(const char *repo, con if (*repo != '/') { current_refspec = 0; + n = get_config_remotes_uri(repo, uri); + if (n > 0) + return n; n = get_remotes_uri(repo, uri); if (n > 0) return n; -- 1.3.1.g38c00-dirty - : send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html