From e0cb8047a81abc8b9d9dbf864c33874cd094b899 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 17:31:04 -1000 Subject: Share the rename fixture of the diff pages Each repository is built tree for tree as before. A helper that lost the caller's change would still fail t0107, where following no path shows file-1, but t0108 passed without its added line, so it now looks for that line. --- tests/t0108-rawdiff.sh | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'tests/t0108-rawdiff.sh') diff --git a/tests/t0108-rawdiff.sh b/tests/t0108-rawdiff.sh index afd1ff1..23a41b4 100755 --- a/tests/t0108-rawdiff.sh +++ b/tests/t0108-rawdiff.sh @@ -46,24 +46,18 @@ test_expect_success 'a path limits the diff to that file' ' ' # The old name of a file renamed in the change joins the limit, so the diff -# shows the rename, the same as git diff given both names. +# shows the rename, the same as git diff given both names. The rename adds a +# line too, so git has to pair the files by similarity rather than as an +# exact match, and the last grep makes sure the line is there. test_expect_success 'a renamed file is diffed as the rename' ' - mkrepo repos/moved 1 && - ( - cd repos/moved && - test_seq 1 10 >old.txt && - git add old.txt && - git commit -m "add old.txt" && - git mv old.txt new.txt && - echo eleven >>new.txt && - git commit -am "rename old.txt" - ) && + mkrepo_renamed repos/moved "echo eleven >>new.txt" && cgitrc_repo movedrc moved && cgit_ok movedrc "url=moved/rawdiff/new.txt" >tmp && git -C repos/moved diff HEAD^ HEAD -- old.txt new.txt >expect && strip_headers actual && test_cmp expect actual && - grep "^rename from old.txt$" actual + grep "^rename from old.txt$" actual && + grep "^+eleven$" actual ' test_done -- cgit 2.12.1