Merge branch 'hn/sort-ls-remote'
authorJunio C Hamano <gitster@pobox.com>
Tue, 8 May 2018 06:59:29 +0000 (15:59 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 May 2018 06:59:29 +0000 (15:59 +0900)
"git ls-remote" learned an option to allow sorting its output based
on the refnames being shown.

* hn/sort-ls-remote:
  ls-remote: create '--sort' option

1  2 
builtin/ls-remote.c

@@@ -1,8 -1,8 +1,9 @@@
  #include "builtin.h"
  #include "cache.h"
  #include "transport.h"
+ #include "ref-filter.h"
  #include "remote.h"
 +#include "refs.h"
  
  static const char * const ls_remote_usage[] = {
        N_("git ls-remote [--heads] [--tags] [--refs] [--upload-pack=<exec>]\n"
@@@ -44,7 -44,7 +45,8 @@@ int cmd_ls_remote(int argc, const char 
        int show_symref_target = 0;
        const char *uploadpack = NULL;
        const char **pattern = NULL;
 +      struct argv_array ref_prefixes = ARGV_ARRAY_INIT;
+       int i;
  
        struct remote *remote;
        struct transport *transport;
        if (uploadpack != NULL)
                transport_set_option(transport, TRANS_OPT_UPLOADPACK, uploadpack);
  
 -      ref = transport_get_remote_refs(transport);
 +      ref = transport_get_remote_refs(transport, &ref_prefixes);
-       if (transport_disconnect(transport))
+       if (transport_disconnect(transport)) {
+               UNLEAK(sorting);
                return 1;
+       }
  
        if (!dest && !quiet)
                fprintf(stderr, "From %s\n", *remote->url);