From e13c52f5f1e66bb77113b6903609bd04f92ff888 Mon Sep 17 00:00:00 2001 From: Stephen Boyd <60997703+sboyd-m@users.noreply.github.com> Date: Fri, 24 Jun 2022 15:38:09 -0700 Subject: [PATCH] Update xo-install.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #128 Also fixes force pushes to named branches, which cause `--ff-only` to fail Co-authored-by: Roni Väyrynen --- xo-install.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xo-install.sh b/xo-install.sh index 7d17d92..c8536bb 100755 --- a/xo-install.sh +++ b/xo-install.sh @@ -573,14 +573,16 @@ function PrepInstall { fi echo - # keep the actual source code in one directory and either clone or git pull depending on if directory exists already + # keep the actual source code in one directory and either clone or git fetch depending on if directory exists already printinfo "Fetching $XO_SVC_DESC source code" if [[ ! -d "$XO_SRC_DIR" ]]; then runcmd "mkdir -p \"$XO_SRC_DIR\"" runcmd "git clone \"${REPOSITORY}\" \"$XO_SRC_DIR\"" else - runcmd "cd \"$XO_SRC_DIR\" && git pull --ff-only" - runcmd "cd $SCRIPT_DIR" + runcmd "cd \"$XO_SRC_DIR\" && git remote set-url origin \"${REPOSITORY}\" && \ + git fetch --prune && \ + git reset --hard origin/master && \ + git clean -xdff" fi # Deploy the latest xen-orchestra source to the new install directory.