t / t5800-remote-helpers.shon commit merge-file: correctly find files when called in subdir (55846b9)
   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    # Requires Python 2.4 or newer
  17        test_set_prereq PYTHON_24
  18fi
  19
  20test_expect_success PYTHON_24 'setup repository' '
  21        git init --bare server/.git &&
  22        git clone server public &&
  23        (cd public &&
  24         echo content >file &&
  25         git add file &&
  26         git commit -m one &&
  27         git push origin master)
  28'
  29
  30test_expect_success PYTHON_24 'cloning from local repo' '
  31        git clone "testgit::${PWD}/server" localclone &&
  32        test_cmp public/file localclone/file
  33'
  34
  35test_expect_success PYTHON_24 'cloning from remote repo' '
  36        git clone "testgit::file://${PWD}/server" clone &&
  37        test_cmp public/file clone/file
  38'
  39
  40test_expect_success PYTHON_24 'create new commit on remote' '
  41        (cd public &&
  42         echo content >>file &&
  43         git commit -a -m two &&
  44         git push)
  45'
  46
  47test_expect_success PYTHON_24 'pulling from local repo' '
  48        (cd localclone && git pull) &&
  49        test_cmp public/file localclone/file
  50'
  51
  52test_expect_success PYTHON_24 'pulling from remote remote' '
  53        (cd clone && git pull) &&
  54        test_cmp public/file clone/file
  55'
  56
  57test_expect_success PYTHON_24 'pushing to local repo' '
  58        (cd localclone &&
  59        echo content >>file &&
  60        git commit -a -m three &&
  61        git push) &&
  62        HEAD=$(git --git-dir=localclone/.git rev-parse --verify HEAD) &&
  63        test $HEAD = $(git --git-dir=server/.git rev-parse --verify HEAD)
  64'
  65
  66test_expect_success PYTHON_24 'synch with changes from localclone' '
  67        (cd clone &&
  68         git pull)
  69'
  70
  71test_expect_success PYTHON_24 'pushing remote local repo' '
  72        (cd clone &&
  73        echo content >>file &&
  74        git commit -a -m four &&
  75        git push) &&
  76        HEAD=$(git --git-dir=clone/.git rev-parse --verify HEAD) &&
  77        test $HEAD = $(git --git-dir=server/.git rev-parse --verify HEAD)
  78'
  79
  80test_done