git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Differences in compound tag sorting between 2.27.0 and 2.21.0
@ 2020-09-27 14:26 Matthew Timothy Kennerly
  2020-09-27 16:25 ` Kyle Meyer
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Timothy Kennerly @ 2020-09-27 14:26 UTC (permalink / raw)
  To: git

Hello,

I've run into a difference in the results for a compound tag sort
between 2.21.0 and 2.27.0 (I believe also applies to 2.28.0), and I'm
not sure if it's an intentional difference or if there's still some
way to achieve the old behavior with newer Git versions. For
reference, I'm using Windows.

I need to sort tags first by the date of the pointed commit, then by
the date of the tag creation when available (I understand that
lightweight tags don't store their creation date, so multiple
lightweight tags on a single commit may not sort consistently). Let me
give a concrete example.

Given a repository with this setup, using annotated tags:


git init
echo hi > foo.txt
git add .
git commit -m "first"
git tag v0.1.0 -m "A"
echo bye > foo.txt
git add .
git commit -m "second"
git tag v0.2.0 -m "B"
git tag v0.1.1 HEAD~1 -m "C"


I get the desired sort results in 2.21.0:


$ git tag --merged HEAD --sort -taggerdate --sort -committerdate
v0.2.0
v0.1.1
v0.1.0


However, in 2.27.0, the first listed tag is the tag that was most
recently created, rather than the one pointing to the newest commit:


$ git tag --merged HEAD --sort -taggerdate --sort -committerdate
v0.1.1
v0.2.0
v0.1.0


Swapping the sort options in 2.27.0 does not affect the result,
whereas swapping them in 2.21.0 produces the same result as 2.27.0.
That makes it seem like 2.27.0 is ignoring the precedence order of the
sort options.

If this is intentional, how can I achieve the desired sort order in
newer versions of Git?

Thanks,

MTK

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-27 20:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-09-27 20:35       ` Matthew Timothy Kennerly

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 NNTP newsgroup(s).