Use --force when checking out commits
The clone_repo script clones the repo if needed and then checks out the commit, branch, or master. If a previous checkout has left untracked files, this will fail to protect those files from being overwritten. In our automation we do not need to care about untracked files and need to make sure we have the right point in the tree, so force the checkout to make sure these untracked files are ignored. Change-Id: Ia1ec2869aa7a899e987ef43a11f0af627efeea65 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
@@ -177,12 +177,12 @@ fi
|
||||
|
||||
if [ ! -z "$REF" ]; then
|
||||
# Check out the specified reference.
|
||||
(cd $local_dir && git checkout "$REF")
|
||||
(cd $local_dir && git checkout -f "$REF")
|
||||
else
|
||||
# Check out the expected branch (master is the default, but if the
|
||||
# directory already existed we might have checked out something else
|
||||
# directory already exists we might have checked out something else
|
||||
# before so just do it again).
|
||||
(cd $local_dir &&
|
||||
(git checkout $BRANCH || git checkout master) &&
|
||||
(git checkout -f $BRANCH || git checkout -f master) &&
|
||||
git pull --ff-only)
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user