From c7b954252d6ee1f38c84a6048bca1151be041765 Mon Sep 17 00:00:00 2001 From: bryan Date: Sun, 19 Oct 2025 15:21:53 -0400 Subject: [PATCH] Fetch worktree branch instead of pull --- openwrtbuilder | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/openwrtbuilder b/openwrtbuilder index c48eb3e..bc2eed6 100755 --- a/openwrtbuilder +++ b/openwrtbuilder @@ -528,18 +528,17 @@ from_source() { [[ -d "$BUILD_DIR" ]] && execute rm -rf "$BUILD_DIR" fi - # Pull or clone source repo + # Fetch or clone source repo (no local merges) if [[ -d "$SRC_DIR" ]]; then - execute git -C "$SRC_DIR" pull --all --tags --prune + execute git -C "$SRC_DIR" fetch origin --tags --prune else execute mkdir -p "$SRC_DIR" execute git clone "$src_url" "$SRC_DIR" fi - # Remove existing build dir and add new worktree - if [[ -d "$BUILD_DIR" ]]; then - execute rm -rf "$BUILD_DIR" - fi + # Recreate worktree from the remote ref + execute git -C "$SRC_DIR" worktree remove --force "$BUILD_DIR" || true + execute rm -rf "$BUILD_DIR" execute git -C "$SRC_DIR" worktree prune --verbose execute git -C "$SRC_DIR" worktree add --detach "$BUILD_DIR" "origin/$ref"