From 9a26478498ddeed549e5300dc3a6be358cb28bd3 Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Sat, 30 May 2026 16:55:25 -0400 Subject: [PATCH] git_pull_execute: GitHub fallback when GITEA_REPO_PATH is empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- git_pull_execute.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/git_pull_execute.sh b/git_pull_execute.sh index 6320576..a785f53 100755 --- a/git_pull_execute.sh +++ b/git_pull_execute.sh @@ -69,6 +69,39 @@ fi # detect_hosts() sets MY_ID — needed for sparse checkout configuration 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 ━━━ # ==============================================================================================