Skip to content

plumbing: transport server check for nil Packfile, fixes ref deletes #11

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

Merged
merged 2 commits into from
Mar 19, 2020

Conversation

brandonwestcott
Copy link

When a Remote receives a push with only delete commands, it sends a nil value for Packfile (related code), which results in a a panic: runtime error: invalid memory address or nil pointer dereference in the code below. This simply fixes that by skipping the processing if its nil.

It does seem there is already a test case covering deletes inside the ReceivePackSuite, however the test sends an empty packfile rather than sending nil.

If it would be better to update Remote to send a similar empty packfile please let me know and I'll be happy to make the update.

Also thanks for all the work here, we've been using go-git heavily for the last few weeks and its fantastic.

@mcuadros
Copy link
Member

can you provide a test for this?

@brandonwestcott brandonwestcott force-pushed the fix/empty-packfile-server branch from 836e592 to cec6ee3 Compare March 19, 2020 14:20
@mcuadros mcuadros merged commit f630513 into go-git:master Mar 19, 2020
@brandonwestcott
Copy link
Author

@mcuadros added a test for this directly inside transport/server/receive_pack_test.go.

Also the force push is because I had branched from v4, so simply rebased in current v5 master for the PR.

@brandonwestcott
Copy link
Author

@mcuadros thanks!

@brandonwestcott brandonwestcott deleted the fix/empty-packfile-server branch March 19, 2020 14:35
pjbgf referenced this pull request in pjbgf/go-git Dec 6, 2022
Return error instead of creating empty commits
traidare pushed a commit to traidare/go-git that referenced this pull request Oct 26, 2024
…server

plumbing: transport server check for nil Packfile, fixes ref deletes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants