Re: [PATCH] pretty format string support for reflog times

Subsystems: the rest

2 messages, 2 authors, 2016-07-27 · open the first message on its own page

Re: [PATCH] pretty format string support for reflog times

From: Junio C Hamano <hidden>
Date: 2016-07-27 17:46:56

Junio C Hamano [off-list ref] writes:
quoted
Hrm. Since Ted was not cc'd, it is not clear to me whether this is
coincidental or in response to the thread over in

  http://thread.gmane.org/gmane.comp.version-control.git/299201

To summarize, I think the conclusion there was that we would go with at
least the 't' and 'r' formatters in the short term. The 'i/I' ones were
not something Ted cared about that much, I think, but they do make
things orthogonal with the other ident dates.
I forgot about that thread after it stalled without drawing
conclusion, after Ted asked if anybody has a strong opinion
and saw only one response to it at

  https://public-inbox.org/git/20160711164317.GB3890%40thunk.org/

So, what is the next step?  Apply

  https://public-inbox.org/git/20160710055402.32684-1-tytso%40mit.edu/

but exclude %g[iI] bits out of that patch while doing so?
FWIW, a squash to do so is trivial, but the original had two
compiler breakers.

I am not sure about the latter, i.e. the return value from the
get_reflog_time_t() function (which I think is misnamed, in that the
function returns "unsigned long", not "time_t", and should be
renamed to get_reflog_time()) uses the epoch as a fallback value.



 reflog-walk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/reflog-walk.c b/reflog-walk.c
index d0aa2d0..51bfe29 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -309,7 +309,7 @@ void get_reflog_message(struct strbuf *sb,
 	size_t len;
 
 	if (!info)
-		return NULL;
+		return;
 	len = strlen(info->message);
 	if (len > 0)
 		len--; /* strip away trailing newline */
@@ -330,7 +330,7 @@ unsigned long get_reflog_time_t(struct reflog_walk_info *reflog_info)
 	struct reflog_info *info = get_reflog_info(reflog_info);
 
 	if (!info)
-		return NULL;
+		return 0;
 	return gm_time_t(info->timestamp, info->tz);
 }
 

Re: [PATCH] pretty format string support for reflog times

From: Jeff King <hidden>
Date: 2016-07-27 17:58:08

On Wed, Jul 27, 2016 at 10:46:48AM -0700, Junio C Hamano wrote:
quoted hunk
I am not sure about the latter, i.e. the return value from the
get_reflog_time_t() function (which I think is misnamed, in that the
function returns "unsigned long", not "time_t", and should be
renamed to get_reflog_time()) uses the epoch as a fallback value.
[...]
@@ -330,7 +330,7 @@ unsigned long get_reflog_time_t(struct reflog_walk_info *reflog_info)
 	struct reflog_info *info = get_reflog_info(reflog_info);
 
 	if (!info)
-		return NULL;
+		return 0;
 	return gm_time_t(info->timestamp, info->tz);
 }
Our mails just crossed, but I think returning even "0" is not ideal. We
should probably write nothing to match things like "%gd" and "%gs",
which just eat the placeholder and show nothing when they cannot access
the reflog.

-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