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

git-log --pretty=format:'[%x00]%w(0,0,1)' doesn't print NUL and "]"

From
TATanaka Akira <akr@fsij.org>
Date
Dec 29, 2011, 18:41 UTC
Message-ID
<CANjopZFqiy+Ai4u6QYYnza5J7A3NAt-f17yR9AsYok-g3Hbb3w@mail.gmail.com>
I found that git-log doesn't print characters in --pretty option as follows.
  % git log --pretty=format:'[%x00]%w(0,0,1)' |od -c
  0000000   [  \n   [  \n   [  \n   [  \n   [  \n   [  \n   [  \n   [  \n
  *
  0022320   [  \n   [  \n   [  \n   [
  0022327
I think NUL and "]" should be printed.

Note that git log works as I expected if I use %w(0,0,0) instead of %w(0,0,1), I don't use %w(0,0,1) or I use %x01 instead of %x00.

  % git log --pretty=format:'[%x00]%w(0,0,0)' |od -c
  0000000   [  \0   ]  \n   [  \0   ]  \n   [  \0   ]  \n   [  \0   ]  \n
  *
  0044640   [  \0   ]  \n   [  \0   ]  \n   [  \0   ]  \n   [  \0   ]
  0044657
  % git log --pretty=format:'[%x00]' |od -c
  0000000   [  \0   ]  \n   [  \0   ]  \n   [  \0   ]  \n   [  \0   ]  \n
  *
  0044640   [  \0   ]  \n   [  \0   ]  \n   [  \0   ]  \n   [  \0   ]
  0044657
  % git log --pretty=format:'[%x01]%w(0,0,1)' |od -c
  0000000   [ 001   ]  \n   [ 001   ]  \n   [ 001   ]  \n   [ 001   ]  \n
  *
  0044640   [ 001   ]  \n   [ 001   ]  \n   [ 001   ]  \n   [ 001   ]
  0044657
I used git 1.7.8.2.
  % git --version
  git version 1.7.8.2
-- 
Tanaka Akira
Next: Jeff King
Message 1 of 2 in “git-log --pretty=format:'[%x00]%w(0,0,1)' doesn't print NUL and "]"”
  1. Tanaka AkiraDec 29, 2011
  2. Jeff KingDec 29, 2011

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.