git-http-backend icon indicating copy to clipboard operation
git-http-backend copied to clipboard

[BUG] fatal: expected flush after ref listing

Open adlternative opened this issue 1 year ago • 4 comments

I use this tool for git clone, which met a bug:

$ git-http-backend --project_root=. --git_bin_path=/home/adl/git/bin-wrappers/git
$ git clone http://localhost:8080/mono-repo.git 
Cloning into 'mono-repo'...
fatal: expected flush after ref listing

system: Linux adl 6.0.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 10 Nov 2022 21:14:24 +0000 x86_64 GNU/Linux git version: 2.38.1

adlternative avatar Nov 26 '22 02:11 adlternative

Ah, I probably know why. My local GIT_PROTOCOL=version=2

This means that git upload-pack --stateless-rpc --advertise-refs . v2 action is diff from v0/v1!

$ GIT_PROTOCOL=version=1 git upload-pack --stateless-rpc --advertise-refs .
000eversion 1
0124a0789512c5a4ae7da935cd2e419f253cb3cb4ce7 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master filter object-format=sha1 agent=git/2.38.1.280.g63bba4fdd8
003fa0789512c5a4ae7da935cd2e419f253cb3cb4ce7 refs/heads/master
0045d5aef6e4d58cfe1549adef5b436f3ace984e8c86 refs/tags/gitgui-0.10.0
00483d654be48f65545c4d3e35f5d3bbed5489820930 refs/tags/gitgui-0.10.0^{}
....

GIT_PROTOCOL=version=0 git upload-pack --stateless-rpc --advertise-refs . | head
0124a0789512c5a4ae7da935cd2e419f253cb3cb4ce7 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master filter object-format=sha1 agent=git/2.38.1.280.g63bba4fdd8
003fa0789512c5a4ae7da935cd2e419f253cb3cb4ce7 refs/heads/master
0045d5aef6e4d58cfe1549adef5b436f3ace984e8c86 refs/tags/gitgui-0.10.0
00483d654be48f65545c4d3e35f5d3bbed5489820930 refs/tags/gitgui-0.10.0^{}

$ GIT_PROTOCOL=version=2 git upload-pack --stateless-rpc --advertise-refs . | head
000eversion 2
0025agent=git/2.38.1.280.g63bba4fdd8
0013ls-refs=unborn
0027fetch=shallow wait-for-done filter
0012server-option
0017object-format=sha1
0010object-info
0000%                               

So I can presume that you haven't handled this behavior of V2 correctly.

adlternative avatar Nov 26 '22 04:11 adlternative

Ah, I probably know why. My local GIT_PROTOCOL=version=2

This means that git upload-pack --stateless-rpc --advertise-refs . v2 action is diff from v0/v1!

$ GIT_PROTOCOL=version=1 git upload-pack --stateless-rpc --advertise-refs .
000eversion 1
0124a0789512c5a4ae7da935cd2e419f253cb3cb4ce7 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master filter object-format=sha1 agent=git/2.38.1.280.g63bba4fdd8
003fa0789512c5a4ae7da935cd2e419f253cb3cb4ce7 refs/heads/master
0045d5aef6e4d58cfe1549adef5b436f3ace984e8c86 refs/tags/gitgui-0.10.0
00483d654be48f65545c4d3e35f5d3bbed5489820930 refs/tags/gitgui-0.10.0^{}
....

GIT_PROTOCOL=version=0 git upload-pack --stateless-rpc --advertise-refs . | head
0124a0789512c5a4ae7da935cd2e419f253cb3cb4ce7 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master filter object-format=sha1 agent=git/2.38.1.280.g63bba4fdd8
003fa0789512c5a4ae7da935cd2e419f253cb3cb4ce7 refs/heads/master
0045d5aef6e4d58cfe1549adef5b436f3ace984e8c86 refs/tags/gitgui-0.10.0
00483d654be48f65545c4d3e35f5d3bbed5489820930 refs/tags/gitgui-0.10.0^{}

$ GIT_PROTOCOL=version=2 git upload-pack --stateless-rpc --advertise-refs . | head
000eversion 2
0025agent=git/2.38.1.280.g63bba4fdd8
0013ls-refs=unborn
0027fetch=shallow wait-for-done filter
0012server-option
0017object-format=sha1
0010object-info
0000%                               

So I can presume that you haven't handled this behavior of V2 correctly.

Oh, it's a small bug in fact and I just fixed it, you can check the latest commit : )

Th1nkMore avatar Nov 26 '22 05:11 Th1nkMore

Ah, I probably know why. My local GIT_PROTOCOL=version=2 This means that git upload-pack --stateless-rpc --advertise-refs . v2 action is diff from v0/v1!

$ GIT_PROTOCOL=version=1 git upload-pack --stateless-rpc --advertise-refs .
000eversion 1
0124a0789512c5a4ae7da935cd2e419f253cb3cb4ce7 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master filter object-format=sha1 agent=git/2.38.1.280.g63bba4fdd8
003fa0789512c5a4ae7da935cd2e419f253cb3cb4ce7 refs/heads/master
0045d5aef6e4d58cfe1549adef5b436f3ace984e8c86 refs/tags/gitgui-0.10.0
00483d654be48f65545c4d3e35f5d3bbed5489820930 refs/tags/gitgui-0.10.0^{}
....

GIT_PROTOCOL=version=0 git upload-pack --stateless-rpc --advertise-refs . | head
0124a0789512c5a4ae7da935cd2e419f253cb3cb4ce7 HEADmulti_ack thin-pack side-band side-band-64k ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag multi_ack_detailed no-done symref=HEAD:refs/heads/master filter object-format=sha1 agent=git/2.38.1.280.g63bba4fdd8
003fa0789512c5a4ae7da935cd2e419f253cb3cb4ce7 refs/heads/master
0045d5aef6e4d58cfe1549adef5b436f3ace984e8c86 refs/tags/gitgui-0.10.0
00483d654be48f65545c4d3e35f5d3bbed5489820930 refs/tags/gitgui-0.10.0^{}

$ GIT_PROTOCOL=version=2 git upload-pack --stateless-rpc --advertise-refs . | head
000eversion 2
0025agent=git/2.38.1.280.g63bba4fdd8
0013ls-refs=unborn
0027fetch=shallow wait-for-done filter
0012server-option
0017object-format=sha1
0010object-info
0000%                               

So I can presume that you haven't handled this behavior of V2 correctly.

Oh, it's a small bug in fact and I just fixed it, you can check the latest commit : )

Cool, you did fix it, good job!

adlternative avatar Nov 26 '22 12:11 adlternative

This is awesome! Can @Th1nkMore trigger a new release so we don't have to get the master branch?

danacr avatar Sep 06 '23 06:09 danacr