Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Commit

Permalink
Fixed some troubles to build the project properly
Browse files Browse the repository at this point in the history
  • Loading branch information
mremi committed Sep 10, 2015
1 parent e7e9989 commit 85aed3d
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions bin/qa_build_git.sh
Expand Up @@ -70,14 +70,20 @@ if [ ! -d "$2" ]; then
exit 1
fi

if [ -z "$3" ]; then
echo "ERR: you need to provide the target branch"
display_help
exit 1
fi


SOURCE_BRANCH="master"
if [ ! -z "$4" ]; then
SOURCE_BRANCH="$4"
fi

SOURCE_DIR=`realpath $1`
TARGET_DIR=`realpath $2`
SOURCE_DIR=`readlink -f $1`
TARGET_DIR=`readlink -f $2`
TARGET_BRANCH=$3
COMMIT=`cd $SOURCE_DIR && git rev-parse HEAD`

Expand All @@ -100,7 +106,14 @@ git reset --hard
git clean -f

git checkout $SOURCE_BRANCH
exit_on_error "Fail to switch to the source branch: ${SOURCE_BRANCH}" $?

# empty/fresh repository
if [ $? -ne 0 ]; then
echo "WARN: Fail to switch to the source branch: {$SOURCE_BRANCH}"

git checkout -b $SOURCE_BRANCH
exit_on_error "Fail to create the source branch: ${SOURCE_BRANCH}" $?
fi

# 3.1 switch/create to the branch
git checkout -b $TARGET_BRANCH
Expand All @@ -109,8 +122,10 @@ if [ $? -ne 0 ]; then
echo "WARN: Fail to create a new branch: {$TARGET_BRANCH}"

git checkout $TARGET_BRANCH

exit_on_error "ERR: Fail to checkout the branch: {$TARGET_BRANCH}" $?

git pull --rebase origin $TARGET_BRANCH
exit_on_error "ERR: Fail to pull the branch: {$TARGET_BRANCH}" $?
fi

# 3.2 create the tar command to retrieve and ignore some file and copy to the target folder
Expand All @@ -123,7 +138,9 @@ rsync -av \
--exclude=build \
--exclude=puppet \
--exclude=.idea \
--exclude=*.jar \
--exclude=.build \
--exclude=.DS_Store \
--exclude=web/uploads \
--delete \
$SOURCE_DIR/ $TARGET_DIR
Expand All @@ -144,4 +161,4 @@ exit_on_error "Unable to push the code to the remote repository" $?
echo ""
echo "done!"

exit 0
exit 0

0 comments on commit 85aed3d

Please sign in to comment.