@@ -24,8 +24,8 @@ check()
2424check_equal ()
2525{
2626 echo
27- echo " check a:" " $1 "
28- echo " b:" " $2 "
27+ echo " check a:" " { $1 } "
28+ echo " b:" " { $2 } "
2929 if [ " $1 " = " $2 " ]; then
3030 return 0
3131 else
@@ -100,17 +100,17 @@ git branch sub2 FETCH_HEAD
100100git subtree merge --prefix=subdir FETCH_HEAD
101101git branch pre-split
102102
103- split1 =$( git subtree split --annotate=' *' \
103+ spl1 =$( git subtree split --annotate=' *' \
104104 --prefix subdir --onto FETCH_HEAD --rejoin)
105- echo " split1 ={$split1 }"
106- git branch split1 " $split1 "
105+ echo " spl1 ={$spl1 }"
106+ git branch spl1 " $spl1 "
107107
108108create subdir/main-sub8
109109git commit -m ' main-sub8'
110110
111111cd ../subproj
112- git fetch ../mainline split1
113- git branch split1 FETCH_HEAD
112+ git fetch ../mainline spl1
113+ git branch spl1 FETCH_HEAD
114114git merge FETCH_HEAD
115115
116116create sub9
@@ -123,14 +123,14 @@ git branch split2 "$split2"
123123create subdir/main-sub10
124124git commit -m ' main-sub10'
125125
126- split3 =$( git subtree split --annotate=' *' --prefix subdir --rejoin)
127- git branch split3 " $split3 "
126+ spl3 =$( git subtree split --annotate=' *' --prefix subdir --rejoin)
127+ git branch spl3 " $spl3 "
128128
129129cd ../subproj
130- git fetch ../mainline split3
131- git branch split3 FETCH_HEAD
130+ git fetch ../mainline spl3
131+ git branch spl3 FETCH_HEAD
132132git merge FETCH_HEAD
133- git branch subproj-merge-split3
133+ git branch subproj-merge-spl3
134134
135135chkm=" main4 main6"
136136chkms=" main-sub10 main-sub5 main-sub7 main-sub8"
@@ -147,9 +147,9 @@ allchanges=$(git log --name-only --pretty=format:'' | sort | fixnl)
147147check_equal " $allchanges " " $chkms $chks "
148148
149149cd ../mainline
150- git fetch ../subproj subproj-merge-split3
151- git branch subproj-merge-split3 FETCH_HEAD
152- git subtree pull --prefix=subdir ../subproj subproj-merge-split3
150+ git fetch ../subproj subproj-merge-spl3
151+ git branch subproj-merge-spl3 FETCH_HEAD
152+ git subtree pull --prefix=subdir ../subproj subproj-merge-spl3
153153
154154# make sure exactly the right set of files ends up in the mainline
155155mainfiles=$( git ls-files | fixnl)
@@ -162,5 +162,12 @@ check_equal "$mainfiles" "$chkm $chkms_sub $chks_sub"
162162allchanges=$( git log --name-only --pretty=format:' ' | sort | fixnl)
163163check_equal " $allchanges " " $chkm $chkms $chks $chkms_sub "
164164
165+ # make sure the --rejoin commits never make it into subproj
166+ check_equal " $( git log --pretty=format:' %s' HEAD^2 | grep -i split) " " "
167+
168+ # make sure no 'git subtree' tagged commits make it into subproj. (They're
169+ # meaningless to subproj since one side of the merge refers to the mainline)
170+ check_equal " $( git log --pretty=format:' %s%n%b' HEAD^2 | grep ' git-subtree.*:' ) " " "
171+
165172echo
166173echo ' ok'
0 commit comments