t / t5800-remote-helpers.shon commit Merge branch 'mg/notes-dry-run' (2d4fef9)
   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
  11then
  12        say 'skipping git remote-testgit tests: requires Python support'
  13        test_done
  14fi
  15
  16test_expect_success 'setup repository' '
  17        git init --bare server/.git &&
  18        git clone server public &&
  19        (cd public &&
  20         echo content >file &&
  21         git add file &&
  22         git commit -m one &&
  23         git push origin master)
  24'
  25
  26test_expect_success 'cloning from local repo' '
  27        git clone "testgit::${PWD}/server" localclone &&
  28        test_cmp public/file localclone/file
  29'
  30
  31test_expect_success 'cloning from remote repo' '
  32        git clone "testgit::file://${PWD}/server" clone &&
  33        test_cmp public/file clone/file
  34'
  35
  36test_expect_success 'create new commit on remote' '
  37        (cd public &&
  38         echo content >>file &&
  39         git commit -a -m two &&
  40         git push)
  41'
  42
  43test_expect_success 'pulling from local repo' '
  44        (cd localclone && git pull) &&
  45        test_cmp public/file localclone/file
  46'
  47
  48test_expect_success 'pulling from remote remote' '
  49        (cd clone && git pull) &&
  50        test_cmp public/file clone/file
  51'
  52
  53test_expect_success 'pushing to local repo' '
  54        (cd localclone &&
  55        echo content >>file &&
  56        git commit -a -m three &&
  57        git push) &&
  58        HEAD=$(git --git-dir=localclone/.git rev-parse --verify HEAD) &&
  59        test $HEAD = $(git --git-dir=server/.git rev-parse --verify HEAD)
  60'
  61
  62test_expect_success 'synch with changes from localclone' '
  63        (cd clone &&
  64         git pull)
  65'
  66
  67test_expect_success 'pushing remote local repo' '
  68        (cd clone &&
  69        echo content >>file &&
  70        git commit -a -m four &&
  71        git push) &&
  72        HEAD=$(git --git-dir=clone/.git rev-parse --verify HEAD) &&
  73        test $HEAD = $(git --git-dir=server/.git rev-parse --verify HEAD)
  74'
  75
  76test_done