Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Move the Conflicts test to the trailers tests
Its message came from a here-document with a dash, which stripped the
tab git knows a Conflicts path by. git then found no trailer block at
all, so the test passed with the guard it is about removed. The message
is now written with printf.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0206-trailers.sh | 20 | |
| -rwxr-xr-x | tests/t0303-robustness.sh | 25 |
2 files changed, 20 insertions, 25 deletions
diff --git a/tests/t0206-trailers.sh b/tests/t0206-trailers.sh index 5a8fe97..85ebc97 100755 --- a/tests/t0206-trailers.sh +++ b/tests/t0206-trailers.sh @@ -143,4 +143,24 @@ test_expect_success 'the repository flag overrides the global one' ' grep "<table class=.commit-trailers.>" tmp ' + +# git leaves an old style Conflicts section out of the block it finds, so a +# message holding one after its trailers is shown whole rather than lose the +# section to the split. git knows the section by the tab before each path, +# which a here-document with a dash would strip. +test_expect_success 'the commit page shows a message whole when text follows its trailers' ' + test_create_repo repos/conflicts && + echo content >repos/conflicts/file && + git -C repos/conflicts add file && + printf "Subject\n\nBody text.\n\nSigned-off-by: A U Thor <author@example.com>\n\nConflicts:\n\tfile\n" >msg && + git -C repos/conflicts commit -q -F "$PWD/msg" && + cgitrc_repo conflictsrc conflicts enable-commit-trailers=1 && + cgit_ok conflictsrc "url=conflicts/commit/" >tmp && + ! grep "commit-trailers" tmp && + grep "^Signed-off-by: A U Thor" tmp && + printf "Conflicts:\n\tfile\n" >expect && + sed -n "/^Conflicts:/,/^\tfile/p" tmp >actual && + test_cmp expect actual +' + test_done diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index f7409f1..016b2de 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -405,31 +405,6 @@ test_expect_success 'the blob page walks a path out of the commit or tag the id grep "^Status: 404" tmp ' -test_expect_success 'the commit page shows a message whole when text follows its trailers' ' - ( - cd repos/rob && - echo again >file-1 && - git add file-1 && - git commit -F - <<-\EOF - Subject - - Body text. - - Signed-off-by: A U Thor <author@example.com> - - Conflicts: - file-1 - EOF - ) && - { - echo "enable-commit-trailers=1" && - cat robrc - } >trailrc && - cgit_rc trailrc "url=rob/commit/" >tmp && - ! grep "commit-trailers" tmp && - grep "Conflicts:" tmp -' - test_expect_success 'a revision expression that walks the history is refused' ' cgit_rc robrc "url=rob/log/&h=:/zzzz" >tmp && grep "^Status: 404" tmp && |
