Commit Diff


commit - 996bde27e7a8edfe7df47563dbfdfa2b97d69386
commit + 9b9d6a77d4925c1bac43a8a6b9ea12c207bfa6a2
blob - /dev/null
blob + 4cf74bc0381e442fee1456cf5e885442a635ec52 (mode 644)
--- /dev/null
+++ regress/gotwebd/action_patch.html
@@ -0,0 +1,36 @@
+Content-Security-Policy: default-src 'self'; script-src 'none'; object-src 'none';

+Content-Type: text/plain

+

+commit ${COMMIT_ID}
+from: ${COMMITTER} <${COMMITTER_EMAIL}>
+date: ${COMMIT_DATE} UTC
+
+import the test tree
+
+commit - /dev/null
+commit + ${COMMIT_ID}
+blob - /dev/null
+blob + ${BLOB_ALPHA} (mode 644)
+--- /dev/null
++++ alpha
+@@ -0,0 +1 @@
++alpha
+blob - /dev/null
+blob + ${BLOB_BETA} (mode 644)
+--- /dev/null
++++ beta
+@@ -0,0 +1 @@
++beta
+blob - /dev/null
+blob + ${BLOB_ZETA} (mode 644)
+--- /dev/null
++++ epsilon/zeta
+@@ -0,0 +1 @@
++zeta
+blob - /dev/null
+blob + ${BLOB_DELTA} (mode 644)
+--- /dev/null
++++ gamma/delta
+@@ -0,0 +1 @@
++delta
+

blob - f585c07b32722294e8e10ab951a1f41825e83fcf
blob + fdbff948c1319e3534e33a3f99dbae99781322d5
--- regress/gotwebd/test_gotwebd.sh
+++ regress/gotwebd/test_gotwebd.sh
@@ -128,8 +128,40 @@ test_gotwebd_action_tree()
 	test_done "$testroot" "$repo" "$ret"
 }
 
+test_gotwebd_action_patch()
+{
+	local testroot=$(test_init gotwebd_action_patch 1)
+	local repo="${GOTWEBD_TEST_CHROOT}/got/public/repo.git"
+	local id=$(git_show_head $repo)
+	local author_time=$(git_show_author_time $repo)
+	local qs="action=patch&commit=${id}&headref=HEAD&path=repo.git"
+
+	COMMIT_ID=$id \
+	BLOB_ALPHA=$(get_blob_id $repo "" alpha) \
+	BLOB_BETA=$(get_blob_id $repo "" beta) \
+	BLOB_ZETA=$(get_blob_id $repo epsilon zeta) \
+	BLOB_DELTA=$(get_blob_id $repo gamma delta) \
+	COMMITTER="Flan Hacker" \
+	COMMITTER_EMAIL="flan_hacker@openbsd.org" \
+	COMMIT_DATE=$(date -u -r $author_time +"%a %b %e %X %Y") \
+	interpolate action_patch.html > $testroot/content.expected
+
+	$GOTWEBD_TEST_FCGI -q "$qs" > $testroot/content
+
+	cmp -s $testroot/content.expected $testroot/content
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		diff -u $testroot/content.expected $testroot/content
+		test_done "$testroot" "$repo" "$ret"
+		return 1
+	fi
+
+	test_done "$testroot" "$repo" "$ret"
+}
+
 test_parseargs "$@"
 run_test test_gotwebd_action_index
 run_test test_gotwebd_action_commit
 run_test test_gotwebd_action_blame
 run_test test_gotwebd_action_tree
+run_test test_gotwebd_action_patch