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
index 380c180270e263ed6701aa5a003ac999dfcfcec0,d3851074c29a9944281adefabdfd054d214b608f..ca3f04a839e79ecf361df5a1997da05c5d59a62d
@@@ -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);