all repos — cgit @ b5b1f0715ad2e5db133c7f14217a14c0bffcd8ac

a hyperfast web frontend for git written in c

tests/t0108-patch.sh (view raw)

 1#!/bin/sh
 2
 3test_description='Check content on patch page'
 4. ./setup.sh
 5
 6test_expect_success 'generate foo/patch' '
 7	cgit_query "url=foo/patch" >tmp
 8'
 9
10test_expect_success 'find `From:` line' '
11	grep "^From: " tmp
12'
13
14test_expect_success 'find `Date:` line' '
15	grep "^Date: " tmp
16'
17
18test_expect_success 'find `Subject:` line' '
19	grep "^Subject: commit 5" tmp
20'
21
22test_expect_success 'find `cgit` signature' '
23	tail -2 tmp | head -1 | grep "^cgit"
24'
25
26test_expect_success 'compare with output of git-format-patch(1)' '
27	CGIT_VERSION=$(sed -n "s/CGIT_VERSION = //p" ../../VERSION)
28	git --git-dir="$PWD/repos/foo/.git" format-patch -p --subject-prefix="" --signature="cgit $CGIT_VERSION" --stdout HEAD^ >tmp2
29	sed "1,5d" tmp >tmp_
30	cmp tmp_ tmp2
31'
32
33test_expect_success 'find initial commit' '
34	root=$(git --git-dir="$PWD/repos/foo/.git" rev-list --max-parents=0 HEAD)
35'
36
37test_expect_success 'generate patch for initial commit' '
38	cgit_query "url=foo/patch&id=$root" >tmp
39'
40
41test_expect_success 'find `cgit` signature' '
42	tail -2 tmp | head -1 | grep "^cgit"
43'
44
45test_done