Skip to content

Commit 8f8ba56

Browse files
jlehmanngitster
authored andcommitted
bisect: add t6041 for submodule updates
Test that the bisect command updates the work tree as expected. To make that work with the new submodule test framework a git_bisect helper function is added. This adds a commit after the one given to be switched to and makes that one the bad commit. The starting point is then given to bisect as the good commit which makes bisect change the work tree to the commit in between, which is the commit given. Signed-off-by: Jens Lehmann <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8ef8569 commit 8f8ba56

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

t/t6041-bisect-submodule.sh

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
test_description='bisect can handle submodules'
4+
5+
. ./test-lib.sh
6+
. "$TEST_DIRECTORY"/lib-submodule-update.sh
7+
8+
git_bisect () {
9+
git status -su >expect &&
10+
ls -1pR * >>expect &&
11+
tar czf "$TRASH_DIRECTORY/tmp.tgz" * &&
12+
GOOD=$(git rev-parse --verify HEAD) &&
13+
git checkout "$1" &&
14+
echo "foo" >bar &&
15+
git add bar &&
16+
git commit -m "bisect bad" &&
17+
BAD=$(git rev-parse --verify HEAD) &&
18+
git reset --hard HEAD^^ &&
19+
git submodule update &&
20+
git bisect start &&
21+
git bisect good $GOOD &&
22+
rm -rf * &&
23+
tar xzf "$TRASH_DIRECTORY/tmp.tgz" &&
24+
git status -su >actual &&
25+
ls -1pR * >>actual &&
26+
test_cmp expect actual &&
27+
git bisect bad $BAD
28+
}
29+
30+
test_submodule_switch "git_bisect"
31+
32+
test_done

0 commit comments

Comments
 (0)