Skip to content

Commit

Permalink
tools: Tweak auto build script
Browse files Browse the repository at this point in the history
fetch with --prune option to remove deleted references
git reset --hard instead of git pull in case branch was rewritten
  • Loading branch information
paulscode committed Jan 10, 2015
1 parent c3456b0 commit 1b22f4c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/auto-build.sh
Expand Up @@ -16,7 +16,7 @@ localBranches=($(git branch | awk -F ' +' '! /\(no branch\)/ {print $2}'))
remoteBranches=($(git branch -r | awk -F ' origin/+' '! /\->/ {print $2}')) remoteBranches=($(git branch -r | awk -F ' origin/+' '! /\->/ {print $2}'))


echo "Executing git fetch" echo "Executing git fetch"
git fetch --all git fetch --prune --all


exitCode=0 exitCode=0
# Loop through the remote branches (these are the only ones that may have changed) # Loop through the remote branches (these are the only ones that may have changed)
Expand All @@ -39,8 +39,8 @@ for currentBranch in "${remoteBranches[@]}"; do
oldRevision=`git rev-parse --short HEAD` oldRevision=`git rev-parse --short HEAD`
fi fi


echo "Executing git pull" echo "Executing git reset"
git pull cmd="git reset --hard origin/""$currentBranch"; $cmd
newRevision=`git rev-parse --short HEAD` newRevision=`git rev-parse --short HEAD`


# Compare local and remote revision numbers, and build if there are changes # Compare local and remote revision numbers, and build if there are changes
Expand Down

0 comments on commit 1b22f4c

Please sign in to comment.