git_pull_execute: GitHub fallback when GITEA_REPO_PATH is empty
End users leave GITEA_REPO_PATH="" in master.conf (template default). Before hitting any Gitea detection logic, the script now checks for this and does git pull --ff-only origin main directly — origin is already GitHub since the .plg cloned from there. Sparse checkout skipped on this path: conf files are gitignored so nothing sensitive is in the repo to exclude. Developer path (GITEA_REPO_PATH configured) is completely unchanged.
This commit is contained in:
@@ -69,6 +69,39 @@ fi
|
|||||||
# detect_hosts() sets MY_ID — needed for sparse checkout configuration
|
# detect_hosts() sets MY_ID — needed for sparse checkout configuration
|
||||||
detect_hosts
|
detect_hosts
|
||||||
|
|
||||||
|
# ==============================================================================================
|
||||||
|
# ━━━ GitHub path — GITEA_REPO_PATH not configured ━━━
|
||||||
|
# ==============================================================================================
|
||||||
|
# End users without a self-hosted Gitea leave GITEA_REPO_PATH empty in master.conf.
|
||||||
|
# The .plg already cloned from GitHub so origin is already correct — just pull from it.
|
||||||
|
# Sparse checkout is not needed: conf files are gitignored and absent from the repo.
|
||||||
|
if [[ -z "${GITEA_REPO_PATH:-}" ]]; then
|
||||||
|
echo ""
|
||||||
|
echo "━━━ $ICON_SYNC Git Pull (GitHub) ━━━"
|
||||||
|
|
||||||
|
if [[ ! -d "$TARGET_DIR/.git" ]]; then
|
||||||
|
error "No git repo at $TARGET_DIR — reinstall the plugin to restore it"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$DRY_RUN" == true ]]; then
|
||||||
|
warn "DRY RUN — would: git -C $TARGET_DIR pull --ff-only origin main"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git config --global --add safe.directory "$TARGET_DIR" 2>/dev/null || true
|
||||||
|
|
||||||
|
if git -C "$TARGET_DIR" pull --ff-only origin main; then
|
||||||
|
echo " Pull complete ✅"
|
||||||
|
find "$TARGET_DIR" -type f -name "*.sh" -exec chmod +x {} \;
|
||||||
|
else
|
||||||
|
error "Git pull failed — check internet access and GitHub availability"
|
||||||
|
notify "Git pull failed on $(hostname) — check internet / GitHub connectivity" "Git Sync" "alert"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# ==============================================================================================
|
# ==============================================================================================
|
||||||
# ━━━ Locate Gitea ━━━
|
# ━━━ Locate Gitea ━━━
|
||||||
# ==============================================================================================
|
# ==============================================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user