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