Merge branch 'jk/remote-default-show'
authorJunio C Hamano <gitster@pobox.com>
Sun, 20 Apr 2008 04:10:24 +0000 (21:10 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 20 Apr 2008 04:10:24 +0000 (21:10 -0700)
* jk/remote-default-show:
git-remote: show all remotes with "git remote show"

1  2 
builtin-remote.c
diff --combined builtin-remote.c
index 8fe31dbd9af2833f4dc6c3e93b9179f20d2a1d66,06d33e5c73e7c6813610962d891bd9498c1d109c..a3ee1ac3937b179799fbaa048927c4c8a9963cc9
@@@ -19,6 -19,8 +19,8 @@@ static const char * const builtin_remot
  
  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);
@@@ -88,22 -90,18 +90,22 @@@ static int add(int argc, const char **a
        strbuf_init(&buf, 0);
        strbuf_init(&buf2, 0);
  
 +      strbuf_addf(&buf2, "refs/heads/test:refs/remotes/%s/test", name);
 +      if (!valid_fetch_refspec(buf2.buf))
 +              die("'%s' is not a valid remote name", name);
 +
        strbuf_addf(&buf, "remote.%s.url", name);
        if (git_config_set(buf.buf, url))
                return 1;
  
 +      strbuf_reset(&buf);
 +      strbuf_addf(&buf, "remote.%s.fetch", name);
 +
        if (track.nr == 0)
                path_list_append("*", &track);
        for (i = 0; i < track.nr; i++) {
                struct path_list_item *item = track.items + i;
  
 -              strbuf_reset(&buf);
 -              strbuf_addf(&buf, "remote.%s.fetch", name);
 -
                strbuf_reset(&buf2);
                if (mirror)
                        strbuf_addf(&buf2, "refs/%s:refs/%s",
@@@ -384,8 -382,11 +386,11 @@@ static int show_or_prune(int argc, cons
  
        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++) {