-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support clients that don't enable side-band or side-band-64k #41
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When the client doesn't request sideband information, the report should be sent directly, not in a sideband message, and there should be no other sideband messages (i.e. from index-pack).
Most git clients enable the side-band or side-band-64k capability. When they do this, the report ("unpack ok" and per-ref status) will be sent nested in a sideband 1 packet. However, git clients aren't required to do this, and when they don't the report is supposed to be written without getting nested. So that's what this change does.
The empty pack is the same for all of these tests, so we can generate it once, store it in the repo, and avoid the complexity of shelling out to git during the tests. Here's how I generated the file: $ git pack-objects --revs --stdout > internal/integration/testdata/empty.pack </dev/null Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
bk2204
approved these changes
Apr 6, 2023
When reading the output from spokes-receive-pack, sometimes we get "file already closed" instead of EOF at the end of the output. In that case, when there is some data, just log the error and proceed to parsing the data. This is an attempt to fix or at least learn more about errors like the one in https://github.com/github/spokes-receive-pack/actions/runs/4629813916/jobs/8190557968.
spraints
force-pushed
the
better-sideband-support
branch
from
April 6, 2023 14:30
0bf6139
to
1c65fc2
Compare
bk2204
approved these changes
Apr 6, 2023
spraints
commented
Apr 6, 2023
Comment on lines
-64
to
+68
return nil, "", nil, err | ||
if len(data) > 0 { | ||
t.Logf("got data, but there was an error: %v", err) | ||
} else { | ||
return nil, "", nil, err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change works around a similar problem to the one described in hashicorp/go-plugin#116, where there's a race between reads from a pipe and exec.Cmd.Wait
closing the pipe after the process exits.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some clients don't request side-band data when doing a push. In those cases, spokes-receive-pack needs to write the report only, without nesting it in a sideband packet. spokes-receive-pack was already handling index-pack output correctly, though it doesn't need to pass as many flags when the sideband is disabled.