#!/bin/sh global test_description := ''rerere run in a workdir'' source ./test-lib.sh test_expect_success SYMLINKS setup ' git config rerere.enabled true && >world && git add world && test_tick && git commit -m initial && echo hello >world && test_tick && git commit -a -m hello && git checkout -b side HEAD^ && echo goodbye >world && test_tick && git commit -a -m goodbye && git checkout master ' test_expect_success SYMLINKS 'rerere in workdir' ' rm -rf .git/rr-cache && "$SHELL_PATH" "$TEST_DIRECTORY/../contrib/workdir/git-new-workdir" . work && ( cd work && test_must_fail git merge side && git rerere status >actual && echo world >expect && test_cmp expect actual ) ' # This fails because we don't resolve relative symlink in mkdir_in_gitdir() # For the purpose of helping contrib/workdir/git-new-workdir users, we do not # have to support relative symlinks, but it might be nicer to make this work # with a relative symbolic link someday. test_expect_failure SYMLINKS 'rerere in workdir (relative)' ' rm -rf .git/rr-cache && "$SHELL_PATH" "$TEST_DIRECTORY/../contrib/workdir/git-new-workdir" . krow && ( cd krow && rm -f .git/rr-cache && ln -s ../.git/rr-cache .git/rr-cache && test_must_fail git merge side && git rerere status >actual && echo world >expect && test_cmp expect actual ) ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"rerere run in a workdir">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SYMLINKS)} {(setup)} { (SQ <"\n"> <"\tgit config rerere.enabled true &&\n"> <"\t>world &&\n"> <"\tgit add world &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -m initial &&\n"> <"\n"> <"\techo hello >world &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -a -m hello &&\n"> <"\n"> <"\tgit checkout -b side HEAD^ &&\n"> <"\techo goodbye >world &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -a -m goodbye &&\n"> <"\n"> <"\tgit checkout master\n"> ) } ) (C {(test_expect_success)} {(SYMLINKS)} {(SQ <"rerere in workdir">)} { (SQ <"\n"> <"\trm -rf .git/rr-cache &&\n"> <"\t\"$SHELL_PATH\" \"$TEST_DIRECTORY/../contrib/workdir/git-new-workdir\" . work &&\n"> <"\t(\n"> <"\t\tcd work &&\n"> <"\t\ttest_must_fail git merge side &&\n"> <"\t\tgit rerere status >actual &&\n"> <"\t\techo world >expect &&\n"> <"\t\ttest_cmp expect actual\n"> <"\t)\n"> ) } ) (C {(test_expect_failure)} {(SYMLINKS)} {(SQ <"rerere in workdir (relative)">)} { (SQ <"\n"> <"\trm -rf .git/rr-cache &&\n"> <"\t\"$SHELL_PATH\" \"$TEST_DIRECTORY/../contrib/workdir/git-new-workdir\" . krow &&\n"> <"\t(\n"> <"\t\tcd krow &&\n"> <"\t\trm -f .git/rr-cache &&\n"> <"\t\tln -s ../.git/rr-cache .git/rr-cache &&\n"> <"\t\ttest_must_fail git merge side &&\n"> <"\t\tgit rerere status >actual &&\n"> <"\t\techo world >expect &&\n"> <"\t\ttest_cmp expect actual\n"> <"\t)\n"> ) } ) (C {(test_done)}) ] )