login
Header Space

 
 

[PATCH] git-remote: show all remotes with "git remote show"

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ingo Molnar <mingo@...>
Cc: Junio C Hamano <gitster@...>, <git@...>
Date: Wednesday, April 9, 2008 - 11:15 am

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>
---
On Wed, Apr 09, 2008 at 10:57:58AM -0400, Jeff King wrote:


And here it is.

 builtin-remote.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/builtin-remote.c b/builtin-remote.c
index d77f10a..06d33e5 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -19,6 +19,8 @@ static const char * const builtin_remote_usage[] = {
 
 static int verbose;
 
+static int show_all(void);
+
 static inline int postfixcmp(const char *string, const char *postfix)
 {
 	int len1 = strlen(string), len2 = strlen(postfix);
@@ -380,8 +382,11 @@ static int show_or_prune(int argc, const char **argv, int prune)
 
 	argc = parse_options(argc, argv, options, builtin_remote_usage, 0);
 
-	if (argc < 1)
+	if (argc < 1) {
+		if (!prune)
+			return show_all();
 		usage_with_options(builtin_remote_usage, options);
+	}
 
 	memset(&states, 0, sizeof(states));
 	for (; argc; argc--, argv++) {
-- 
1.5.5.1.g272c

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git annoyances, Ingo Molnar, (Wed Apr 9, 6:14 am)
Re: git annoyances, Daniel Barkalow, (Wed Apr 9, 3:21 pm)
Re: git annoyances, Ingo Molnar, (Wed Apr 9, 4:41 pm)
Re: git annoyances, Daniel Barkalow, (Thu Apr 10, 10:08 am)
Re: git annoyances, Junio C Hamano, (Wed Apr 9, 5:04 pm)
Re: git annoyances, André Goddard Rosa, (Wed Apr 9, 7:56 pm)
Re: git annoyances, Govind Salinas, (Thu Apr 10, 3:45 pm)
Re: git annoyances, Jean-Christian de Rivaz, (Thu Apr 10, 2:08 am)
Re: git annoyances, Sverre Rabbelier, (Thu Apr 10, 4:19 am)
Re: git annoyances, Jon Loeliger, (Wed Apr 9, 5:39 pm)
Re: git annoyances, Nicolas Pitre, (Wed Apr 9, 7:45 pm)
Re: git annoyances, Jeff King, (Wed Apr 9, 5:45 pm)
Re: git annoyances, Luciano Rocha, (Fri Apr 11, 6:15 am)
Re: git annoyances, Wincent Colaiuta, (Fri Apr 11, 6:27 am)
git-bisect annoyances, Ingo Molnar, (Thu Apr 10, 7:47 am)
Re: git-bisect annoyances, Junio C Hamano, (Fri Apr 11, 1:56 am)
Re: git-bisect annoyances, Christian Couder, (Fri Apr 11, 1:41 am)
Re: git-bisect annoyances, Ingo Molnar, (Fri Apr 11, 7:41 am)
Re: git-bisect annoyances, Christian Couder, (Sat Apr 12, 2:56 am)
Re: git annoyances, Jeff King, (Wed Apr 9, 10:57 am)
Re: git annoyances, Avery Pennarun, (Wed Apr 9, 1:08 pm)
Re: git annoyances, Karl , (Thu Apr 10, 4:41 am)
Re: git annoyances, Avery Pennarun, (Thu Apr 10, 11:05 am)
Re: git annoyances, Karl , (Fri Apr 11, 3:00 am)
Friendly refspecs (Was: Re: git annoyances), Teemu Likonen, (Wed Apr 9, 4:08 pm)
Re: Friendly refspecs, Junio C Hamano, (Wed Apr 9, 5:21 pm)
Re: Friendly refspecs, Teemu Likonen, (Thu Apr 10, 3:38 am)
Re: Friendly refspecs (Was: Re: git annoyances), Avery Pennarun, (Wed Apr 9, 4:32 pm)
Re: Friendly refspecs (Was: Re: git annoyances), Jeff King, (Wed Apr 9, 4:34 pm)
Re: Friendly refspecs (Was: Re: git annoyances), Teemu Likonen, (Wed Apr 9, 6:25 pm)
Re: Friendly refspecs (Was: Re: git annoyances), Jeff King, (Wed Apr 9, 6:51 pm)
Re: Friendly refspecs, Teemu Likonen, (Sun Apr 13, 5:31 am)
Re: Friendly refspecs, Jeff King, (Tue Apr 15, 11:48 pm)
Re: Friendly refspecs, Daniel Barkalow, (Wed Apr 16, 11:42 am)
Re: Friendly refspecs, Junio C Hamano, (Wed Apr 16, 12:41 am)
Re: Friendly refspecs, Jeff King, (Wed Apr 16, 12:47 am)
Re: Friendly refspecs, Jeff King, (Wed Apr 16, 12:25 am)
[PATCH] Add examples section to 'git fetch' manual, Teemu Likonen, (Sun Apr 13, 5:34 am)
Re: [PATCH] Add examples section to 'git fetch' manual, Junio C Hamano, (Sun Apr 13, 2:56 pm)
Re: [PATCH] Add examples section to 'git fetch' manual, Teemu Likonen, (Sun Apr 13, 4:05 pm)
Re: [PATCH] Add examples section to 'git fetch' manual, Junio C Hamano, (Sun Apr 13, 9:02 pm)
Re: [PATCH] Add examples section to 'git fetch' manual, Matt Graham, (Sun Apr 13, 3:48 pm)
Re: Friendly refspecs (Was: Re: git annoyances), Jeff King, (Wed Apr 9, 8:03 pm)
Re: Friendly refspecs (Was: Re: git annoyances), Jeff King, (Wed Apr 9, 8:11 pm)
Re: Friendly refspecs, Junio C Hamano, (Thu Apr 10, 3:51 am)
Re: Friendly refspecs, Jeff King, (Thu Apr 10, 4:03 am)
[PATCH] git-remote: show all remotes with "git remote show", Jeff King, (Wed Apr 9, 11:15 am)
Re: [PATCH] git-remote: show all remotes with "git remote sh..., Johannes Schindelin, (Wed Apr 9, 12:54 pm)
Re: git annoyances, Björn, (Wed Apr 9, 6:41 am)
Re: [PATCH] When a remote is added but not fetched, tell the..., Johannes Schindelin, (Fri Apr 11, 11:21 am)
Re: [PATCH] Default to fetching a remote after adding it., Wincent Colaiuta, (Fri Apr 11, 3:36 pm)
Re: [PATCH] Default to fetching a remote after adding it., Johannes Schindelin, (Sat Apr 12, 10:33 am)
Re: [PATCH] Default to fetching a remote after adding it., Johannes Schindelin, (Sat Apr 12, 11:24 am)
Re: [PATCH] Default to fetching a remote after adding it., Stephen Sinclair, (Fri Apr 11, 3:17 pm)
speck-geostationary