t / t5800-remote-helpers.shon commit Merge branch 'bc/use-more-hardlinks-in-install' (14661fe)
   1#!/bin/sh
   2#
   3# Copyright (c) 2010 Sverre Rabbelier
   4#
   5
   6test_description='Test remote-helper import and export commands'
   7
   8. ./test-lib.sh
   9
  10if test_have_prereq PYTHON && "$PYTHON_PATH" -c '
  11import sys
  12if sys.hexversion < 0x02040000:
  13    sys.exit(1)
  14'
  15then
  16        :
  17else
  18        skip_all='skipping git remote-testgit tests: requires Python 2.4 or newer'
  19        test_done
  20fi
  21
  22test_expect_success 'setup repository' '
  23        git init --bare server/.git &&
  24        git clone server public &&
  25        (cd public &&
  26         echo content >file &&
  27         git add file &&
  28         git commit -m one &&
  29         git push origin master)
  30'
  31
  32test_expect_success 'cloning from local repo' '
  33        git clone "testgit::${PWD}/server" localclone &&
  34        test_cmp public/file localclone/file
  35'
  36
  37test_expect_success 'cloning from remote repo' '
  38        git clone "testgit::file://${PWD}/server" clone &&
  39        test_cmp public/file clone/file
  40'
  41
  42test_expect_success 'create new commit on remote' '
  43        (cd public &&
  44         echo content >>file &&
  45         git commit -a -m two &&
  46         git push)
  47'
  48
  49test_expect_success 'pulling from local repo' '
  50        (cd localclone && git pull) &&
  51        test_cmp public/file localclone/file
  52'
  53
  54test_expect_success 'pulling from remote remote' '
  55        (cd clone && git pull) &&
  56        test_cmp public/file clone/file
  57'
  58
  59test_expect_success 'pushing to local repo' '
  60        (cd localclone &&
  61        echo content >>file &&
  62        git commit -a -m three &&
  63        git push) &&
  64        HEAD=$(git --git-dir=localclone/.git rev-parse --verify HEAD) &&
  65        test $HEAD = $(git --git-dir=server/.git rev-parse --verify HEAD)
  66'
  67
  68test_expect_success 'synch with changes from localclone' '
  69        (cd clone &&
  70         git pull)
  71'
  72
  73test_expect_success 'pushing remote local repo' '
  74        (cd clone &&
  75        echo content >>file &&
  76        git commit -a -m four &&
  77        git push) &&
  78        HEAD=$(git --git-dir=clone/.git rev-parse --verify HEAD) &&
  79        test $HEAD = $(git --git-dir=server/.git rev-parse --verify HEAD)
  80'
  81
  82test_done