git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Harald Nordgren <haraldnordgren@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] ls-remote: create option to sort by versions
Date: Mon, 02 Apr 2018 08:37:29 +0200	[thread overview]
Message-ID: <87605aw1ue.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <20180402005248.52418-1-haraldnordgren@gmail.com>


On Mon, Apr 02 2018, Harald Nordgren wrote:

> Create the options '-V ' and '--version-sort' to sort
> 'git ls-remote' output by version semantics. This is useful e.g. for
> the Go repository after the release of version 1.10, where otherwise
> v1.10 is sorted before v1.2. See:
>
> 	$ git ls-remote -t https://go.googlesource.com/go
> 	...
> 	205f850ceacfc39d1e9d76a9569416284594ce8c	refs/tags/go1.1
> 	d260448f6b6ac10efe4ae7f6dfe944e72bc2a676	refs/tags/go1.1.1
> 	1d6d8fca241bb611af51e265c1b5a2e9ae904702	refs/tags/go1.1.2
> 	bf86aec25972f3a100c3aa58a6abcbcc35bdea49	refs/tags/go1.10
> 	ac7c0ee26dda18076d5f6c151d8f920b43340ae3	refs/tags/go1.10.1
> 	9ce6b5c2ed5d3d5251b9a6a0c548d5fb2c8567e8	refs/tags/go1.10beta1
> 	594668a5a96267a46282ce3007a584ec07adf705	refs/tags/go1.10beta2
> 	5348aed83e39bd1d450d92d7f627e994c2db6ebf	refs/tags/go1.10rc1
> 	20e228f2fdb44350c858de941dff4aea9f3127b8	refs/tags/go1.10rc2
> 	1c5438aae896edcd1e9f9618f4776517f08053b3	refs/tags/go1.1rc2
> 	46a6097aa7943a490e9bd2e04274845d0e5e200f	refs/tags/go1.1rc3
> 	402d3590b54e4a0df9fb51ed14b2999e85ce0b76	refs/tags/go1.2
> 	9c9802fad57c1bcb72ea98c5c55ea2652efc5772	refs/tags/go1.2.1
> 	...

This is a sensible thing to want, but why not follow the UI we have for
this with git-tag? I.e. --sort=<key> & -i (or --ignore-case)? Of course
ls-remote doesn't just show tags, so maybe we'd want --tag-sort=<key>
and --ignore-tag-case or something, but the rest should be equivalent,
no?

> [...]
> @@ -101,13 +115,22 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
>  	if (transport_disconnect(transport))
>  		return 1;
>
> -	if (!dest && !quiet)
> -		fprintf(stderr, "From %s\n", *remote->url);
>  	for ( ; ref; ref = ref->next) {
>  		if (!check_ref_type(ref, flags))
>  			continue;
>  		if (!tail_match(pattern, ref->name))
>  			continue;
> +		REALLOC_ARRAY(refs, nr + 1);
> +		refs[nr++] = ref;
> +	}
> +
> +	if (version_sort)
> +		QSORT(refs, nr, cmp_ref_versions);
> +
> +	if (!dest && !quiet)
> +		fprintf(stderr, "From %s\n", *remote->url);

