Merge branch 'ja/doc-synopsis-markup'
[git/gitster.git] / t / t3513-revert-submodule.sh
blobe178968b408f4b9068bcc07055ffacf781154181
1 #!/bin/sh
3 test_description='revert can handle submodules'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7 . "$TEST_DIRECTORY"/lib-submodule-update.sh
9 # Create a revert that moves from HEAD (including any test modifications to
10 # the work tree) to $1 by first checking out $1 and reverting it. Reverting
11 # the revert is the transition we test for. We tar the current work tree
12 # first so we can restore the work tree test setup after doing the checkout
13 # and revert. We test here that the restored work tree content is identical
14 # to that at the beginning. The last revert is then tested by the framework.
15 git_revert () {
16 git status -su >expect &&
17 ls -1pR * >>expect &&
18 "$TAR" cf "$TRASH_DIRECTORY/tmp.tar" * &&
19 may_only_be_test_must_fail "$2" &&
20 $2 git checkout "$1" &&
21 if test -n "$2"
22 then
23 return
24 fi &&
25 git revert HEAD &&
26 rm -rf * &&
27 "$TAR" xf "$TRASH_DIRECTORY/tmp.tar" &&
28 git status -su >actual &&
29 ls -1pR * >>actual &&
30 test_cmp expect actual &&
31 git revert HEAD
34 if test "$GIT_TEST_MERGE_ALGORITHM" != ort
35 then
36 KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
38 test_submodule_switch_func "git_revert"
40 test_done