Use strtol instead of std::stoi [PR110646]
[official-gcc.git] / contrib / git-add-user-branch.sh
blobe014f7518fbcc3dd54e5cbe5c386b0b0ae069e79
1 #! /bin/sh -e
3 # Create a new upstream user branch.
5 # Usage:
6 # contrib/git-add-user-branch.sh [<personal-prefix>/]<branch-name> <base>
8 usage ()
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
18 if [ $# != 2 ]
19 then
20 usage
23 userpfx=$(git config --get "gcc-config.userpfx")
24 user=$(git config --get "gcc-config.user")
26 if [ -z "$userpfx" -o -z "$user" ]
27 then
28 usage
31 branch=$(echo "$1" | sed -r "s:(${userpfx}/)?(.*)$:\2:")
32 start=$2
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
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}"