Thread overview
git show "previous tag"
Aug 28, 2014
Andrew Edwards
Aug 29, 2014
Dicebot
Aug 29, 2014
Andrew Edwards
August 28, 2014
Anyone here knows how to consistently obtain the previous tag on git? Currently, the installer uses:

	git describe --abbrev=0 v2.067.0-b1^

This does not always retrieve the correct tag though. In this case the tag prior to v2.067.0-b1 is v2.066.0, however this command returns v2.066.0-b1. This causes a problem because v2.066.0-b1 broke the installer and cannot be used to build DMD. To get around this issue, I usually upload a different version of the compiler in place of v2.066.0-b1. This is not the ideal solution because anyone downloading that v2.066.0-b1.zip will not be getting something completely different.

Assistance appreciated.

Regards,
Andrew
August 28, 2014
On 8/27/14, 9:47 PM, Andrew Edwards wrote:
> Anyone here knows how to consistently obtain the previous tag on git?

Are tags always coming in order? Then it's easy:

git tag | tail -n2 | head -n1


Andrei


August 29, 2014
On Thursday, 28 August 2014 at 05:13:06 UTC, Andrei Alexandrescu wrote:
> On 8/27/14, 9:47 PM, Andrew Edwards wrote:
>> Anyone here knows how to consistently obtain the previous tag on git?
>
> Are tags always coming in order? Then it's easy:
>
> git tag | tail -n2 | head -n1
>
>
> Andrei

Not in semver order unfortunately. This will be changed in new git version though (http://blogs.atlassian.com/2014/08/whats-new-git-2-1/)

Andrew, what is your desired definiton of "prior"? This `git abbrev` command finds previos named commit by traversing _commit_ history. If it returns v2.066.0-b1 that means that this tag was created later in the commit sequence than v2.066.0 (which is not surprising)
August 29, 2014
On 8/29/14, 10:55 AM, Dicebot wrote:
> On Thursday, 28 August 2014 at 05:13:06 UTC, Andrei Alexandrescu wrote:
>> On 8/27/14, 9:47 PM, Andrew Edwards wrote:
>>> Anyone here knows how to consistently obtain the previous tag on git?
>>
>> Are tags always coming in order? Then it's easy:
>>
>> git tag | tail -n2 | head -n1
>>
>>
>> Andrei
>
> Not in semver order unfortunately. This will be changed in new git
> version though (http://blogs.atlassian.com/2014/08/whats-new-git-2-1/)
>
> Andrew, what is your desired definiton of "prior"? This `git abbrev`
> command finds previos named commit by traversing _commit_ history. If it
> returns v2.066.0-b1 that means that this tag was created later in the
> commit sequence than v2.066.0 (which is not surprising)


By prior I'm referring to the tag created immediately before the one I'm using in querying. If I'm building v2.066.0-rc1, I'm expecting back v2.066.0-b6. Likewise, if I provide v2.066.0-b1 it should return v2.065.0.

There was a slight snafu that required recreating the beta 2 and 3 tags for the 2.066 release. This occurred right before beta 4 was created. All other tags were created without problems following that this so might be a bug in the github system. The very last tag I created on the 2.066 branch was v2.066.0 which is what I created the release with.

This command:

git for-each-ref --sort=taggerdate --format '%(refname) %(taggerdate)'

performed on the installer repo lists the available tags in the order they were created:

	refs/tags/v2.065-b1 Sat Jan 18 00:56:41 2014 -0500
	refs/tags/v2.065.0-b2 Fri Jan 24 22:16:50 2014 -0500
	refs/tags/v2.065.0-b3 Mon Feb 3 03:21:32 2014 -0500
	refs/tags/v2.065.0-rc1 Sun Feb 16 21:43:37 2014 -0500
	refs/tags/v2.065.0 Sun Feb 23 22:10:15 2014 -0500
	refs/tags/v2.066.0-b1 Wed Jul 2 06:53:47 2014 +0900
	refs/tags/v2.066.0-b2 Tue Jul 15 17:55:57 2014 +0900
	refs/tags/v2.066.0-b3 Tue Jul 15 17:58:35 2014 +0900
	refs/tags/v2.066.0-b4 Tue Jul 15 21:36:55 2014 +0900
	refs/tags/v2.066.0-b5 Mon Jul 21 17:26:57 2014 +0900
	refs/tags/v2.066.0-b6 Sun Jul 27 12:14:53 2014 +0900
	refs/tags/v2.066.0-rc1 Thu Jul 31 17:54:52 2014 +0900
	refs/tags/v2.066.0-rc2 Fri Aug 8 18:21:29 2014 +0900
	refs/tags/v2.066.0 Sat Aug 16 22:17:00 2014 +0900
	refs/tags/v2.067.0-b1 Tue Aug 26 10:52:01 2014 +0900

Note: I've truncated the list to show just the tags I created.