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