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

git cat-file --batch surprising carriage return behavior

From
Joey Hess <id@joeyh.name>
Date
Oct 8, 2019, 19:22 UTC
Message-ID
<20191008192257.GA16870@kitenet.net>

I'm surprised to find that git cat-file --batch, on a Linux system, strips the \r from an input like "HEAD:foo\r\n"

It's obvious, of course, that it will remove the newline, and so this interface cannot be used to query about a filename that, for some horrible reason[1], contains a newline. But very surprising that it cannot be used for filename that contains a carriage return, at least on a non-Windows system.

The docs for cat-file --batch say the list of objects is separated by linefeeds. I don't know if updating the docs is the best fix. (I'd be happy to use a -z if it had one.)

-- 
see shy jo

[1] aka "a large enough number of monkeys"
Next: Jeff King
Message 1 of 4 in “git cat-file --batch surprising carriage return behavior”
  1. Joey HessOct 8, 2019
  2. Jeff KingOct 8, 2019
  3. Joey HessOct 9, 2019
  4. Jeff KingOct 11, 2019

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.