t / t5520-pull.shon commit Add a remote.*.mirror configuration option (84bb2df)
   1#!/bin/sh
   2
   3test_description='pulling into void'
   4
   5. ./test-lib.sh
   6
   7D=`pwd`
   8
   9test_expect_success setup '
  10
  11        echo file >file &&
  12        git add file &&
  13        git commit -a -m original
  14
  15'
  16
  17test_expect_success 'pulling into void' '
  18        mkdir cloned &&
  19        cd cloned &&
  20        git init &&
  21        git pull ..
  22'
  23
  24cd "$D"
  25
  26test_expect_success 'checking the results' '
  27        test -f file &&
  28        test -f cloned/file &&
  29        diff file cloned/file
  30'
  31
  32test_expect_success 'test . as a remote' '
  33
  34        git branch copy master &&
  35        git config branch.copy.remote . &&
  36        git config branch.copy.merge refs/heads/master &&
  37        echo updated >file &&
  38        git commit -a -m updated &&
  39        git checkout copy &&
  40        test `cat file` = file &&
  41        git pull &&
  42        test `cat file` = updated
  43'
  44
  45test_expect_success 'the default remote . should not break explicit pull' '
  46        git checkout -b second master^ &&
  47        echo modified >file &&
  48        git commit -a -m modified &&
  49        git checkout copy &&
  50        git reset --hard HEAD^ &&
  51        test `cat file` = file &&
  52        git pull . second &&
  53        test `cat file` = modified
  54'
  55
  56test_expect_success '--rebase' '
  57        git branch to-rebase &&
  58        echo modified again > file &&
  59        git commit -m file file &&
  60        git checkout to-rebase &&
  61        echo new > file2 &&
  62        git add file2 &&
  63        git commit -m "new file" &&
  64        git tag before-rebase &&
  65        git pull --rebase . copy &&
  66        test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
  67        test new = $(git show HEAD:file2)
  68'
  69
  70test_expect_success 'branch.to-rebase.rebase' '
  71        git reset --hard before-rebase &&
  72        git config branch.to-rebase.rebase 1 &&
  73        git pull . copy &&
  74        git config branch.to-rebase.rebase 0 &&
  75        test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
  76        test new = $(git show HEAD:file2)
  77'
  78
  79test_expect_success '--rebase with rebased upstream' '
  80
  81        git remote add -f me . &&
  82        git checkout copy &&
  83        git reset --hard HEAD^ &&
  84        echo conflicting modification > file &&
  85        git commit -m conflict file &&
  86        git checkout to-rebase &&
  87        echo file > file2 &&
  88        git commit -m to-rebase file2 &&
  89        git pull --rebase me copy &&
  90        test "conflicting modification" = "$(cat file)" &&
  91        test file = $(cat file2)
  92
  93'
  94
  95test_done