@@ -238,10 +238,57 @@ test_expect_success 'commit --fixup provides correct one-line commit message' '
238238 commit_msg_is "fixup! target message subject line"
239239'
240240
241+ test_expect_success ' commit --squash works with -F' '
242+ commit_for_rebase_autosquash_setup &&
243+ echo "log message from file" >msgfile &&
244+ git commit --squash HEAD~1 -F msgfile &&
245+ commit_msg_is "squash! target message subject linelog message from file"
246+ '
247+
248+ test_expect_success ' commit --squash works with -m' '
249+ commit_for_rebase_autosquash_setup &&
250+ git commit --squash HEAD~1 -m "foo bar\nbaz" &&
251+ commit_msg_is "squash! target message subject linefoo bar\nbaz"
252+ '
253+
254+ test_expect_success ' commit --squash works with -C' '
255+ commit_for_rebase_autosquash_setup &&
256+ git commit --squash HEAD~1 -C HEAD &&
257+ commit_msg_is "squash! target message subject lineintermediate commit"
258+ '
259+
260+ test_expect_success ' commit --squash works with -c' '
261+ commit_for_rebase_autosquash_setup &&
262+ test_set_editor "$TEST_DIRECTORY"/t7500/edit-content &&
263+ git commit --squash HEAD~1 -c HEAD &&
264+ commit_msg_is "squash! target message subject lineedited commit"
265+ '
266+
267+ test_expect_success ' commit --squash works with -C for same commit' '
268+ commit_for_rebase_autosquash_setup &&
269+ git commit --squash HEAD -C HEAD &&
270+ commit_msg_is "squash! intermediate commit"
271+ '
272+
273+ test_expect_success ' commit --squash works with -c for same commit' '
274+ commit_for_rebase_autosquash_setup &&
275+ test_set_editor "$TEST_DIRECTORY"/t7500/edit-content &&
276+ git commit --squash HEAD -c HEAD &&
277+ commit_msg_is "squash! edited commit"
278+ '
279+
280+ test_expect_success ' commit --squash works with editor' '
281+ commit_for_rebase_autosquash_setup &&
282+ test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
283+ git commit --squash HEAD~1 &&
284+ commit_msg_is "squash! target message subject linecommit message"
285+ '
286+
241287test_expect_success ' invalid message options when using --fixup' '
242288 echo changes >>foo &&
243289 echo "message" >log &&
244290 git add foo &&
291+ test_must_fail git commit --fixup HEAD~1 --squash HEAD~2 &&
245292 test_must_fail git commit --fixup HEAD~1 -C HEAD~2 &&
246293 test_must_fail git commit --fixup HEAD~1 -c HEAD~2 &&
247294 test_must_fail git commit --fixup HEAD~1 -m "cmdline message" &&
0 commit comments