3 test_description='git am handling submodules'
6 . "$TEST_DIRECTORY"/lib-submodule-update.sh
9 git format-patch --stdout --ignore-submodules=dirty "..$1" >patch &&
10 may_only_be_test_must_fail "$2" &&
14 test_submodule_switch_func "am"
17 git format-patch --stdout --ignore-submodules=dirty "..$1" >patch &&
18 may_only_be_test_must_fail "$2" &&
19 $2 git am --3way patch
22 KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
23 test_submodule_switch_func "am_3way"
25 test_expect_success 'setup diff.submodule' '
27 INITIAL=$(git rev-parse HEAD) &&
33 git rev-parse HEAD >../initial-submodule
35 git submodule add ./submodule &&
36 git commit -m first &&
41 git rev-parse HEAD >../first-submodule
44 git commit -m second &&
45 SECOND=$(git rev-parse HEAD) &&
49 git mv two.t four.t &&
50 git commit -m "second submodule" &&
51 git rev-parse HEAD >../second-submodule
55 git commit --amend --no-edit &&
56 THIRD=$(git rev-parse HEAD) &&
57 git submodule update --init
63 # Abort any merges in progress: the previous
64 # test may have failed, and we should clean up.
65 test_might_fail git am --abort &&
66 git reset --hard $START_COMMIT &&
68 git format-patch -1 &&
69 git reset --hard $START_COMMIT^ &&
70 git submodule update &&
72 git submodule update &&
73 git -C submodule rev-parse HEAD >actual &&
74 test_cmp $EXPECT actual
77 test_expect_success 'diff.submodule unset' '
78 test_unconfig diff.submodule &&
79 run_test $SECOND first-submodule
82 test_expect_success 'diff.submodule unset with extra file' '
83 test_unconfig diff.submodule &&
84 run_test $THIRD second-submodule
87 test_expect_success 'diff.submodule=log' '
88 test_config diff.submodule log &&
89 run_test $SECOND first-submodule
92 test_expect_success 'diff.submodule=log with extra file' '
93 test_config diff.submodule log &&
94 run_test $THIRD second-submodule