Skip to content

protocol: Add support for git protocol version 1

Protocol version 1 is a valid protocol that is supported by git. However, we currently only have support for versions 0 and 2. This commit expands our support to include protocol v1 as well, as there is no particular reason to disable it.

Furthermore, there are indeed some differences when pushing using v1, as compared to the output when using v0 or v2.

When pushing using v1, we got

$ GIT_TRACE_PACKET=1 git -c protocol.version=1 push git@github.com:blanet/demo.git
14:38:23.953382 pkt-line.c:85           packet:         push< version 1
14:38:23.954345 pkt-line.c:85           packet:         push< 47528871788c78cc2182219b6f3333cb401ce180 refs/heads/main\0report-status report-status-v2 delete-refs side-band-64k ofs-delta atomic object-format=sha1 quiet agent=github/spokes-receive-pack-302ef7e34db14cc0c1823fcb16b9517d4c29a87b session-id=fdba6af034c2f1e0ef3d1c5fca233a54 push-options
14:38:23.954446 pkt-line.c:85           packet:         push< 0000
14:38:23.954570 pkt-line.c:85           packet:         push> 0000
Everything up-to-date

When pushing using v0 or v2, we got

$ GIT_TRACE_PACKET=1 git -c protocol.version=2 push git@github.com:blanet/demo.git
14:37:54.596645 pkt-line.c:85           packet:         push< 47528871788c78cc2182219b6f3333cb401ce180 refs/heads/main\0report-status report-status-v2 delete-refs side-band-64k ofs-delta atomic object-format=sha1 quiet agent=github/spokes-receive-pack-302ef7e34db14cc0c1823fcb16b9517d4c29a87b session-id=7509d3b188f163aa43593dab6d0c45e6 push-options
14:37:54.598059 pkt-line.c:85           packet:         push< 0000
14:37:54.598170 pkt-line.c:85           packet:         push> 0000
Everything up-to-date
Edited by Xing Xin

Merge request reports