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>
Jens Lehmann committed
Jun 15, 2014 at 19:03 UTC
283f56a40bd9538d7277bb866526d5cae4494eec
2 files changed
+25
-3
t/lib-submodule-update.sh
+12
-3
@@ -402,7 +402,16 @@ test_submodule_switch () {
402
403
########################## Modified submodule #########################
404
# Updating a submodule sha1 doesn't update the submodule's work tree
405
- test_expect_success "$command: modified submodule does not update submodule work tree" '
405
+ if test "$KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT" = 1
406
+ then
407
+ # When cherry picking a SHA-1 update for an ignored submodule
408
+ # the commit incorrectly fails with "The previous cherry-pick
409
+ # is now empty, possibly due to conflict resolution."
410
+ RESULT="failure"
411
+ else
412
+ RESULT="success"
413
+ fi
414
+ test_expect_$RESULT "$command: modified submodule does not update submodule work tree" '
415
prolog &&
416
reset_work_tree_to add_sub1 &&
417
(
@@ -418,7 +427,7 @@ test_submodule_switch () {
427
428
# Updating a submodule to an invalid sha1 doesn't update the
429
# submodule's work tree, subsequent update will fail
421
- test_expect_success "$command: modified submodule does not update submodule work tree to invalid commit" '
430
+ test_expect_$RESULT "$command: modified submodule does not update submodule work tree to invalid commit" '
431
prolog &&
432
reset_work_tree_to add_sub1 &&
433
(
@@ -433,7 +442,7 @@ test_submodule_switch () {
442
'
443
# Updating a submodule from an invalid sha1 doesn't update the
444
# submodule's work tree, subsequent update will succeed
436
- test_expect_success "$command: modified submodule does not update submodule work tree from invalid commit" '
445
+ test_expect_$RESULT "$command: modified submodule does not update submodule work tree from invalid commit" '
446
prolog &&
447
reset_work_tree_to invalid_sub1 &&
448
(
t/t3512-cherry-pick-submodule.sh
new
+13
@@ -0,0 +1,13 @@
1
+#!/bin/sh
2
+
3
+test_description='cherry-pick can handle submodules'
4
+
5
+. ./test-lib.sh
6
+. "$TEST_DIRECTORY"/lib-submodule-update.sh
7
+
8
+KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT=1
9
+KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
10
+KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
11
+test_submodule_switch "git cherry-pick"
12
+
13
+test_done