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