t8400: export tests for all three modes with remotes
[topgit/pro.git] / t / t8400-export-dag.sh
blobd99e9f19af393b1d458c48e9271ace417454ec64
1 #!/bin/sh
3 test_description='test TopGit DAG exports (all 3 types)'
5 TEST_NO_CREATE_REPO=1
7 . ./test-lib.sh
9 test_plan 5
11 tg_test_remote=yeehaw
13 test_expect_success 'setup' '
14 test_create_repo thedag && cd thedag &&
15 git config remote.yeehaw.url "." &&
16 git config topgit.remote yeehaw &&
17 git checkout --orphan lonesome &&
18 git read-tree --empty &&
19 test_tick &&
20 git commit --allow-empty -m "lonesome empty place" &&
21 git reset --hard &&
22 tg_test_create_branches <<-EOT &&
23 ::release [RELEASE] build upon this
24 lonesome
26 +release some release commit
27 :::release
29 ::first [PATCH] first level patch
30 release
32 +first commit on first
33 :::first
35 ::second [PATCH] second first level patch
36 release
38 +second commit on second
39 :::second
41 ::third [PATCH] third second level patch
42 second
44 +third commit on third
45 :::third
47 ::fourth [PATCH] fourth first level patch
48 release
50 +fourth commit on fourth
51 :::fourth
53 ::stage [STAGE] staging branch here
54 release
55 first
56 third
57 fourth
58 EOT
59 git symbolic-ref HEAD "$(tg --top-bases)/stage" &&
60 git reset --hard &&
61 git rm --force --ignore-unmatch -- .topmsg .topdeps &&
62 git read-tree -m HEAD first &&
63 git rm --force --ignore-unmatch -- .topmsg .topdeps &&
64 git read-tree -m HEAD third &&
65 git rm --force --ignore-unmatch -- .topmsg .topdeps &&
66 git read-tree -m HEAD fourth &&
67 git rm --force --ignore-unmatch -- .topmsg .topdeps &&
68 newtree="$(git write-tree)" && test -n "$newtree" &&
69 test_tick &&
70 newcommit="$(git commit-tree -p HEAD -p first -p third -p fourth -m "mighty octopus" "$newtree")" &&
71 test -n "$newcommit" && git update-ref HEAD "$newcommit" HEAD &&
72 git checkout -f stage &&
73 test_tick &&
74 git merge -m "bases up" "$(tg --top-bases)/stage"
77 baretree="$(tg_test_bare_tree -C thedag stage)" || die "missing bare stage tree"
79 test_expect_success 'export --collapse' '
80 cd thedag &&
81 git checkout -f stage &&
82 tg export --collapse collapse &&
83 test_cmp_rev $baretree collapse^{tree}
86 test_expect_success 'export --linearize' '
87 cd thedag &&
88 git checkout -f stage &&
89 tg export --linearize linearize &&
90 test_cmp_rev $baretree linearize^{tree}
93 test_expect_success 'export --quilt' '
94 git -C thedag checkout -f stage &&
95 tg -C thedag export --quilt --strip --numbered "$PWD/quilt"
98 test_expect_success 'import quilt patches' '
99 cd thedag &&
100 git checkout -f -b quilt lonesome &&
101 git am ../quilt/000*.diff &&
102 test_cmp_rev $baretree quilt^{tree}
105 test_done