Only fetch if not checked out
This commit is contained in:
@@ -500,16 +500,16 @@ from_source() {
|
||||
|
||||
# Determine commit-ish for git worktree
|
||||
case "$RELEASE" in
|
||||
snapshot)
|
||||
wt_commit="main"
|
||||
;;
|
||||
snapshot) wt_commit="main" ;;
|
||||
[0-9][0-9].[0-9][0-9].*)
|
||||
branch="openwrt-${RELEASE%.*}"
|
||||
tag="v$RELEASE"
|
||||
if ask_ok "Use $branch branch HEAD (y, recommended) or $tag tag (n)?"; then
|
||||
wt_commit="$branch"
|
||||
# Always fetch latest branch from origin
|
||||
# Only fetch if branch is NOT checked out in any worktree
|
||||
if ! git -C "$SRC_DIR" worktree list | grep -q "$branch"; then
|
||||
execute git -C "$SRC_DIR" fetch origin "$branch:$branch"
|
||||
fi
|
||||
else
|
||||
wt_commit="$tag"
|
||||
fi
|
||||
@@ -517,10 +517,11 @@ from_source() {
|
||||
*)
|
||||
debug "Passing '$RELEASE' commit-ish to git worktree"
|
||||
wt_commit="$RELEASE"
|
||||
# If it's a branch, fetch latest
|
||||
if execute git -C "$SRC_DIR" show-ref --verify --quiet "refs/heads/$wt_commit"; then
|
||||
if ! git -C "$SRC_DIR" worktree list | grep -q "$wt_commit"; then
|
||||
execute git -C "$SRC_DIR" fetch origin "$wt_commit:$wt_commit"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user