Re: [PATCH] strbuf_addftime(): handle "%s" manually

2 messages, 2 authors, 2021-11-04 · open the first message on its own page

Re: [PATCH] strbuf_addftime(): handle "%s" manually

From: Junio C Hamano <hidden>
Date: 2021-11-03 20:28:06

I think this also needs squashing in?

 Documentation/rev-list-options.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git c/Documentation/rev-list-options.txt w/Documentation/rev-list-options.txt
index 24569b06d1..43a86fa562 100644
--- c/Documentation/rev-list-options.txt
+++ w/Documentation/rev-list-options.txt
@@ -1047,7 +1047,7 @@ omitted.
 has no effect.
 
 `--date=format:...` feeds the format `...` to your system `strftime`,
-except for %z and %Z, which are handled internally.
+except for %s, %z, and %Z, which are handled internally.
 Use `--date=format:%c` to show the date in your system locale's
 preferred format.  See the `strftime` manual for a complete list of
 format placeholders. When using `-local`, the correct syntax is

Re: [PATCH] strbuf_addftime(): handle "%s" manually

From: Jeff King <hidden>
Date: 2021-11-04 02:11:09

On Wed, Nov 03, 2021 at 01:28:00PM -0700, Junio C Hamano wrote:
quoted hunk
I think this also needs squashing in?

 Documentation/rev-list-options.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git c/Documentation/rev-list-options.txt w/Documentation/rev-list-options.txt
index 24569b06d1..43a86fa562 100644
--- c/Documentation/rev-list-options.txt
+++ w/Documentation/rev-list-options.txt
@@ -1047,7 +1047,7 @@ omitted.
 has no effect.
 
 `--date=format:...` feeds the format `...` to your system `strftime`,
-except for %z and %Z, which are handled internally.
+except for %s, %z, and %Z, which are handled internally.
 Use `--date=format:%c` to show the date in your system locale's
 preferred format.  See the `strftime` manual for a complete list of
 format placeholders. When using `-local`, the correct syntax is
Ah, thanks. I didn't even think to look in the documentation, because I
didn't imagine that we would expose these implementation details. But
since we do mention %z there, I think adding %s makes sense.

BTW, I also noticed that stftime supports some locale modifiers. So
"%Es" ends up printing the epoch seconds, but eludes our manual
intervention (and so does the old, wrong thing). I'm fine with stopping
here, though. There's no reason to use %Es over %s (from what I gather,
the %E is about handling year eras for locales that support them, but
that's meaningless for an epoch time), and I'm not sure it is even a
portable thing (glibc does not mention it in the manpage along with
other %E values, but it does work; POSIX does not even define %s, so of
course does not mention %Es).

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help