t8*: adjust the references to the default branch name "main"
[git] / t / t1021-rerere-in-workdir.sh
1 #!/bin/sh
2
3 test_description='rerere run in a workdir'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
7 . ./test-lib.sh
8
9 test_expect_success SYMLINKS setup '
10         git config rerere.enabled true &&
11         >world &&
12         git add world &&
13         test_tick &&
14         git commit -m initial &&
15
16         echo hello >world &&
17         test_tick &&
18         git commit -a -m hello &&
19
20         git checkout -b side HEAD^ &&
21         echo goodbye >world &&
22         test_tick &&
23         git commit -a -m goodbye &&
24
25         git checkout main
26 '
27
28 test_expect_success SYMLINKS 'rerere in workdir' '
29         rm -rf .git/rr-cache &&
30         "$SHELL_PATH" "$TEST_DIRECTORY/../contrib/workdir/git-new-workdir" . work &&
31         (
32                 cd work &&
33                 test_must_fail git merge side &&
34                 git rerere status >actual &&
35                 echo world >expect &&
36                 test_cmp expect actual
37         )
38 '
39
40 # This fails because we don't resolve relative symlink in mkdir_in_gitdir()
41 # For the purpose of helping contrib/workdir/git-new-workdir users, we do not
42 # have to support relative symlinks, but it might be nicer to make this work
43 # with a relative symbolic link someday.
44 test_expect_failure SYMLINKS 'rerere in workdir (relative)' '
45         rm -rf .git/rr-cache &&
46         "$SHELL_PATH" "$TEST_DIRECTORY/../contrib/workdir/git-new-workdir" . krow &&
47         (
48                 cd krow &&
49                 rm -f .git/rr-cache &&
50                 ln -s ../.git/rr-cache .git/rr-cache &&
51                 test_must_fail git merge side &&
52                 git rerere status >actual &&
53                 echo world >expect &&
54                 test_cmp expect actual
55         )
56 '
57
58 test_done