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

[PATCH 1/2] builtin/commit: use timestamp_t in parse_force_date

From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
Date
Nov 12, 2018, 08:40 UTC
Message-ID
<20181112084031.11769-2-carenas@gmail.com>
In-Reply-To
<20181112084031.11769-1-carenas@gmail.com>

when dddbad728c ("timestamp_t: a new data type for timestamps", 2017-04-26) was introduced, the fallback to use approxidate that was introduced in 14ac2864dc ("commit: accept more date formats for "--date"", 2014-05-01) was not updated to use the new type instead of unsigned long.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 builtin/commit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index 0d9828e29e..a447e08f62 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -537,10 +537,10 @@ static int parse_force_date(const char *in, struct strbuf *out)
 
 	if (parse_date(in, out) < 0) {
 		int errors = 0;
-		unsigned long t = approxidate_careful(in, &errors);
+		timestamp_t t = approxidate_careful(in, &errors);
 		if (errors)
 			return -1;
-		strbuf_addf(out, "%lu", t);
+		strbuf_addf(out, "%"PRItime, t);
 	}
 
 	return 0;
-- 
2.19.1.856.g8858448bb
Previous: Carlo Marcelo Arenas BelónNext: Carlo Marcelo Arenas Belón
Message 2 of 12 in “avoid unsigned long for timestamps”
  1. 0/2 avoid unsigned long for timestampsCarlo Marcelo Arenas Belón, Nov 12, 2018
  2. 1/2 builtin/commit: use timestamp_t in parse_force_dateCarlo Marcelo Arenas Belón, Nov 12, 2018
  3. 2/2 read-cache: use time_t instead of unsigned longCarlo Marcelo Arenas Belón, Nov 12, 2018
  4. Eric SunshineNov 12, 2018
  5. Junio C HamanoNov 12, 2018
  6. Johannes SchindelinNov 12, 2018
  7. Junio C HamanoNov 12, 2018
  8. 2/2 read-cache: use time_t instead of unsigned longCarlo Marcelo Arenas Belón, Nov 13, 2018
  9. Johannes SchindelinNov 13, 2018
  10. Carlo ArenasNov 13, 2018
  11. Junio C HamanoNov 13, 2018
  12. Johannes SchindelinNov 12, 2018

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.