diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-08-10 02:18:16 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-08-10 02:18:16 +0300 |
commit | e8c53ff91282861d4efe5d807129a55e193e6451 (patch) | |
tree | ab211df1696719021339b621c31ad26ddd32585d /t/test-lib-functions.sh | |
parent | 8cdd5e713d7ba54b9d26ac997408bb745ab55088 (diff) | |
parent | 6ce7afe16384b741f1ee4c5f310fa4a9f66348ba (diff) |
Merge branch 'pw/rebase-skip-commit-message-fix'
"git rebase -i" with a series of squash/fixup, when one of the
steps stopped in conflicts and ended up getting skipped, did not
handle the accumulated commit log messages, which has been
corrected.
* pw/rebase-skip-commit-message-fix:
rebase --skip: fix commit message clean up when skipping squash
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r-- | t/test-lib-functions.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 2fa716c567..2f8868caa1 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1291,6 +1291,39 @@ test_cmp_rev () { fi } +# Tests that a commit message matches the expected text +# +# Usage: test_commit_message <rev> [-m <msg> | <file>] +# +# When using "-m" <msg> will have a line feed appended. If the second +# argument is omitted then the expected message is read from stdin. + +test_commit_message () { + local msg_file=expect.msg + + case $# in + 3) + if test "$2" = "-m" + then + printf "%s\n" "$3" >"$msg_file" + else + BUG "Usage: test_commit_message <rev> [-m <message> | <file>]" + fi + ;; + 2) + msg_file="$2" + ;; + 1) + cat >"$msg_file" + ;; + *) + BUG "Usage: test_commit_message <rev> [-m <message> | <file>]" + ;; + esac + git show --no-patch --pretty=format:%B "$1" -- >actual.msg && + test_cmp "$msg_file" actual.msg +} + # Compare paths respecting core.ignoreCase test_cmp_fspath () { if test "x$1" = "x$2" |