3 # Create a new upstream vendor branch.
6 # contrib/git-add-vendor-branch.sh <vendor>/<branch-name> <base>
11 echo " $0 <vendor>/<branch-name> <start-point>"
13 echo "<vendor> must have already been set up using contrib/git-fetch-vendor.sh"
22 vendor
=$
(echo "$1" |
sed -r "s:([^/]*)/.*$:\1:")
23 branch
=$
(echo "$1" |
sed -r "s:[^/]*/(.*)$:\1:")
26 # Sanity check the new branch argument. If there is no '/', then the
27 # vendor will be the same as the entire first argument.
28 if [ -z "$vendor" -o -z "$branch" -o ${vendor} = $1 ]
33 # Check that we know about the vendor
34 url
=$
(git config
--get "remote.vendors/${vendor}.url"||true
)
37 echo "Cannot locate remote data for vendor ${vendor}. Have you set it up?"
41 git branch
--no-track ${vendor}/${branch} ${start}
42 git push vendors
/${vendor} ${vendor}/${branch}:refs/vendors/${vendor}/heads/${branch}
43 git fetch
-q vendors
/${vendor}
44 git branch
--set-upstream-to=remotes
/vendors
/${vendor}/${branch} ${vendor}/$branch
45 echo "You are now ready to check out ${vendor}/${branch}"
46 echo "To push the branch upstream, use:"
48 echo "git push vendors/${vendor} ${vendor}/${branch}"