Only fetch if not checked out
This commit is contained in:
@@ -500,16 +500,16 @@ from_source() {
|
|||||||
|
|
||||||
# Determine commit-ish for git worktree
|
# Determine commit-ish for git worktree
|
||||||
case "$RELEASE" in
|
case "$RELEASE" in
|
||||||
snapshot)
|
snapshot) wt_commit="main" ;;
|
||||||
wt_commit="main"
|
|
||||||
;;
|
|
||||||
[0-9][0-9].[0-9][0-9].*)
|
[0-9][0-9].[0-9][0-9].*)
|
||||||
branch="openwrt-${RELEASE%.*}"
|
branch="openwrt-${RELEASE%.*}"
|
||||||
tag="v$RELEASE"
|
tag="v$RELEASE"
|
||||||
if ask_ok "Use $branch branch HEAD (y, recommended) or $tag tag (n)?"; then
|
if ask_ok "Use $branch branch HEAD (y, recommended) or $tag tag (n)?"; then
|
||||||
wt_commit="$branch"
|
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"
|
execute git -C "$SRC_DIR" fetch origin "$branch:$branch"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
wt_commit="$tag"
|
wt_commit="$tag"
|
||||||
fi
|
fi
|
||||||
@@ -517,10 +517,11 @@ from_source() {
|
|||||||
*)
|
*)
|
||||||
debug "Passing '$RELEASE' commit-ish to git worktree"
|
debug "Passing '$RELEASE' commit-ish to git worktree"
|
||||||
wt_commit="$RELEASE"
|
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 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"
|
execute git -C "$SRC_DIR" fetch origin "$wt_commit:$wt_commit"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user