diff options
author | Daniel Barkalow <barkalow@iabervon.org> | 2009-03-11 01:47:20 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-03-10 23:14:20 -0700 |
commit | fa685bdf45cbaa997255cc78a23494b995e9769a (patch) | |
tree | 9d9105e85bc7477e6a4c93091c511f3191d22b60 /builtin-fetch.c | |
parent | 9a6682bab5e800465f0a4e44cdf18fe396ff4f6d (diff) | |
download | git-fa685bdf45cbaa997255cc78a23494b995e9769a.tar.gz git-fa685bdf45cbaa997255cc78a23494b995e9769a.tar.xz |
Give error when no remote is configured
When there's no explicitly-named remote, we use the remote specified
for the current branch, which in turn defaults to "origin". But it
this case should require the remote to actually be configured, and not
fall back to the path "origin".
Possibly, the config file's "remote = something" should require the
something to be a configured remote instead of a bare repository URL,
but we actually test with a bare repository URL.
In fetch, we were giving the sensible error message when coming up
with a URL failed, but this wasn't actually reachable, so move that
error up and use it when appropriate.
In push, we need a new error message, because the old one (formerly
unreachable without a lot of help) used the repo name, which was NULL.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-fetch.c')
-rw-r--r-- | builtin-fetch.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin-fetch.c b/builtin-fetch.c index 1e4a3d9c5..7fb35fca9 100644 --- a/builtin-fetch.c +++ b/builtin-fetch.c @@ -636,6 +636,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) else remote = remote_get(argv[0]); + if (!remote) + die("Where do you want to fetch from today?"); + transport = transport_get(remote, remote->url[0]); if (verbosity >= 2) transport->verbose = 1; @@ -648,9 +651,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) if (depth) set_option(TRANS_OPT_DEPTH, depth); - if (!transport->url) - die("Where do you want to fetch from today?"); - if (argc > 1) { int j = 0; refs = xcalloc(argc + 1, sizeof(const char *)); |