t / t5701-clone-local.shon commit git-svn: fix test for trunk svn (transaction out of date) (d99c74e)
   1#!/bin/sh
   2
   3test_description='test local clone'
   4. ./test-lib.sh
   5
   6D=`pwd`
   7
   8test_expect_success 'preparing origin repository' '
   9        : >file && git add . && git commit -m1 &&
  10        git clone --bare . a.git &&
  11        git clone --bare . x &&
  12        test "$(GIT_CONFIG=a.git/config git config --bool core.bare)" = true &&
  13        test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true
  14'
  15
  16test_expect_success 'local clone without .git suffix' '
  17        cd "$D" &&
  18        git clone -l -s a b &&
  19        cd b &&
  20        test "$(GIT_CONFIG=.git/config git config --bool core.bare)" = false &&
  21        git fetch
  22'
  23
  24test_expect_success 'local clone with .git suffix' '
  25        cd "$D" &&
  26        git clone -l -s a.git c &&
  27        cd c &&
  28        git fetch
  29'
  30
  31test_expect_success 'local clone from x' '
  32        cd "$D" &&
  33        git clone -l -s x y &&
  34        cd y &&
  35        git fetch
  36'
  37
  38test_expect_success 'local clone from x.git that does not exist' '
  39        cd "$D" &&
  40        if git clone -l -s x.git z
  41        then
  42                echo "Oops, should have failed"
  43                false
  44        else
  45                echo happy
  46        fi
  47'
  48
  49test_expect_success 'With -no-hardlinks, local will make a copy' '
  50        cd "$D" &&
  51        git clone --bare --no-hardlinks x w &&
  52        cd w &&
  53        linked=$(find objects -type f ! -links 1 | wc -l) &&
  54        test 0 = $linked
  55'
  56
  57test_expect_success 'Even without -l, local will make a hardlink' '
  58        cd "$D" &&
  59        rm -fr w &&
  60        git clone -l --bare x w &&
  61        cd w &&
  62        copied=$(find objects -type f -links 1 | wc -l) &&
  63        test 0 = $copied
  64'
  65
  66test_done