Git 2.46-rc1
[alt-git.git] / t / t6041-bisect-submodule.sh
blob3946e18089a2a50a2a7a6433d462a7c97546a384
1 #!/bin/sh
3 test_description='bisect can handle submodules'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7 . "$TEST_DIRECTORY"/lib-submodule-update.sh
9 git_bisect () {
10 git status -su >expect &&
11 ls -1pR * >>expect &&
12 "$TAR" cf "$TRASH_DIRECTORY/tmp.tar" * &&
13 GOOD=$(git rev-parse --verify HEAD) &&
14 may_only_be_test_must_fail "$2" &&
15 $2 git checkout "$1" &&
16 if test -n "$2"
17 then
18 return
19 fi &&
20 echo "foo" >bar &&
21 git add bar &&
22 git commit -m "bisect bad" &&
23 BAD=$(git rev-parse --verify HEAD) &&
24 git reset --hard HEAD^^ &&
25 git submodule update &&
26 git bisect start &&
27 git bisect good $GOOD &&
28 rm -rf * &&
29 "$TAR" xf "$TRASH_DIRECTORY/tmp.tar" &&
30 git status -su >actual &&
31 ls -1pR * >>actual &&
32 test_cmp expect actual &&
33 git bisect bad $BAD
36 test_submodule_switch_func "git_bisect"
38 test_done