public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Victoria Dye <vdye@github.com>
To: Junio C Hamano <gitster@pobox.com>,
	Victoria Dye via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] ref-filter.c: sort formatted dates by byte value
Date: Thu, 8 Feb 2024 18:46:50 -0800	[thread overview]
Message-ID: <5ed018da-2150-42d8-995e-59a35a2e3821@github.com> (raw)
In-Reply-To: <xmqqzfwbps43.fsf@gitster.g>

Junio C Hamano wrote:
>>     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.


  reply	other threads:[~2024-02-09  2:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-08  1:57 [PATCH] ref-filter.c: sort formatted dates by byte value Victoria Dye via GitGitGadget
2024-02-08  3:11 ` Junio C Hamano
2024-02-09  2:46   ` Victoria Dye [this message]
2024-02-09  6:31     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ed018da-2150-42d8-995e-59a35a2e3821@github.com \
    --to=vdye@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox