Skip to contentSkip to conversation

"git cat-file tree <sha1>" prints garbage

BUG Sebastian Harl 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

When using "git cat-file tree <sha1>" to print a tree's content, it produces garbage output like the following:

  $ git cat-file -t c0cd1e4e1888be6a70d44476996ece8be1ab52a2
  tree
  $ git cat-file tree c0cd1e4e1888be6a70d44476996ece8be1ab52a2
  100644 .gitignore%ëF7¦ùq¤¢�«‚:“y—ǽ100644
  COPYINGoø|Fd˜C—bW‘Èê;»_"y£40000 DocumentationŠ>Ý¢ÞÀŸçœ $ë#ºâ�ü100755
  GIT-VERSION-GEN
  [...]

Using "git cat-file -p <sha1>" works fine.
(The above example uses one of the latest commits of the git.git repository)

Cheers,
Sebastian

Signature · 3 lines
Sebastian "tokkee" Harl
GnuPG-ID: 0x8501C7FC
http://tokkee.org/
#1 lore raw

Hi,

Quoted 11 lines · Sebastian Harl

When using "git cat-file tree <sha1>" to print a tree's content, it produces garbage output like the following:

  $ git cat-file -t c0cd1e4e1888be6a70d44476996ece8be1ab52a2
  tree
  $ git cat-file tree c0cd1e4e1888be6a70d44476996ece8be1ab52a2
  100644 .gitignore%ëF7¦ùq¤¢�«‚:“y—ǽ100644
  COPYINGoø|Fd˜C—bW‘Èê;»_"y£40000 DocumentationŠ>Ý¢ÞÀŸçœ $ë#ºâ�ü100755
  GIT-VERSION-GEN
  [...]
Quoted 2 lines

Using "git cat-file -p <sha1>" works fine.
(The above example uses one of the latest commits of the git.git repository)

That is not a bug. "git cat-file tree <sha1>" produces the _exact_ contents of the object, while "-p" _pretty_-prints the contents.

Ciao,
Dscho