]>
Commit | Line | Data |
---|---|---|
2cb5a481 SR |
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 | ||
2bf10334 BC |
10 | if test_have_prereq PYTHON && "$PYTHON_PATH" -c ' |
11 | import sys | |
23b093ee | 12 | if sys.hexversion < 0x02040000: |
2bf10334 BC |
13 | sys.exit(1) |
14 | ' | |
63a2f613 | 15 | then |
8c427910 ÆAB |
16 | # Requires Python 2.4 or newer |
17 | test_set_prereq PYTHON_24 | |
63a2f613 JN |
18 | fi |
19 | ||
8c427910 | 20 | test_expect_success PYTHON_24 'setup repository' ' |
2cb5a481 SR |
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 | ||
8c427910 | 30 | test_expect_success PYTHON_24 'cloning from local repo' ' |
2cb5a481 SR |
31 | git clone "testgit::${PWD}/server" localclone && |
32 | test_cmp public/file localclone/file | |
33 | ' | |
34 | ||
8c427910 | 35 | test_expect_success PYTHON_24 'cloning from remote repo' ' |
2cb5a481 SR |
36 | git clone "testgit::file://${PWD}/server" clone && |
37 | test_cmp public/file clone/file | |
38 | ' | |
39 | ||
8c427910 | 40 | test_expect_success PYTHON_24 'create new commit on remote' ' |
2cb5a481 SR |
41 | (cd public && |
42 | echo content >>file && | |
43 | git commit -a -m two && | |
44 | git push) | |
45 | ' | |
46 | ||
8c427910 | 47 | test_expect_success PYTHON_24 'pulling from local repo' ' |
2cb5a481 SR |
48 | (cd localclone && git pull) && |
49 | test_cmp public/file localclone/file | |
50 | ' | |
51 | ||
8c427910 | 52 | test_expect_success PYTHON_24 'pulling from remote remote' ' |
2cb5a481 SR |
53 | (cd clone && git pull) && |
54 | test_cmp public/file clone/file | |
55 | ' | |
56 | ||
8c427910 | 57 | test_expect_success PYTHON_24 'pushing to local repo' ' |
2cb5a481 SR |
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 | ||
8c427910 | 66 | test_expect_success PYTHON_24 'synch with changes from localclone' ' |
2cb5a481 SR |
67 | (cd clone && |
68 | git pull) | |
69 | ' | |
70 | ||
8c427910 | 71 | test_expect_success PYTHON_24 'pushing remote local repo' ' |
2cb5a481 SR |
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 | ||
80 | test_done |