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

Re: pkt-line and LF terminated lines of data

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Apr 29, 2021, 02:08 UTC
Message-ID
<YIoVBmeGMheSi897@camp.crustytoothpaste.net>
In-Reply-To
<87bl9yylyg.fsf@evledraar.gmail.com>
On 2021-04-29 at 00:12:00, Ævar Arnfjörð Bjarmason wrote:
Show 10 quoted lines
> 
> On Wed, Apr 28 2021, dwh@linuxprogrammer.org wrote:
> 
> > I was just reading the Documentation/technical/protocol-common.txt
> > description of the pkt-line format. One detail that is left out is how a
> > receiver of pkt-line encoded data determines if a line is binary data or
> > contains non-binary data.
> 
> They don't. The "is it binary" is a client convention / awareness of the
> consumed payload.

As a general rule of thumb, if the pkt-line is a pack or object, it's binary, and otherwise (a ref advertisement, a negotiation, etc.) it's text. Almost any case where GIT_TRACE_PACKET prints the output is going to be text, and almost any case where it does not is going to be binary.

Note that whether something is text or binary is specifically an attribute of what part of the protocol is being parsed, not what bytes it contains. For example, a ref advertisement with a ref containing the bytes FE and FF is text, despite those not appearing in UTF-8.

-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 3 of 4 in “pkt-line and LF terminated lines of data”
  1. dwh@linuxprogrammer.orgApr 28, 2021
  2. Ævar Arnfjörð BjarmasonApr 29, 2021
  3. brian m. carlsonApr 29, 2021
  4. Junio C HamanoApr 29, 2021

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.