Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags aren't sorted #167

Closed
adatta02 opened this issue Apr 4, 2017 · 3 comments
Closed

Tags aren't sorted #167

adatta02 opened this issue Apr 4, 2017 · 3 comments

Comments

@adatta02
Copy link

adatta02 commented Apr 4, 2017

I noticed you guys closed #114 but "tags" is still returning the tags in a "sorted" not chronological order. That's causing "tags.latest" to be incorrect in some instances.

On newer versions of git, it looks like it's possible to pass '--sort=-creatordate' which causes them to sort by their creation date. Not sure what git targets you're trying to support but updating the call to be

   /**
    * List all tags
    *
    * @param {Function} [then]
    */
   Git.prototype.tags = function (then) {
      return this.tag(['-l', '--sort=-creatordate'], Git._responseHandler(then, 'TagList'));
   };

Seems to work.

@steveukx
Copy link
Owner

steveukx commented Apr 4, 2017

Hi

The sorting and tags.latest was added to sort by semantic versioning, if there is now an option to specify the sort order, I'll remove the library sorting when that option is provided.

@steveukx
Copy link
Owner

steveukx commented Apr 4, 2017

As of Git version 2.7 you can use the --sort option in git tag, I've amended the git.tags function to accept an options object, if the options include the --sort option, the existing default behaviour of sorting by semantic versioning will be removed. It's worth noting though that if you are using an older version of git, the command will fail as it is an unsupported option.

@adatta02
Copy link
Author

adatta02 commented Apr 4, 2017

Awesome - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants