Skip to content

Is there any error in the example of SSH section in 10-git-internals transfer-protocols? #322

@zwpaper

Description

@zwpaper

Here is the example:

[source,console]
----
$ ssh -x git@server "git-receive-pack 'simplegit-progit.git'"
005bca82a6dff817ec66f4437202690a93763949 refs/heads/master report-status \
    delete-refs side-band-64k quiet ofs-delta \
agent=git/2:2.1.1+github-607-gfba4028 delete-refs
003e085bb3bcb608e1e84b2432f8ecbe6306e7e7 refs/heads/topic
0000
----

The first 005b means the length of the line, that's 91 bytes, but
the length of

005bca82a6dff817ec66f4437202690a93763949 refs/heads/master report-status \
    delete-refs side-band-64k quiet ofs-delta \
agent=git/2:2.1.1+github-607-gfba4028 delete-refs

is 164, but 91.

let's look at the second line, a simple line:

003e085bb3bcb608e1e84b2432f8ecbe6306e7e7 refs/heads/topic

the length of this line is 57, but the first 4 chars is 003e, 62 in oct.


So I do a simple test:

ssh -x git@github.com "git-receive-pack 'zwpaper/progit2-zh'"
00ca82d2b8601d253dd1df545d66543d12adba06f73c refs/heads/06-github-4-managing-orgreport-status delete-refs side-band-64k quiet atomic ofs-delta agent=git/2:2.4.0~peff-faster-fetch-pruning-1043-gc837c96
0053f6a3af3bcd0da7f51393a4d746b72346aa12b886 refs/heads/10-git-internals-packfiles
005e83cc8df409dd347e173bcdd9c630bf245185f3f2 refs/heads/double_quote_mark_in_translation_note
003faf9ee732e6977aa621e30c8ceb152375f0911346 refs/heads/master
0057be6fc3f4ce49ed58c5e6e5fd778796bcdec70461 refs/heads/smart_dumb_in_TRANSLATION_NOTE
0000Connection to github.com closed by remote host.

If we add one byte for '\n', then all lines are correct but the first line.
So I check the result in vim, and find a '0x00' after '06-github-4-managing-org', then it make sense.

00ca82d2b8601d253dd1df545d66543d12adba06f73c refs/heads/06-github-4-managing-org*0x00*report-status delete-refs side-band-64k quiet atomic ofs-delta agent=git/2:2.4.0~peff-faster-fetch-pruning-1043-gc837c96

but when I look at the examples in progit2, the length of the first line even larger than the 4 chars says.

Is this a mistake, or I misunderstand something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions