Thread (1 message) 1 message, 1 author, 2024-02-09

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

From: Junio C Hamano <hidden>
Date: 2024-02-09 06:31:59

Victoria Dye [off-list ref] writes:
Junio C Hamano wrote:
quoted
quoted
    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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help