Add a 'create' helper function in test.sh.
[git/mingw.git] / test.sh
blob276f40d1daffe3157baa886232510a154d32678c
1 #!/bin/bash -x
2 . shellopts.sh
3 set -e
5 create()
7 echo "$1" >"$1"
8 git add "$1"
12 rm -rf mainline subproj
13 mkdir mainline subproj
15 cd subproj
16 git init
18 create sub1
19 git commit -m 'sub1'
20 git branch sub1
21 git branch -m master subproj
23 create sub2
24 git commit -m 'sub2'
25 git branch sub2
27 create sub3
28 git commit -m 'sub3'
29 git branch sub3
31 cd ../mainline
32 git init
33 create main4
34 git commit -m 'main4'
35 git branch -m master mainline
37 git fetch ../subproj sub1
38 git branch sub1 FETCH_HEAD
39 git subtree add --prefix=subdir FETCH_HEAD
41 # this shouldn't actually do anything, since FETCH_HEAD is already a parent
42 git merge -m 'merge -s -ours' -s ours FETCH_HEAD
44 create subdir/main-sub5
45 git commit -m 'main-sub5'
47 create main6
48 git commit -m 'main6 boring'
50 create subdir/main-sub7
51 git commit -m 'main-sub7'
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 --annotate='*' --prefix subdir --onto FETCH_HEAD --rejoin)
59 echo "split1={$split1}"
60 git branch split1 "$split1"
62 create subdir/main-sub8
63 git commit -m 'main-sub8'
65 cd ../subproj
66 git fetch ../mainline split1
67 git branch split1 FETCH_HEAD
68 git merge FETCH_HEAD
70 create sub9
71 git commit -m 'sub9'
73 cd ../mainline
74 split2=$(git subtree split --annotate='*' --prefix subdir --rejoin)
75 git branch split2 "$split2"
77 create subdir/main-sub10
78 git commit -m 'main-sub10'
80 split3=$(git subtree split --annotate='*' --prefix subdir --rejoin)
81 git branch split3 "$split3"
83 cd ../subproj
84 git fetch ../mainline split3
85 git branch split3 FETCH_HEAD
86 git merge FETCH_HEAD
87 git branch subproj-merge-split3
89 cd ../mainline
90 git fetch ../subproj subproj-merge-split3
91 git branch subproj-merge-split3 FETCH_HEAD
92 git subtree pull --prefix=subdir ../subproj subproj-merge-split3