Commit Diff


commit - 0938a7e202849b4c8369dac2e1583f4c686ba3e4
commit + 9d61c99e2526730cfa5f256a3b0c37bfb25b8f93
blob - 946a1a9daf14abccfa57afc447900e83866d270e
blob + d143da08fa8639d8eb2ba879f6b978f52b91e613
--- gotd/session_write.c
+++ gotd/session_write.c
@@ -1341,7 +1341,8 @@ session_dispatch_client(int fd, short events, void *ar
 
 	if (err) {
 		if (err->code != GOT_ERR_EOF ||
-		    gotd_session.state != GOTD_STATE_EXPECT_PACKFILE)
+		    (gotd_session.state != GOTD_STATE_EXPECT_PACKFILE &&
+		    gotd_session.state != GOTD_STATE_NOTIFY))
 			disconnect_on_error(client, err);
 	} else {
 		gotd_imsg_event_add(iev);
blob - 33fbf586ff94a94ca7f4a10f06a3814106db946d
blob + daa3a3c53c47d2e2f9f1506b58b3ea5def124c05
--- regress/gotd/http_notification.sh
+++ regress/gotd/http_notification.sh
@@ -106,7 +106,73 @@ test_file_changed() {
 		test_done "$testroot" "$ret"
 		return 1
 	fi
+
+	# Try the same thing again with 'git push' instead of 'got send'
+	echo "change alpha once more" > $testroot/wt/alpha
+	(cd $testroot/wt && got commit -m 'make more changes' > /dev/null)
+	local commit_id=`git_show_head $testroot/repo-clone`
+	local author_time=`git_show_author_time $testroot/repo-clone`
+
+	timeout 5 ./http-server -a $AUTH -p $GOTD_TEST_HTTP_PORT \
+	    > $testroot/stdout &
+
+	git -C $testroot/repo-clone push -q origin main
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		echo "git push failed unexpectedly" >&2
+		test_done "$testroot" "1"
+		return 1
+	fi
+
+	wait %1 # wait for the http "server"
+
+	echo -n > "$testroot/stdout.expected"
+	ed -s "$testroot/stdout.expected" <<-EOF
+	a
+	{"notifications":[{
+		"type":"commit",
+		"short":false,
+		"repo":"test-repo",
+		"auth_user":"${GOTD_DEVUSER}",
+		"id":"$commit_id",
+		"author":{
+			"full":"$GOT_AUTHOR",
+			"name":"$GIT_AUTHOR_NAME",
+			"mail":"$GIT_AUTHOR_EMAIL",
+			"user":"$GOT_AUTHOR_11"
+		},
+		"committer":{
+			"full":"$GOT_AUTHOR",
+			"name":"$GIT_AUTHOR_NAME",
+			"mail":"$GIT_AUTHOR_EMAIL",
+			"user":"$GOT_AUTHOR_11"
+		},
+		"date":$author_time,
+		"short_message":"make more changes",
+		"message":"make more changes\n",
+		"diffstat":{
+			"files":[{
+				"action":"modified",
+				"file":"alpha",
+				"added":1,
+				"removed":1
+			}],
+			"total":{
+				"added":1,
+				"removed":1
+			}
+		}
+	}]}
+	.
+	,j
+	w
+	EOF
 
+	cmp -s $testroot/stdout.expected $testroot/stdout
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		diff -u $testroot/stdout.expected $testroot/stdout
+	fi
 	test_done "$testroot" "$ret"
 }