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