Even more aggressive commit trimming.
[git-subtree.git] / test.sh
bloba8ed0dbc7d9b927ddb12d7e42c925ce12867a68d
1 #!/bin/bash -x
2 . shellopts.sh
3 set -e
5 rm -rf mainline subproj
6 mkdir mainline subproj
8 cd subproj
9 git init
11 touch sub1
12 git add sub1
13 git commit -m 'sub-1'
14 git branch sub1
15 git branch -m master subproj
17 touch sub2
18 git add sub2
19 git commit -m 'sub-2'
20 git branch sub2
22 touch sub3
23 git add sub3
24 git commit -m 'sub-3'
25 git branch sub3
27 cd ../mainline
28 git init
29 touch main1
30 git add main1
31 git commit -m 'main-1'
32 git branch -m master mainline
34 git fetch ../subproj sub1
35 git branch sub1 FETCH_HEAD
36 git read-tree --prefix=subdir FETCH_HEAD
37 git checkout subdir
38 git commit -m 'initial-subdir-merge'
40 git merge -m 'merge -s -ours' -s ours FETCH_HEAD
42 touch subdir/main-sub3
43 git add subdir/main-sub3
44 git commit -m 'main-sub3'
46 touch main-2
47 git add main-2
48 git commit -m 'main-2 boring'
50 touch subdir/main-sub4
51 git add subdir/main-sub4
52 git commit -m 'main-sub4'
54 git fetch ../subproj sub2
55 git branch sub2 FETCH_HEAD
56 git merge -s subtree FETCH_HEAD
57 git branch pre-split
59 split1=$(git subtree split --onto FETCH_HEAD subdir --rejoin)
60 echo "split1={$split1}"
61 git branch split1 "$split1"
63 touch subdir/main-sub5
64 git add subdir/main-sub5
65 git commit -m 'main-sub5'
67 cd ../subproj
68 git fetch ../mainline split1
69 git branch split1 FETCH_HEAD
70 git merge FETCH_HEAD
72 touch sub6
73 git add sub6
74 git commit -m 'sub6'
76 cd ../mainline
77 split2=$(git subtree split subdir --rejoin)
78 git branch split2 "$split2"
80 touch subdir/main-sub7
81 git add subdir/main-sub7
82 git commit -m 'main-sub7'
84 split3=$(git subtree split subdir --rejoin)
85 git branch split3 "$split3"
87 cd ../subproj
88 git fetch ../mainline split3
89 git branch split3 FETCH_HEAD
90 git merge FETCH_HEAD
91 git branch subproj-merge-split3
93 cd ../mainline
94 git fetch ../subproj subproj-merge-split3
95 git branch subproj-merge-split3 FETCH_HEAD
96 git merge -s subtree subproj-merge-split3