remote-helpers: add tests for testgit helper
[git/jnareb-git.git] / t / t5800-remote-helpers.sh
blobeb31709b979011142f04079583e8340474cb8695
1 #!/bin/sh
3 # Copyright (c) 2010 Sverre Rabbelier
6 test_description='Test remote-helper import and export commands'
8 . ./test-lib.sh
10 test_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)
20 test_expect_success 'cloning from local repo' '
21 git clone "testgit::${PWD}/server" localclone &&
22 test_cmp public/file localclone/file
25 test_expect_success 'cloning from remote repo' '
26 git clone "testgit::file://${PWD}/server" clone &&
27 test_cmp public/file clone/file
30 test_expect_success 'create new commit on remote' '
31 (cd public &&
32 echo content >>file &&
33 git commit -a -m two &&
34 git push)
37 test_expect_success 'pulling from local repo' '
38 (cd localclone && git pull) &&
39 test_cmp public/file localclone/file
42 test_expect_success 'pulling from remote remote' '
43 (cd clone && git pull) &&
44 test_cmp public/file clone/file
47 test_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)
56 test_expect_success 'synch with changes from localclone' '
57 (cd clone &&
58 git pull)
61 test_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)
70 test_done