aboutsummaryrefslogtreecommitdiffstats
path: root/builtin
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2024-06-14 06:42:03 -0400
committerJunio C Hamano <gitster@pobox.com>2024-06-14 09:34:39 -0700
commitaecd794fca275b42e271b80236e95f0d288bd709 (patch)
tree109cc0ab15551b45c7a98780c9d0b1da8db99572 /builtin
parentffce821880408768be21e08a02fecd686e780d01 (diff)
downloadgit-aecd794fca275b42e271b80236e95f0d288bd709.tar.gz
remote: drop checks for zero-url case
Now that the previous commit removed the possibility that a "struct remote" will ever have zero url fields, we can drop a number of redundant checks and untriggerable code paths. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/archive.c2
-rw-r--r--builtin/ls-remote.c2
-rw-r--r--builtin/push.c13
-rw-r--r--builtin/remote.c13
4 files changed, 5 insertions, 25 deletions
diff --git a/builtin/archive.c b/builtin/archive.c
index 0d9aff7e6f..7234607aaa 100644
--- a/builtin/archive.c
+++ b/builtin/archive.c
@@ -31,8 +31,6 @@ static int run_remote_archiver(int argc, const char **argv,
struct packet_reader reader;
_remote = remote_get(remote);
- if (!_remote->url.nr)
- die(_("git archive: Remote with no URL"));
transport = transport_get(_remote, _remote->url.v[0]);
transport_connect(transport, "git-upload-archive", exec, fd);
diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index 4c04dbbf19..8f3a64d838 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -109,8 +109,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
die("bad repository '%s'", dest);
die("No remote configured to list refs from.");
}
- if (!remote->url.nr)
- die("remote %s has no configured URL", dest);
if (get_url) {
printf("%s\n", remote->url.v[0]);
diff --git a/builtin/push.c b/builtin/push.c
index 00d99af1a8..8260c6e46a 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -438,18 +438,9 @@ static int do_push(int flags,
}
errs = 0;
url = push_url_of_remote(remote);
- if (url->nr) {
- for (i = 0; i < url->nr; i++) {
- struct transport *transport =
- transport_get(remote, url->v[i]);
- if (flags & TRANSPORT_PUSH_OPTIONS)
- transport->push_options = push_options;
- if (push_with_options(transport, push_refspec, flags))
- errs++;
- }
- } else {
+ for (i = 0; i < url->nr; i++) {
struct transport *transport =
- transport_get(remote, NULL);
+ transport_get(remote, url->v[i]);
if (flags & TRANSPORT_PUSH_OPTIONS)
transport->push_options = push_options;
if (push_with_options(transport, push_refspec, flags))
diff --git a/builtin/remote.c b/builtin/remote.c
index 06c09ed060..c5c94d4dbd 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1002,8 +1002,7 @@ static int get_remote_ref_states(const char *name,
struct transport *transport;
const struct ref *remote_refs;
- transport = transport_get(states->remote, states->remote->url.nr > 0 ?
- states->remote->url.v[0] : NULL);
+ transport = transport_get(states->remote, states->remote->url.v[0]);
remote_refs = transport_get_remote_refs(transport, NULL);
states->queried = 1;
@@ -1294,8 +1293,7 @@ static int show(int argc, const char **argv, const char *prefix)
get_remote_ref_states(*argv, &info.states, query_flag);
printf_ln(_("* remote %s"), *argv);
- printf_ln(_(" Fetch URL: %s"), info.states.remote->url.nr > 0 ?
- info.states.remote->url.v[0] : _("(no URL)"));
+ printf_ln(_(" Fetch URL: %s"), info.states.remote->url.v[0]);
url = push_url_of_remote(info.states.remote);
for (i = 0; i < url->nr; i++)
/*
@@ -1440,10 +1438,7 @@ static int prune_remote(const char *remote, int dry_run)
}
printf_ln(_("Pruning %s"), remote);
- printf_ln(_("URL: %s"),
- states.remote->url.nr
- ? states.remote->url.v[0]
- : _("(no URL)"));
+ printf_ln(_("URL: %s"), states.remote->url.v[0]);
for_each_string_list_item(item, &states.stale)
string_list_append(&refs_to_prune, item->util);
@@ -1632,8 +1627,6 @@ static int get_url(int argc, const char **argv, const char *prefix)
}
url = push_mode ? push_url_of_remote(remote) : &remote->url;
- if (!url->nr)
- die(_("no URLs configured for remote '%s'"), remotename);
if (all_mode) {
for (i = 0; i < url->nr; i++)