cherry-pick: add t3512 for submodule updates

Test that the cherry-pick command updates the work tree as expected (for
submodule changes which don't result in conflicts).

Set KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES
and KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR to
document that cherry-pick has the same --no-ff known failures merge has.

Implement the KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT switch to expect
the known failure that while cherry picking just a SHA-1 update for an
ignored submodule the commit incorrectly fails with "The previous
cherry-pick is now empty, possibly due to conflict resolution.".

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jens Lehmann 2014-06-15 19:03:18 +02:00 коммит произвёл Junio C Hamano
Родитель 921f50b48e
Коммит 283f56a40b
2 изменённых файлов: 25 добавлений и 3 удалений

Просмотреть файл

@ -402,7 +402,16 @@ test_submodule_switch () {
########################## Modified submodule #########################
# Updating a submodule sha1 doesn't update the submodule's work tree
test_expect_success "$command: modified submodule does not update submodule work tree" '
if test "$KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT" = 1
then
# When cherry picking a SHA-1 update for an ignored submodule
# the commit incorrectly fails with "The previous cherry-pick
# is now empty, possibly due to conflict resolution."
RESULT="failure"
else
RESULT="success"
fi
test_expect_$RESULT "$command: modified submodule does not update submodule work tree" '
prolog &&
reset_work_tree_to add_sub1 &&
(
@ -418,7 +427,7 @@ test_submodule_switch () {
# Updating a submodule to an invalid sha1 doesn't update the
# submodule's work tree, subsequent update will fail
test_expect_success "$command: modified submodule does not update submodule work tree to invalid commit" '
test_expect_$RESULT "$command: modified submodule does not update submodule work tree to invalid commit" '
prolog &&
reset_work_tree_to add_sub1 &&
(
@ -433,7 +442,7 @@ test_submodule_switch () {
'
# Updating a submodule from an invalid sha1 doesn't update the
# submodule's work tree, subsequent update will succeed
test_expect_success "$command: modified submodule does not update submodule work tree from invalid commit" '
test_expect_$RESULT "$command: modified submodule does not update submodule work tree from invalid commit" '
prolog &&
reset_work_tree_to invalid_sub1 &&
(

Просмотреть файл

@ -0,0 +1,13 @@
#!/bin/sh
test_description='cherry-pick can handle submodules'
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh
KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT=1
KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
test_submodule_switch "git cherry-pick"
test_done