From 5ad9e424664da04b9c4d331353f43a4edb862c61 Mon Sep 17 00:00:00 2001 From: ServarrAdmin Date: Thu, 23 Oct 2025 22:20:00 -0500 Subject: [PATCH] Fixed: Script deleting .md and schema.json files bug --- scripts/indexer-sync-v2.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/indexer-sync-v2.sh b/scripts/indexer-sync-v2.sh index 127110f63..4441109d6 100755 --- a/scripts/indexer-sync-v2.sh +++ b/scripts/indexer-sync-v2.sh @@ -611,7 +611,8 @@ pull_cherry_and_merge() { log "INFO" "Evaluating and Reviewing Changes" # Remove unwanted file types that Jackett might have added - unwanted_files=$(git diff --cached --name-only | grep -E "$CONFLICTS_NONYML_EXTENSIONS" || true) + # Explicitly exclude important repository files and schema files + unwanted_files=$(git diff --cached --name-only | grep -E "$CONFLICTS_NONYML_EXTENSIONS" | grep -v -E '^(README\.md|CONTRIBUTING\.md|LICENSE\.md)$' | grep -v 'schema\.json$' || true) if [ -n "$unwanted_files" ]; then log "INFO" "Removing unwanted file types from Jackett" echo "$unwanted_files" | while IFS= read -r file; do @@ -620,6 +621,14 @@ pull_cherry_and_merge() { done fi + # Always use Prowlarr's version of important repository markdown files + for repo_file in README.md CONTRIBUTING.md LICENSE.md; do + if git diff --cached --name-only | grep -q "^${repo_file}$"; then + log "DEBUG" "Ensuring Prowlarr version of $repo_file is used" + git checkout HEAD -- "$repo_file" 2>/dev/null || true + fi + done + # Also remove any src/ directories that might have been added src_files=$(git diff --cached --name-only | grep '^src/' || true) if [ -n "$src_files" ]; then @@ -680,15 +689,16 @@ resolve_conflicts() { conflicted_files=$(git diff --name-only --diff-filter=U) readme_conflicts=$(echo "$conflicted_files" | grep -E '^README\.md$' || true) - nonyml_conflicts=$(echo "$conflicted_files" | grep -E "$CONFLICTS_NONYML_EXTENSIONS" || true) + # Explicitly exclude important repository files and schema files from nonyml conflicts + nonyml_conflicts=$(echo "$conflicted_files" | grep -E "$CONFLICTS_NONYML_EXTENSIONS" | grep -v -E '^(README\.md|CONTRIBUTING\.md|LICENSE\.md)$' | grep -v 'schema\.json$' || true) yml_conflicts=$(echo "$conflicted_files" | grep -E '\.ya?ml$' || true) schema_conflicts=$(echo "$conflicted_files" | grep -E '\.schema\.json$' || true) log "WARN" "conflicts exist" if [ -n "$readme_conflicts" ]; then log "DEBUG" "README conflict exists; using Prowlarr README" - git checkout --ours README.md 2>/dev/null || git rm -f README.md 2>/dev/null || true - git add --force README.md 2>/dev/null || true + git checkout --ours README.md + git add --force README.md fi if [ -n "$schema_conflicts" ]; then