Commit Diff


commit - 40b43a5915484b2bf64f38e763644c30bbc495ec
commit + 82c62cc1cadf05ba127155050e1dc8c784e3a55c
blob - /dev/null
blob + e99cd7778836f31225cdf34ae45effa225429fe6 (mode 644)
--- /dev/null
+++ regress/gotwebd/action_commits.html
@@ -0,0 +1,10 @@
+Content-Security-Policy: default-src 'self'; script-src 'none'; object-src 'none';

+Content-Type: text/html

+

+<!doctype html><html><head><meta charset="utf-8" /><title>Gotweb</title><meta name="viewport" content="initial-scale=1.0" /><meta name="msapplication-TileColor" content="#da532c" /><meta name="theme-color" content="#ffffff"/><link rel="apple-touch-icon" sizes="180x180" href="/gotwebd_test_harness/apple-touch-icon.png" /><link rel="icon" type="image/png" sizes="32x32" href="/gotwebd_test_harness/favicon-32x32.png" /><link rel="icon" type="image/png" sizes="16x16" href="/gotwebd_test_harness/favicon-16x16.png" /><link rel="manifest" href="/gotwebd_test_harness/site.webmanifest"/><link rel="mask-icon" href="/gotwebd_test_harness/safari-pinned-tab.svg" /><link rel="stylesheet" type="text/css" href="/gotwebd_test_harness/gotweb.css" /></head><body><header id="header"><div id="got_link"><a href="https://gameoftrees.org" target="_blank"><img src="/gotwebd_test_harness/got.png" /></a></div></header><nav id="site_path"><div id="site_link"><a href="?index_page=0">Repos</a> / <a href="?action=summary&path=repo.git">repo.git</a> / <a href="?action=commits&path=repo.git">commits</a> / </div></nav><main class="action-commits"><header class="subtitle"><h2>Commits</h2></header><div class="commits_content"><div class="page_header_wrapper"><dl><dt>Commit:</dt><dd><code class="commit-id">${COMMIT_ID_HEAD}</code></dd><dt>From:</dt><dd>${COMMITTER} &lt;${COMMITTER_EMAIL}&gt;</dd><dt>Date:</dt><dd><time datetime="${COMMIT_YMDHMS_HEAD}">${COMMIT_DATE_HEAD}
+ UTC</time></dd></dl></div><hr /><div class="commit">
+edit alpha
+</div><div class="navs_wrapper"><div class="navs"><a href="?action=diff&commit=${COMMIT_ID_HEAD}&path=repo.git">diff</a> | <a href="?action=patch&commit=${COMMIT_ID_HEAD}&path=repo.git">patch</a> | <a href="?action=tree&commit=${COMMIT_ID_HEAD}&path=repo.git">tree</a></div></div><hr /><div class="page_header_wrapper"><dl><dt>Commit:</dt><dd><code class="commit-id">${COMMIT_ID_ROOT}</code></dd><dt>From:</dt><dd>${COMMITTER} &lt;${COMMITTER_EMAIL}&gt;</dd><dt>Date:</dt><dd><time datetime="${COMMIT_YMDHMS_ROOT}">${COMMIT_DATE_ROOT}
+ UTC</time></dd></dl></div><hr /><div class="commit">
+import the test tree
+</div><div class="navs_wrapper"><div class="navs"><a href="?action=diff&commit=${COMMIT_ID_ROOT}&path=repo.git">diff</a> | <a href="?action=patch&commit=${COMMIT_ID_ROOT}&path=repo.git">patch</a> | <a href="?action=tree&commit=${COMMIT_ID_ROOT}&path=repo.git">tree</a></div></div><hr /></div></main><footer id="site_owner_wrapper"><p id="site_owner">Got Owner</p></footer></body></html>

blob - 8f78b57f9900faadbb1db98d18edd34fa65506da
blob + b73944cea1e14f59a1b3054e5b4967ca262a3f6b
--- regress/gotwebd/test_gotwebd.sh
+++ regress/gotwebd/test_gotwebd.sh
@@ -159,9 +159,53 @@ test_gotwebd_action_patch()
 	test_done "$testroot" "$repo" "$ret"
 }
 
+test_gotwebd_action_commits()
+{
+	local testroot=$(test_init gotwebd_action_commits 1)
+	local repo="${GOTWEBD_TEST_CHROOT}/got/public/repo.git"
+	local author_time_root=$(git_show_author_time $repo)
+	local id_root=$(git_show_head $repo)
+	local qs="action=commits&headref=HEAD&path=repo.git"
+
+	got checkout $repo $testroot/wt > /dev/null
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		test_done "$testroot" "$ret"
+		return 1
+	fi
+
+	echo "'alpha" > $testroot/wt/alpha
+	(cd $testroot/wt && got commit -m "edit alpha" >/dev/null)
+
+	local author_time_head=$(git_show_author_time $repo)
+
+	COMMITTER="Flan Hacker" \
+	COMMIT_ID_ROOT=$id_root \
+	COMMIT_ID_HEAD=$(git_show_head $repo) \
+	COMMITTER_EMAIL="flan_hacker@openbsd.org" \
+	COMMIT_YMDHMS_ROOT=$(date -u -r $author_time_root +"%FT%TZ") \
+	COMMIT_YMDHMS_HEAD=$(date -u -r $author_time_head +"%FT%TZ") \
+	COMMIT_DATE_ROOT=$(date -u -r $author_time_root +"%a %b %e %X %Y") \
+	COMMIT_DATE_HEAD=$(date -u -r $author_time_head +"%a %b %e %X %Y") \
+	interpolate action_commits.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_summary
 run_test test_gotwebd_action_diff
 run_test test_gotwebd_action_blame
 run_test test_gotwebd_action_tree
 run_test test_gotwebd_action_patch
+run_test test_gotwebd_action_commits