git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] tag: support --sort=version

From
Jeff King <peff@peff.net>
Date
Feb 20, 2014, 20:43 UTC
Message-ID
<20140220204345.GA3374@sigill.intra.peff.net>
In-Reply-To
<CACsJy8CL3rQx=QHf_eABCUqS+9kZXEmopUuCMiNCL+UPyvtbyw@mail.gmail.com>
On Wed, Feb 19, 2014 at 09:19:24PM +0700, Duy Nguyen wrote:
Show 7 quoted lines
> > We don't need to do any of that immediately.  This is mostly just me
> > thinking aloud, to make sure we do not paint ourselves into a corner
> > compatibility-wise.
> 
> Good thinking. If you plan to use the exact same sort syntax f-e-r
> uses now, pick a letter (the dot I used above is probably not the
> best), I'll rewrite this patch to use the same syntax.

I think I actually prefer the full word "version", as you have already. It's clear what it means, and we can extend the syntax generally to:

  --sort=[-][comparison:]field
like:
  --sort=-version:subject

for descending version-sort by subject. And then as a special-case convenience, make "version" without a field default to "version:refname". There's no ambiguity because the set of comparison names and field-names is fixed, and we know there is no overlap.

If want to, we can _also_ give a one-letter abbreviation to the comparison field, like:

  --sort=v:subject
but that is not necessary.

So I think your patch is fine as-is. It is perhaps a little funny to start with the special case and only implement the general case later, but:

  1. We would want the special case eventually, because it is the most
     natural thing to type, and pretty clearly the most common use-case.
  2. We may not ever even end up with the general case. This is just
     about making sure that if we _do_ add it, that it fits
     syntactically with "--sort=version".
-Peff
Previous: Duy NguyenNext: Duy Nguyen
Message 4 of 25 in “tag: support --sort=version”
  1. tag: support --sort=versionNguyễn Thái Ngọc Duy, Feb 19, 2014
  2. Jeff KingFeb 19, 2014
  3. Duy NguyenFeb 19, 2014
  4. Jeff KingFeb 20, 2014
  5. Duy NguyenFeb 21, 2014
  6. Junio C HamanoFeb 21, 2014
  7. Jeff KingFeb 22, 2014
  8. Duy NguyenFeb 22, 2014
  9. Eric SunshineFeb 19, 2014
  10. tag: support --sort=<spec>Nguyễn Thái Ngọc Duy, Feb 22, 2014
  11. Jeff KingFeb 22, 2014
  12. Junio C HamanoFeb 24, 2014
  13. Duy NguyenFeb 24, 2014
  14. Jeff KingFeb 24, 2014
  15. tag: support --sort=<spec>Nguyễn Thái Ngọc Duy, Feb 25, 2014
  16. Junio C HamanoFeb 25, 2014
  17. Jeff KingFeb 26, 2014
  18. Duy NguyenFeb 26, 2014
  19. Jeff KingFeb 26, 2014
  20. Duy NguyenFeb 26, 2014
  21. Jeff KingFeb 26, 2014
  22. Duy NguyenFeb 26, 2014
  23. tag: support --sort=<spec>Nguyễn Thái Ngọc Duy, Feb 27, 2014
  24. Jeff KingFeb 27, 2014
  25. Duy NguyenFeb 27, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.