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