]> git.ipfire.org Git - thirdparty/git.git/commit
t7505: add tests for cherry-pick and rebase -i/-p
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Wed, 24 Jan 2018 12:34:21 +0000 (12:34 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Jan 2018 19:01:15 +0000 (11:01 -0800)
commit15cd6d3a259c3c6d8b16ffa4793505720db45e0c
tree087f66ef8cf2fcf7de4b279d22f565fc36c2de6e
parent4f8cbf2b46c22c4078ae0be1b6460d2eb100b21d
t7505: add tests for cherry-pick and rebase -i/-p

Check that cherry-pick and rebase call the 'prepare-commit-msg' hook
correctly. The expected values for the hook arguments are taken to
match the current master branch. I think there is scope for improving
the arguments passed so they make a bit more sense - for instance
cherry-pick currently passes different arguments depending on whether
the commit message is being edited. Also the arguments for rebase
could be improved. Commit 7c4188360ac ("rebase -i: proper
prepare-commit-msg hook argument when squashing", 2008-10-3) apparently
changed things so that when squashing rebase would pass 'squash' as
the argument to the hook but that has been lost.

I think that it would make more sense to pass 'message' for revert and
cherry-pick -x/-s (i.e. cases where there is a new message or the
current message in modified by the command), 'squash' when squashing
with a new message and 'commit HEAD/CHERRY_PICK_HEAD'
otherwise (picking and squashing without a new message).

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7505-prepare-commit-msg-hook.sh
t/t7505/expected-rebase-i [new file with mode: 0644]
t/t7505/expected-rebase-p [new file with mode: 0644]