Last active
August 29, 2015 14:05
-
-
Save noel-yap/2d084b543cfab0782edc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -evx | |
| PERFORCE_DEPOT_PATH=$1@all | |
| GIT_REPOSITORY_URL=$2 | |
| git_project_name=$(echo ${GIT_REPOSITORY_URL} | sed -e 's|^.*/||' -e 's|\.git||') | |
| rm -rf ${git_project_name} | |
| git clone ${GIT_REPOSITORY_URL} | |
| ( | |
| cd ${git_project_name} | |
| if [ -f .git/refs/remotes/p4/master ] | |
| then | |
| git update-ref refs/remotes/p4/master $(git log --format='%H' | head -n 1) | |
| git symbolic-ref refs/remotes/p4/HEAD refs/remotes/p4/master | |
| git-p4 sync ${PERFORCE_DEPOT_PATH} || true | |
| git-p4 rebase | |
| else | |
| ( | |
| cd .. | |
| git-p4 clone ${PERFORCE_DEPOT_PATH} ${git_project_name} | |
| ) | |
| fi | |
| git push origin master | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment