]> git.ipfire.org Git - thirdparty/gcc.git/blame - contrib/git-add-vendor-branch.sh
Add missing ChangeLog entry.
[thirdparty/gcc.git] / contrib / git-add-vendor-branch.sh
CommitLineData
f96af171
RE
1#! /bin/sh -e
2
3# Create a new upstream vendor branch.
4
5# Usage:
6# contrib/git-add-vendor-branch.sh <vendor>/<branch-name> <base>
7
8usage ()
9{
10 echo "Usage:"
11 echo " $0 <vendor>/<branch-name> <start-point>"
12 echo
13 echo "<vendor> must have already been set up using contrib/git-fetch-vendor.sh"
14 exit 1
15}
16
17if [ $# != 2 ]
18then
19 usage
20fi
21
22vendor=$(echo "$1" | sed -r "s:([^/]*)/.*$:\1:")
23branch=$(echo "$1" | sed -r "s:[^/]*/(.*)$:\1:")
24start=$2
25
26# Sanity check the new branch argument. If there is no '/', then the
27# vendor will be the same as the entire first argument.
28if [ -z "$vendor" -o -z "$branch" -o ${vendor} = $1 ]
29then
30 usage
31fi
32
33# Check that we know about the vendor
34url=$(git config --get "remote.vendors/${vendor}.url"||true)
35if [ -z "$url" ]
36then
37 echo "Cannot locate remote data for vendor ${vendor}. Have you set it up?"
38 exit 1
39fi
40
41git branch --no-track ${vendor}/${branch} ${start}
42git push vendors/${vendor} ${vendor}/${branch}:refs/vendors/${vendor}/heads/${branch}
43git fetch -q vendors/${vendor}
44git branch --set-upstream-to=remotes/vendors/${vendor}/${branch} ${vendor}/$branch
45echo "You are now ready to check out ${vendor}/${branch}"
46echo "To push the branch upstream, use:"
47echo
48echo "git push vendors/${vendor} ${vendor}/${branch}"