3 test_description
='git am handling submodules'
5 TEST_PASSES_SANITIZE_LEAK
=true
7 .
"$TEST_DIRECTORY"/lib-submodule-update.sh
10 git format-patch
--stdout --ignore-submodules=dirty
"..$1" >patch &&
11 may_only_be_test_must_fail
"$2" &&
15 test_submodule_switch_func
"am"
18 git format-patch
--stdout --ignore-submodules=dirty
"..$1" >patch &&
19 may_only_be_test_must_fail
"$2" &&
20 $2 git am
--3way patch
23 KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES
=1
24 test_submodule_switch_func
"am_3way"
26 test_expect_success
'setup diff.submodule' '
28 INITIAL=$(git rev-parse HEAD) &&
34 git rev-parse HEAD >../initial-submodule
36 git submodule add ./submodule &&
37 git commit -m first &&
42 git rev-parse HEAD >../first-submodule
45 git commit -m second &&
46 SECOND=$(git rev-parse HEAD) &&
50 git mv two.t four.t &&
51 git commit -m "second submodule" &&
52 git rev-parse HEAD >../second-submodule
56 git commit --amend --no-edit &&
57 THIRD=$(git rev-parse HEAD) &&
58 git submodule update --init
64 # Abort any merges in progress: the previous
65 # test may have failed, and we should clean up.
66 test_might_fail git am
--abort &&
67 git
reset --hard $START_COMMIT &&
69 git format-patch
-1 &&
70 git
reset --hard $START_COMMIT^
&&
71 git submodule update
&&
73 git submodule update
&&
74 git
-C submodule rev-parse HEAD
>actual
&&
75 test_cmp
$EXPECT actual
78 test_expect_success
'diff.submodule unset' '
79 test_unconfig diff.submodule &&
80 run_test $SECOND first-submodule
83 test_expect_success
'diff.submodule unset with extra file' '
84 test_unconfig diff.submodule &&
85 run_test $THIRD second-submodule
88 test_expect_success
'diff.submodule=log' '
89 test_config diff.submodule log &&
90 run_test $SECOND first-submodule
93 test_expect_success
'diff.submodule=log with extra file' '
94 test_config diff.submodule log &&
95 run_test $THIRD second-submodule