Skip to content

Commit

Permalink
fix: increase robustness
Browse files Browse the repository at this point in the history
  • Loading branch information
stergiotis committed Oct 5, 2024
1 parent 903d722 commit 9acd9b7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions scripts/install_3rd_party_git_repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e
here=$(dirname "$(readlink -f "$BASH_SOURCE")")
cd "$here"
mkdir -p "../../contrib"

export LC_ALL=C
function getRepo() {
url="$1"
dir="$2"
Expand All @@ -17,12 +17,20 @@ function getRepo() {
echo "directory \"$dir\" not found after cloning \"$url\""
exit 1
fi
git remote set-url origin "$url"
git config pull.rebase false
defaultBranch=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
git clean -f -d
git reset --hard
git pull
git merge --abort || true
git checkout HEAD
git clean -f -d
git reset --hard
git fetch origin "$defaultBranch"
if [ ! -z "$branch" ]; then
git checkout -q "$branch"
fi
git fetch
if [ ! -z "$commit" ]; then
git checkout -q "$commit"
fi
Expand Down

0 comments on commit 9acd9b7

Please sign in to comment.