Merge branch 'jk/maint-remote-mirror-safer'
[git.git] / t / t5800-remote-helpers.sh
blob1fb6380fceb294f1a7cc73359f5e39740260d8f0
1 #!/bin/sh
3 # Copyright (c) 2010 Sverre Rabbelier
6 test_description='Test remote-helper import and export commands'
8 . ./test-lib.sh
10 if test_have_prereq PYTHON && "$PYTHON_PATH" -c '
11 import sys
12 if sys.hexversion < 0x02040000:
13 sys.exit(1)
15 then
16 # Requires Python 2.4 or newer
17 test_set_prereq PYTHON_24
20 test_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)
30 test_expect_success PYTHON_24 'cloning from local repo' '
31 git clone "testgit::${PWD}/server" localclone &&
32 test_cmp public/file localclone/file
35 test_expect_success PYTHON_24 'cloning from remote repo' '
36 git clone "testgit::file://${PWD}/server" clone &&
37 test_cmp public/file clone/file
40 test_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)
47 test_expect_success PYTHON_24 'pulling from local repo' '
48 (cd localclone && git pull) &&
49 test_cmp public/file localclone/file
52 test_expect_success PYTHON_24 'pulling from remote remote' '
53 (cd clone && git pull) &&
54 test_cmp public/file clone/file
57 test_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)
66 test_expect_success PYTHON_24 'synch with changes from localclone' '
67 (cd clone &&
68 git pull)
71 test_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)
80 test_done