Is there some subtlety here I'm missing which means that when sorting
we'd now need to print this "From" line later (i.e. after sorting?

  reply	other threads:[~2018-04-02  6:37 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02  0:52 [PATCH] ls-remote: create option to sort by versions Harald Nordgren
2018-04-02  6:37 ` Ævar Arnfjörð Bjarmason [this message]
2018-04-02 16:26   ` Harald Nordgren
2018-04-02 17:32     ` Ævar Arnfjörð Bjarmason
2018-04-02 17:42       ` Harald Nordgren
2018-04-02 17:46     ` Jeff King
2018-04-02 18:32   ` Junio C Hamano
2018-04-02 20:03     ` Harald Nordgren
2018-04-02 22:11       ` [PATCH v5] ls-remote: create '--sort' option Harald Nordgren
2018-04-02 22:53         ` Eric Sunshine
2018-04-02 22:54           ` Eric Sunshine
2018-04-03  0:48       ` [PATCH v6] " Harald Nordgren
2018-04-02 21:05 ` [PATCH v4] " Harald Nordgren
2018-04-04 17:11 ` [PATCH v7] " Harald Nordgren
2018-04-04 17:18   ` Harald Nordgren
2018-04-04 17:47     ` Harald Nordgren
2018-04-04 18:56     ` Jeff King
2018-04-04 18:55   ` Jeff King
2018-04-04 23:01 ` [PATCH v8] " Harald Nordgren
2018-04-04 23:11   ` Harald Nordgren
2018-04-06 18:58     ` Jeff King
2018-04-06 18:58       ` [PATCH 1/3] ref-filter: use "struct object_id" consistently Jeff King
2018-04-06 18:59       ` [PATCH 2/3] ref-filter: make ref_array_item allocation more consistent Jeff King
2018-04-06 18:59       ` [PATCH 3/3] ref-filter: factor ref_array pushing into its own function Jeff King
2018-04-06 19:27         ` Derrick Stolee
2018-04-07 15:22           ` Harald Nordgren
2018-04-08 23:18         ` Junio C Hamano
2018-04-09  3:57           ` Jeff King
2018-04-04 23:32 ` [PATCH v9] ls-remote: create '--sort' option Harald Nordgren
2018-04-05  0:04 ` [PATCH v10] " Harald Nordgren
2018-04-07 16:42 ` [PATCH v11 1/4] ref-filter: use "struct object_id" consistently Harald Nordgren
2018-04-08  1:06   ` Eric Sunshine
2018-04-08 12:27     ` Harald Nordgren
2018-04-07 16:42 ` [PATCH v11 2/4] ref-filter: make ref_array_item allocation more consistent Harald Nordgren
2018-04-07 16:42 ` [PATCH v11 3/4] ref-filter: factor ref_array pushing into its own function Harald Nordgren
2018-04-07 16:42 ` [PATCH v11 4/4] ls-remote: create '--sort' option Harald Nordgren
2018-04-08  1:48   ` Eric Sunshine
2018-04-08 12:28 ` [PATCH v12 1/4] ref-filter: use "struct object_id" consistently Harald Nordgren
2018-04-08 12:28 ` [PATCH v12 2/4] ref-filter: make ref_array_item allocation more consistent Harald Nordgren
2018-04-08 12:28 ` [PATCH v12 3/4] ref-filter: factor ref_array pushing into its own function Harald Nordgren
2018-04-08 12:28 ` [PATCH v12 4/4] ls-remote: create '--sort' option Harald Nordgren
2018-04-08 22:16   ` Junio C Hamano
2018-04-09  0:09     ` Harald Nordgren
2018-04-09  0:09       ` Harald Nordgren
2018-04-09  0:48       ` Junio C Hamano
2018-04-09  2:31     ` Eric Sunshine
2018-04-08 23:58 ` [PATCH v13 1/4] ref-filter: use "struct object_id" consistently Harald Nordgren
2018-04-08 23:58 ` [PATCH v13 2/4] ref-filter: make ref_array_item allocation more consistent Harald Nordgren
2018-04-08 23:58 ` [PATCH v13 3/4] ref-filter: factor ref_array pushing into its own function Harald Nordgren
2018-04-08 23:58 ` [PATCH v13 4/4] ls-remote: create '--sort' option Harald Nordgren
2018-04-09  0:56   ` Junio C Hamano
2018-04-09  1:45     ` Harald Nordgren
2018-04-09  1:42 ` [PATCH v14 1/4] ref-filter: use "struct object_id" consistently Harald Nordgren
2018-04-09  1:42 ` [PATCH v14 2/4] ref-filter: make ref_array_item allocation more consistent Harald Nordgren
2018-04-11 17:57   ` Harald Nordgren
2018-04-11 18:07     ` Stefan Beller
2018-04-11 18:30       ` Todd Zullinger
2018-04-11 18:56       ` Eric Sunshine
2018-04-11 23:25         ` Junio C Hamano
2018-04-09  1:42 ` [PATCH v14 3/4] ref-filter: factor ref_array pushing into its own function Harald Nordgren
2018-04-09  1:42 ` [PATCH v14 4/4] ls-remote: create '--sort' option Harald Nordgren
2018-05-12  8:45   ` René Scharfe
2018-05-12  9:55     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87605aw1ue.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=haraldnordgren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).