3 test_description='git am handling submodules'
6 . "$TEST_DIRECTORY"/lib-submodule-update.sh
9 git format-patch --stdout --ignore-submodules=dirty "..$1" | git am -
12 test_submodule_switch "am"
15 git format-patch --stdout --ignore-submodules=dirty "..$1" | git am --3way -
18 KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
19 test_submodule_switch "am_3way"
21 test_expect_success 'setup diff.submodule' '
23 INITIAL=$(git rev-parse HEAD) &&
29 git rev-parse HEAD >../initial-submodule
31 git submodule add ./submodule &&
32 git commit -m first &&
37 git rev-parse HEAD >../first-submodule
40 git commit -m second &&
41 SECOND=$(git rev-parse HEAD) &&
45 git mv two.t four.t &&
46 git commit -m "second submodule" &&
47 git rev-parse HEAD >../second-submodule
51 git commit --amend --no-edit &&
52 THIRD=$(git rev-parse HEAD) &&
53 git submodule update --init
59 # Abort any merges in progress: the previous
60 # test may have failed, and we should clean up.
61 test_might_fail git am --abort &&
62 git reset --hard $START_COMMIT &&
64 git format-patch -1 &&
65 git reset --hard $START_COMMIT^ &&
66 git submodule update &&
68 git submodule update &&
69 git -C submodule rev-parse HEAD >actual &&
70 test_cmp $EXPECT actual
73 test_expect_success 'diff.submodule unset' '
74 test_unconfig diff.submodule &&
75 run_test $SECOND first-submodule
78 test_expect_success 'diff.submodule unset with extra file' '
79 test_unconfig diff.submodule &&
80 run_test $THIRD second-submodule
83 test_expect_success 'diff.submodule=log' '
84 test_config diff.submodule log &&
85 run_test $SECOND first-submodule
88 test_expect_success 'diff.submodule=log with extra file' '
89 test_config diff.submodule log &&
90 run_test $THIRD second-submodule