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

[PATCH] --pretty=format: fix broken %ct and %at interpolation

From
Jeff King <peff@peff.net>
Date
Mar 27, 2007, 23:26 UTC
Message-ID
<20070327232628.GA9981@coredump.intra.peff.net>

A pointer arithmetic error in fill_person caused random data from the commit object to be included with the timestamp, which looked something like:

    $ git-rev-list --pretty=format:%ct origin/next | head
    commit 98453bdb3db10db26099749bc4f2dc029bed9aa9
    1174977948 -0700
    Merge branch 'master' into next
    * master:
      Bisect: Use
    commit c0ce981f5ebfd02463ff697b2fca52c7a54b0625
    1174889646 -0700
Signed-off-by: Jeff King <peff@peff.net>
---
 commit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/commit.c b/commit.c
index 718e568..a92958c 100644
--- a/commit.c
+++ b/commit.c
@@ -760,7 +760,7 @@ static void fill_person(struct interp *table, const char *msg, int len)
 	if (msg + start == ep)
 		return;
 
-	table[5].value = xstrndup(msg + start, ep - msg + start);
+	table[5].value = xstrndup(msg + start, ep - (msg + start));
 
 	/* parse tz */
 	for (start = ep - msg + 1; start < len && isspace(msg[start]); start++)
-- 
1.5.1.rc2.618.g98453b
Next: Johannes Schindelin
Message 1 of 2 in “--pretty=format: fix broken %ct and %at interpolation”
  1. --pretty=format: fix broken %ct and %at interpolationJeff King, Mar 27, 2007
  2. Johannes SchindelinMar 27, 2007

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.