commit - cf31b4749a965b44fa03a3c98bdfc8b60f2c987d
commit + baaae61518bf323d22055a3b02fc9e129ee6d567
blob - 8f00f2699c2d87d84a815df4188c27ed9fcc45c0
blob + e4c9601581a5f7e5f5944692c0f36c0130bacfdd
--- gotd/session.c
+++ gotd/session.c
if (err) {
if (err->code == GOT_ERR_PRIVSEP_READ)
err = NULL;
+ else if (err->code == GOT_ERR_EOF &&
+ client->state == GOTD_STATE_EXPECT_CAPABILITIES) {
+ /*
+ * The client has closed its socket before
+ * sending its capability announcement.
+ * This can happen when Git clients have
+ * no ref-updates to send.
+ */
+ disconnect_on_error(client, err);
+ return;
+ }
break;
}
blob - 3d1c9a901f008fc32a17f1ab6a9abc5b444cf986
blob + b811009e08d9088194ccc086a17fcecac0da7fde
--- lib/serve.c
+++ lib/serve.c
if (err)
goto done;
if (n == 0) {
- if (curstate != STATE_EXPECT_MORE_REF_UPDATES) {
+ if (curstate == STATE_EXPECT_REF_UPDATE) {
+ /* The client will not send us anything. */
+ goto done;
+ } else if (curstate != STATE_EXPECT_MORE_REF_UPDATES) {
err = got_error_msg(GOT_ERR_BAD_PACKET,
"unexpected flush packet received");
goto done;
blob - daff924b47ca360160665215790f700bf0f8bfda
blob + 4ae6fbc520b21e761719a82232e309e8e3747239
--- regress/gotd/repo_write.sh
+++ regress/gotd/repo_write.sh
ret=$?
if [ $ret -ne 0 ]; then
echo "git pull failed unexpectedly" >&2
+ test_done "$testroot" "1"
+ return 1
+ fi
+
+ # Verify that git push reports no changes to send and no error.
+ (cd $testroot/repo-clone3 && git push -q > $testroot/stdout \
+ 2> $testroot/stderr)
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "git push failed unexpectedly" >&2
test_done "$testroot" "1"
return 1
fi