]> git.ipfire.org Git - thirdparty/gcc.git/blob - contrib/git-add-user-branch.sh
Use OpenACC code to process OpenMP target regions
[thirdparty/gcc.git] / contrib / git-add-user-branch.sh
1 #! /bin/sh -e
2
3 # Create a new upstream user branch.
4
5 # Usage:
6 # contrib/git-add-user-branch.sh [<personal-prefix>/]<branch-name> <base>
7
8 usage ()
9 {
10 echo "Usage:"
11 echo " $0 [<personal-prefix>/]<branch-name> <start-point>"
12 echo
13 echo "personal space must already have been set up using"
14 echo "contrib/gcc-git-customization.sh"
15 exit 1
16 }
17
18 if [ $# != 2 ]
19 then
20 usage
21 fi
22
23 userpfx=$(git config --get "gcc-config.userpfx")
24 user=$(git config --get "gcc-config.user")
25
26 if [ -z "$userpfx" -o -z "$user" ]
27 then
28 usage
29 fi
30
31 branch=$(echo "$1" | sed -r "s:(${userpfx}/)?(.*)$:\2:")
32 start=$2
33
34 # Sanity check the new branch argument. If there is no '/', then the
35 # vendor will be the same as the entire first argument.
36 if [ -z "$branch" ]
37 then
38 usage
39 fi
40
41 git push users/${userpfx} ${start}:refs/users/${user}/heads/${branch}
42 git fetch -q users/${userpfx}
43 git branch ${userpfx}/${branch} remotes/users/${userpfx}/${branch}
44 echo "You are now ready to check out ${userpfx}/${branch}"
45 echo "To push the branch upstream use:"
46 echo " git push users/${userpfx} ${userpfx}/${branch}"