From: Kyle Meyer <kyle@kyleam.com>
To: Matthew Timothy Kennerly <mtkennerly@gmail.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: Differences in compound tag sorting between 2.27.0 and 2.21.0
Date: Sun, 27 Sep 2020 15:55:58 -0400 [thread overview]
Message-ID: <871rinf0z5.fsf@kyleam.com> (raw)
In-Reply-To: <CAKqNo6QCa2bGF3Uj-0ewh-_O+_qTOeOFYOM2k_daXw-vGg+xVg@mail.gmail.com>
Matthew Timothy Kennerly writes:
>> $ git tag --sort -taggerdate --sort '-*committerdate'
>
> That gives me the desired result with the annotated tag example I
> gave, but if I do the same repository setup steps with lightweight
> tags, then it inverts the order:
>
> # Lightweight tag repo
> $ git tag --merged HEAD --sort -taggerdate --sort '-*committerdate'
> v0.1.0
> v0.1.1
> v0.2.0
Yes, that depends on annotated tags. For lightweight tags, there's no
tag object to dereference to a commit.
> It looks like I can support both setups at once by using
> -committerdate plus -*committerdate, though:
>
> # Annotated tag repo
> $ git tag --merged HEAD --sort -taggerdate --sort -committerdate
> --sort '-*committerdate'
> v0.2.0
> v0.1.1
> v0.1.0
>
> # Lightweight tag repo
> $ git tag --merged HEAD --sort -taggerdate --sort -committerdate
> --sort '-*committerdate'
> v0.2.0
> v0.1.0
> v0.1.1
>
> It's fine for me that the order isn't exactly the same, as long as
> v0.2.0 is listed first.
For the lightweight case, v0.1.1 and v0.1.0 point to the same commit and
taggerdate has no effect because there are no tag objects, so it falls
back to sorting v0.1.0 and v0.1.1 by refname.
Given your stated goal of "[sorting] tags first by the date of the
pointed commit, then by the date of the tag creation when available", I
don't see a better solution than what you landed on. creatordate is
nice for handling a mix of annotated and lightweight tags, but it
doesn't help in your case because you want to give precedence to the
committerdate of the commit that a tags points to. (Also, I'm not sure
what the wider context for this sorting is, but perhaps just
--sort=-version:refname would do what you want?)
next prev parent reply other threads:[~2020-09-27 20:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-27 14:26 Differences in compound tag sorting between 2.27.0 and 2.21.0 Matthew Timothy Kennerly
2020-09-27 16:25 ` Kyle Meyer
2020-09-27 18:26 ` Matthew Timothy Kennerly
2020-09-27 19:55 ` Kyle Meyer [this message]
2020-09-27 20:35 ` Matthew Timothy Kennerly
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=871rinf0z5.fsf@kyleam.com \
--to=kyle@kyleam.com \
--cc=git@vger.kernel.org \
--cc=mtkennerly@gmail.com \
--cc=peff@peff.net \
/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).