3 # Copyright (c) 2005 Petr Baudis
5 test_description
="Tests local cg-fetch
7 Whether it works at all, basically. ;-) Actually, we will be doing
8 cg-clones, but that's really just a funny cg-fetch frontend. We will
9 also test symlinked clone."
14 echo file1
>repo
1/file1
15 test_expect_success
'initialize repo1' \
16 "(cd repo1 && cg-init -I && cg-add file1 && cg-commit -C -m\"Initial commit\")"
19 test_expect_failure
'clone repo2 from non-existing repo' \
20 "cg-clone /.somethingwhichmustnotexist repo2"
22 test_expect_failure
'clone repo2 from repo which is really a file' \
23 "cg-clone phantomfile repo2"
24 test_expect_failure
'clone repo1 from repo1' \
25 "cg-clone repo1 repo1"
26 test_expect_success
'clone repo2 from repo1' \
27 "cg-clone repo1 repo2"
28 test_expect_failure
'clone repo2 in-current-dir from repo1' \
29 'cg-clone -s repo1 repo2'
31 test_expect_failure
'clone now-gone repo2 in-current-dir from repo1' \
32 'cg-clone -s repo1 repo2'
33 test_expect_success
'symlinked clone of repo2 from repo1' \
34 'cg-clone -l repo1 repo2'
37 test_expect_success
'clone in-current-dir repo2 from $(pwd)/../repo1/../repo1.git/' \
38 '(cd repo2 && cg-clone -s "$(pwd)/../repo1/../repo1.git/")'
40 echo file1v2
>repo
1/file1
41 test_expect_success
'commit in repo1' \
42 "(cd repo1 && git-update-index file1 && cg-commit -m\"Second commit\")"
43 test_expect_success
'incremental fetch in repo2' \
44 "(cd repo2 && cg-fetch)"
45 test_expect_success
'verifying incremental fetch' \
46 "(cmp repo1/.git/refs/heads/master repo2/.git/refs/heads/origin &&
47 cd repo2 && git-fsck-objects)"
49 echo file1v3
>repo
1/file1
50 test_expect_success
'commit in repo1' \
51 "(cd repo1 && git-update-index file1 && cg-commit -m\"Third commit\")"
52 test_expect_success
'rewriting HEAD of repo1 to symbolic' \
53 '(rm repo1/.git/HEAD && echo "ref: refs/heads/master" >repo1/.git/HEAD)'
54 test_expect_success
'incremental fetch in repo2' \
55 "(cd repo2 && cg-fetch)"
56 test_expect_success
'verifying incremental fetch' \
57 "(cmp repo1/.git/refs/heads/master repo2/.git/refs/heads/origin &&
58 cd repo2 && git-fsck-objects)"
61 test_expect_success
'clone -l repo2 from repo1' \
62 'cg-clone -l repo1 repo2'
63 test_expect_success
'incremental fetch in repo2' \
64 '(cd repo2 && cg-fetch >blah && [ "$(tail -n 1 blah)" = "Up to date." ])'
65 test_expect_success
'incremental update in repo2' \
66 '(cd repo2 && cg-update)'
67 test_expect_success
'verifying incremental update' \
68 "(cmp repo1/.git/refs/heads/master repo2/.git/refs/heads/master &&
69 cd repo2 && git-fsck-objects)"