From 92b4d7933252c03a995730e7d0164951254a7572 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 14:57:37 -0700 Subject: Write the diff and patch checks as the suite does git -C, test_cmp with expect and actual, and rev-list --max-parents=0 for the root commit, the forms the other files use. --- tests/t0109-patch.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'tests/t0109-patch.sh') diff --git a/tests/t0109-patch.sh b/tests/t0109-patch.sh index f37a23e..18ed501 100755 --- a/tests/t0109-patch.sh +++ b/tests/t0109-patch.sh @@ -22,14 +22,14 @@ test_expect_success 'generate foo/patch' ' ' test_expect_success 'compare with output of git-format-patch(1)' ' - git --git-dir="$PWD/repos/foo/.git" format-patch --subject-prefix="" \ - --signature="cgit" --stdout HEAD^ >tmp2 && - strip_headers tmp_ && - test_cmp tmp_ tmp2 + git -C repos/foo format-patch --subject-prefix="" \ + --signature="cgit" --stdout HEAD^ >expect && + strip_headers actual && + test_cmp expect actual ' test_expect_success 'find initial commit' ' - root=$(git --git-dir="$PWD/repos/foo/.git" rev-list --max-parents=0 HEAD) + root=$(git -C repos/foo rev-list --max-parents=0 HEAD) ' test_expect_success 'generate patch for initial commit' ' @@ -41,16 +41,16 @@ test_expect_success 'find `cgit` signature on the initial commit' ' ' test_expect_success 'generate patches for multiple commits' ' - id=$(git --git-dir="$PWD/repos/foo/.git" rev-parse HEAD) && - id2=$(git --git-dir="$PWD/repos/foo/.git" rev-parse HEAD~3) && + id=$(git -C repos/foo rev-parse HEAD) && + id2=$(git -C repos/foo rev-parse HEAD~3) && cgit_url "foo/patch&id=$id&id2=$id2" >tmp ' test_expect_success 'compare the range with git-format-patch(1)' ' - git --git-dir="$PWD/repos/foo/.git" format-patch --subject-prefix="" \ - -N --signature="cgit" --stdout HEAD~3..HEAD >tmp2 && - strip_headers tmp_ && - test_cmp tmp_ tmp2 + git -C repos/foo format-patch --subject-prefix="" \ + -N --signature="cgit" --stdout HEAD~3..HEAD >expect && + strip_headers actual && + test_cmp expect actual ' test_expect_success 'max-patch-count bounds a patch range' ' -- cgit