Fetch worktree branch instead of pull
This commit is contained in:
@@ -528,18 +528,17 @@ from_source() {
|
|||||||
[[ -d "$BUILD_DIR" ]] && execute rm -rf "$BUILD_DIR"
|
[[ -d "$BUILD_DIR" ]] && execute rm -rf "$BUILD_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Pull or clone source repo
|
# Fetch or clone source repo (no local merges)
|
||||||
if [[ -d "$SRC_DIR" ]]; then
|
if [[ -d "$SRC_DIR" ]]; then
|
||||||
execute git -C "$SRC_DIR" pull --all --tags --prune
|
execute git -C "$SRC_DIR" fetch origin --tags --prune
|
||||||
else
|
else
|
||||||
execute mkdir -p "$SRC_DIR"
|
execute mkdir -p "$SRC_DIR"
|
||||||
execute git clone "$src_url" "$SRC_DIR"
|
execute git clone "$src_url" "$SRC_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove existing build dir and add new worktree
|
# Recreate worktree from the remote ref
|
||||||
if [[ -d "$BUILD_DIR" ]]; then
|
execute git -C "$SRC_DIR" worktree remove --force "$BUILD_DIR" || true
|
||||||
execute rm -rf "$BUILD_DIR"
|
execute rm -rf "$BUILD_DIR"
|
||||||
fi
|
|
||||||
execute git -C "$SRC_DIR" worktree prune --verbose
|
execute git -C "$SRC_DIR" worktree prune --verbose
|
||||||
execute git -C "$SRC_DIR" worktree add --detach "$BUILD_DIR" "origin/$ref"
|
execute git -C "$SRC_DIR" worktree add --detach "$BUILD_DIR" "origin/$ref"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user