Code

Change test.sh to test the new add, merge, and pull commands.
[git.git] / test.sh
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 subtree add --prefix=subdir FETCH_HEAD
38 # this shouldn't actually do anything, since FETCH_HEAD is already a parent
39 git merge -m 'merge -s -ours' -s ours FETCH_HEAD
41 touch subdir/main-sub3
42 git add subdir/main-sub3
43 git commit -m 'main-sub3'
45 touch main-2
46 git add main-2
47 git commit -m 'main-2 boring'
49 touch subdir/main-sub4
50 git add subdir/main-sub4
51 git commit -m 'main-sub4'
53 git fetch ../subproj sub2
54 git branch sub2 FETCH_HEAD
55 git subtree merge --prefix=subdir FETCH_HEAD
56 git branch pre-split
58 split1=$(git subtree split --prefix subdir --onto FETCH_HEAD --rejoin)
59 echo "split1={$split1}"
60 git branch split1 "$split1"
62 touch subdir/main-sub5
63 git add subdir/main-sub5
64 git commit -m 'main-sub5'
66 cd ../subproj
67 git fetch ../mainline split1
68 git branch split1 FETCH_HEAD
69 git merge FETCH_HEAD
71 touch sub6
72 git add sub6
73 git commit -m 'sub6'
75 cd ../mainline
76 split2=$(git subtree split --prefix subdir --rejoin)
77 git branch split2 "$split2"
79 touch subdir/main-sub7
80 git add subdir/main-sub7
81 git commit -m 'main-sub7'
83 split3=$(git subtree split --prefix subdir --rejoin)
84 git branch split3 "$split3"
86 cd ../subproj
87 git fetch ../mainline split3
88 git branch split3 FETCH_HEAD
89 git merge FETCH_HEAD
90 git branch subproj-merge-split3
92 cd ../mainline
93 git fetch ../subproj subproj-merge-split3
94 git branch subproj-merge-split3 FETCH_HEAD
95 git subtree pull --prefix=subdir ../subproj subproj-merge-split3