git-remote: show all remotes with "git remote show"
Many other commands use the "no arguments" form to show a list (e.g., git-branch, git-tag). While we did show all remotes for just "git remote", we displayed a usage error for "git remote show" with no arguments. This is counterintuitive, since by giving it _more_ information, we get _less_ result. The usage model can now be thought of as: - "git remote show <remote>": show a remote - "git remote show": show all remotes - "git remote": assume "show"; i.e., shorthand for "git remote show" Signed-off-by: Jeff King <peff@peff.net> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Apr 9, 2008 at 11:15 UTC
c4112bb6bbc83708c7b54deac0928e66b4de2302
1 file changed
+6
-1
builtin-remote.c
+6
-1
@@ -19,6 +19,8 @@ static const char * const builtin_remote_usage[] = {
19
20
static int verbose;
21
22
+static int show_all(void);
23
+
24
static inline int postfixcmp(const char *string, const char *postfix)
25
{
26
int len1 = strlen(string), len2 = strlen(postfix);
@@ -380,8 +382,11 @@ static int show_or_prune(int argc, const char **argv, int prune)
382
383
argc = parse_options(argc, argv, options, builtin_remote_usage, 0);
384
383
- if (argc < 1)
385
+ if (argc < 1) {
386
+ if (!prune)
387
+ return show_all();
388
usage_with_options(builtin_remote_usage, options);
389
+ }
390
391
memset(&states, 0, sizeof(states));
392
for (; argc; argc--, argv++) {