t / t6035-merge-dir-to-symlink.shon commit t/t9001-send-email.sh: fix stderr redirection in 'Invalid In-Reply-To' (5b57413)
   1#!/bin/sh
   2
   3test_description='merging when a directory was replaced with a symlink'
   4. ./test-lib.sh
   5
   6test_expect_success SYMLINKS 'create a commit where dir a/b changed to symlink' '
   7        mkdir -p a/b/c a/b-2/c &&
   8        > a/b/c/d &&
   9        > a/b-2/c/d &&
  10        > a/x &&
  11        git add -A &&
  12        git commit -m base &&
  13        git tag start &&
  14        rm -rf a/b &&
  15        ln -s b-2 a/b &&
  16        git add -A &&
  17        git commit -m "dir to symlink"
  18'
  19
  20test_expect_success SYMLINKS 'keep a/b-2/c/d across checkout' '
  21        git checkout HEAD^0 &&
  22        git reset --hard master &&
  23        git rm --cached a/b &&
  24        git commit -m "untracked symlink remains" &&
  25         git checkout start^0 &&
  26         test -f a/b-2/c/d
  27'
  28
  29test_expect_success SYMLINKS 'checkout should not have deleted a/b-2/c/d' '
  30        git checkout HEAD^0 &&
  31        git reset --hard master &&
  32         git checkout start^0 &&
  33         test -f a/b-2/c/d
  34'
  35
  36test_expect_success SYMLINKS 'setup for merge test' '
  37        git reset --hard &&
  38        test -f a/b-2/c/d &&
  39        echo x > a/x &&
  40        git add a/x &&
  41        git commit -m x &&
  42        git tag baseline
  43'
  44
  45test_expect_success SYMLINKS 'Handle D/F conflict, do not lose a/b-2/c/d in merge (resolve)' '
  46        git reset --hard &&
  47        git checkout baseline^0 &&
  48        git merge -s resolve master &&
  49        test -h a/b &&
  50        test -f a/b-2/c/d
  51'
  52
  53test_expect_success SYMLINKS 'Handle D/F conflict, do not lose a/b-2/c/d in merge (recursive)' '
  54        git reset --hard &&
  55        git checkout baseline^0 &&
  56        git merge -s recursive master &&
  57        test -h a/b &&
  58        test -f a/b-2/c/d
  59'
  60
  61test_expect_success SYMLINKS 'Handle F/D conflict, do not lose a/b-2/c/d in merge (resolve)' '
  62        git reset --hard &&
  63        git checkout master^0 &&
  64        git merge -s resolve baseline^0 &&
  65        test -h a/b &&
  66        test -f a/b-2/c/d
  67'
  68
  69test_expect_success SYMLINKS 'Handle F/D conflict, do not lose a/b-2/c/d in merge (recursive)' '
  70        git reset --hard &&
  71        git checkout master^0 &&
  72        git merge -s recursive baseline^0 &&
  73        test -h a/b &&
  74        test -f a/b-2/c/d
  75'
  76
  77test_expect_failure SYMLINKS 'do not lose untracked in merge (resolve)' '
  78        git reset --hard &&
  79        git checkout baseline^0 &&
  80        >a/b/c/e &&
  81        test_must_fail git merge -s resolve master &&
  82        test -f a/b/c/e &&
  83        test -f a/b-2/c/d
  84'
  85
  86test_expect_success SYMLINKS 'do not lose untracked in merge (recursive)' '
  87        git reset --hard &&
  88        git checkout baseline^0 &&
  89        >a/b/c/e &&
  90        test_must_fail git merge -s recursive master &&
  91        test -f a/b/c/e &&
  92        test -f a/b-2/c/d
  93'
  94
  95test_expect_success SYMLINKS 'do not lose modifications in merge (resolve)' '
  96        git reset --hard &&
  97        git checkout baseline^0 &&
  98        echo more content >>a/b/c/d &&
  99        test_must_fail git merge -s resolve master
 100'
 101
 102test_expect_success SYMLINKS 'do not lose modifications in merge (recursive)' '
 103        git reset --hard &&
 104        git checkout baseline^0 &&
 105        echo more content >>a/b/c/d &&
 106        test_must_fail git merge -s recursive master
 107'
 108
 109test_expect_success SYMLINKS 'setup a merge where dir a/b-2 changed to symlink' '
 110        git reset --hard &&
 111        git checkout start^0 &&
 112        rm -rf a/b-2 &&
 113        ln -s b a/b-2 &&
 114        git add -A &&
 115        git commit -m "dir a/b-2 to symlink" &&
 116        git tag test2
 117'
 118
 119test_expect_success SYMLINKS 'merge should not have D/F conflicts (resolve)' '
 120        git reset --hard &&
 121        git checkout baseline^0 &&
 122        git merge -s resolve test2 &&
 123        test -h a/b-2 &&
 124        test -f a/b/c/d
 125'
 126
 127test_expect_success SYMLINKS 'merge should not have D/F conflicts (recursive)' '
 128        git reset --hard &&
 129        git checkout baseline^0 &&
 130        git merge -s recursive test2 &&
 131        test -h a/b-2 &&
 132        test -f a/b/c/d
 133'
 134
 135test_expect_success SYMLINKS 'merge should not have F/D conflicts (recursive)' '
 136        git reset --hard &&
 137        git checkout -b foo test2 &&
 138        git merge -s recursive baseline^0 &&
 139        test -h a/b-2 &&
 140        test -f a/b/c/d
 141'
 142
 143test_done