]> git.ipfire.org Git - thirdparty/git.git/blob - t/t2009-checkout-statinfo.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t2009-checkout-statinfo.sh
1 #!/bin/sh
2
3 test_description='checkout should leave clean stat info'
4
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
10
11 test_expect_success 'setup' '
12
13 echo hello >world &&
14 git update-index --add world &&
15 git commit -m initial &&
16 git branch side &&
17 echo goodbye >world &&
18 git update-index --add world &&
19 git commit -m second
20
21 '
22
23 test_expect_success 'branch switching' '
24
25 git reset --hard &&
26 test "$(git diff-files --raw)" = "" &&
27
28 git checkout main &&
29 test "$(git diff-files --raw)" = "" &&
30
31 git checkout side &&
32 test "$(git diff-files --raw)" = "" &&
33
34 git checkout main &&
35 test "$(git diff-files --raw)" = ""
36
37 '
38
39 test_expect_success 'path checkout' '
40
41 git reset --hard &&
42 test "$(git diff-files --raw)" = "" &&
43
44 git checkout main world &&
45 test "$(git diff-files --raw)" = "" &&
46
47 git checkout side world &&
48 test "$(git diff-files --raw)" = "" &&
49
50 git checkout main world &&
51 test "$(git diff-files --raw)" = ""
52
53 '
54
55 test_done
56