Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- . $(dirname $0)/adc.common-functions
- [ $# -eq 2 ] || die "usage: $0 <repo> <branch>"
- if [ $SDB_WRITER_ALLOWED ]; then
- # this will check only for write permission on the given repository
- get_rights_and_owner $1 # this also set $repo variable
- [ -z "$perm_write" ] && die "You don't have write permission on $repo"
- else
- # require a repository creator to change default branch
- valid_owned_repo $1
- fi
- # move to repo dir
- cd "$GL_REPO_BASE_ABS/$repo.git"
- # check for branch existence
- match=`git branch | sed 's/^( |*) //' | grep $2`
- # this will check for an exact match in branch name
- [ "$2" = "$match" ] || die "Unable to find branch $2 in repository $repo"
- # update the default checked out branch
- git symbolic-ref HEAD refs/heads/$match
- echo "Head branch for repository $1 updated to $2"
Add Comment
Please, Sign In to add comment