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

Re: [PATCH] ref-filter.c: sort formatted dates by byte value

From
Victoria Dye <vdye@github.com>
Date
Feb 9, 2024, 02:46 UTC
Message-ID
<5ed018da-2150-42d8-995e-59a35a2e3821@github.com>
In-Reply-To
<xmqqzfwbps43.fsf@gitster.g>
Junio C Hamano wrote:
Show 11 quoted lines
>>     I came across a use case for 'git for-each-ref' at $DAYJOB in which I'd
>>     want to sort by a portion of a formatted 'creatordate' (e.g., only the
>>     time of day, sans date). When I tried to run something like 'git
>>     for-each-ref --sort=creatordate:format:%H:%M:%S',
> 
> Hmph, this indeed is interesting ;-)
> 
> I wonder if there are other "sort by numeric but the thing could be
> stringified by the end-user" atoms offered by for-each-ref
> machinery.  IOW, is the timestamp the only thing that needs this
> fix?

The only non-FIELD_STR atoms other than the date ones are "objectsize" and "numparent". "objectsize" has an optional ":disk" modifier, but that doesn't change formatting (just the value of the integer printed). "numparent" doesn't have any modifiers, it just prints the integer number of parents. Otherwise, everything is sorted by string value, so I think only the date atoms have this kind of mismatch between formatted value and sort value.

> 
> Thanks.
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “ref-filter.c: sort formatted dates by byte value”
  1. ref-filter.c: sort formatted dates by byte valueVictoria Dye via GitGitGadget, Feb 8, 2024
  2. Junio C HamanoFeb 8, 2024
  3. Victoria DyeFeb 9, 2024
  4. Junio C HamanoFeb 9, 2024

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.