X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin%2Fls-remote.c;h=34480cfad6a8842d65ae61f6257c597a2a987b33;hb=48c250a121a425a1860226b6a7061aecfbab5246;hp=70f5622d9d49aae4080b38ee4487cc6e403a9d2c;hpb=b2a60953085651fe892ee20508fe2f561f0bba8f;p=git.git diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 70f5622d9..34480cfad 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -4,7 +4,8 @@ #include "remote.h" static const char ls_remote_usage[] = -"git ls-remote [--heads] [--tags] [-u | --upload-pack ] ..."; +"git ls-remote [--heads] [--tags] [-u | --upload-pack ]\n" +" [-q|--quiet] [ [...]]"; /* * Is there one among the list of patterns that match the tail part @@ -33,6 +34,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) const char *dest = NULL; int nongit; unsigned flags = 0; + int quiet = 0; const char *uploadpack = NULL; const char **pattern = NULL; @@ -66,6 +68,10 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) flags |= REF_NORMAL; continue; } + if (!strcmp("--quiet", arg) || !strcmp("-q", arg)) { + quiet = 1; + continue; + } usage(ls_remote_usage); } dest = arg; @@ -73,9 +79,6 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) break; } - if (!dest) - usage(ls_remote_usage); - if (argv[i]) { int j; pattern = xcalloc(sizeof(const char *), argc - i + 1); @@ -87,6 +90,11 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) } } remote = remote_get(dest); + if (!remote) { + if (dest) + 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); transport = transport_get(remote, NULL); @@ -96,6 +104,9 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix) ref = transport_get_remote_refs(transport); if (transport_disconnect(transport)) return 1; + + if (!dest && !quiet) + fprintf(stderr, "From %s\n", *remote->url); for ( ; ref; ref = ref->next) { if (!check_ref_type(ref, flags)) continue;