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

Serious bug with pretty format strings & empty bodies?

From
Jonathan del Strother <maillist@steelskies.com>
Date
Dec 19, 2007, 14:32 UTC
Message-ID
<57518fd10712190632o490af924n61326fddf1819014@mail.gmail.com>

I'm struggling to come up with a minimal test case that confirms this, but I seem to be hitting a bug in the pretty string formatter when trying to print bodies of commits that don't have bodies.

For example, on a private repository, I'm trying to print the subject & body of a commit. This particular commit doesn't actually have a body, so I'm expecting to see this output :

================= commit 18d2480ab689b483ef1ebbdb3f7420904049ba0b Try to flush log files before terminating the app

=================

However, when I actually run the command, I get gibberish in place of %b : ================= $ git rev-list -1- --pretty=format:"%s%n%b" 18d2480ab689b483ef1ebbdb3f7420904049ba0b commit 18d2480ab689b483ef1ebbdb3f7420904049ba0b Try to flush log files before terminating the app tree 57bc7cf30a10aee96251852125cf30fd2c81d7aa parent 04c833865828538315fcdf6e187da077869ce444 author Jonathan del Strother <jon.delStrother@bestbefore.tv> 1197901755 +0000 committer Jonathan del Strother <jon.delStrother@bestbefore.tv> 1197901755 +0000

Check that ThreadWorker's work method actually returns a value with method signatures =================

So here you can see that the full details of a different commit is appearing in place of the requested commit's (empty) body. Rerunning the rev-list produces the same output - the same string appears in place of %b every time, but it's different for each commit. Often you only get a small fragment of another commit's message, rather than the full commit as seen above.

When I use --pretty=full, it works fine.

This appears in quite a few places in my repository's history. Repacking the repo semi-fixes it - I still get junk bodies, but not quite so many.

It doesn't always happen when a commit message body is empty, but I've never seen it happen where the message body has something in.

This happens with both git 1.5.3.7 and 1.5.4.rc0.1162.g3bfea, though the output is slightly different - the former has a number of <unknown> markers in it. This is on OS X 10.5.1

Any suggestions? Cheers, Jon

Next: René Scharfe
Message 1 of 16 in “Serious bug with pretty format strings & empty bodies?”
  1. Jonathan del StrotherDec 19, 2007
  2. René ScharfeDec 19, 2007
  3. Jonathan del StrotherDec 20, 2007
  4. Jonathan del StrotherDec 20, 2007
  5. Alex RiesenDec 19, 2007
  6. Jonathan del StrotherDec 19, 2007
  7. René ScharfeDec 19, 2007
  8. Jonathan del StrotherDec 20, 2007
  9. René ScharfeDec 20, 2007
  10. Johannes SchindelinDec 20, 2007
  11. Jonathan del StrotherDec 20, 2007
  12. Jonathan del StrotherDec 21, 2007
  13. Junio C HamanoDec 22, 2007
  14. Jonathan del StrotherDec 22, 2007
  15. Jonathan del StrotherDec 20, 2007
  16. Johannes SchindelinDec 20, 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.