From 6bc96d1663e3b8e3aeeb5955949fd88abfd3ee00 Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Mon, 4 Aug 2025 09:01:38 -0500 Subject: [PATCH] script: fix conflicts better --- scripts/indexer-sync-v2.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/indexer-sync-v2.sh b/scripts/indexer-sync-v2.sh index 19965f08b..45df56a40 100755 --- a/scripts/indexer-sync-v2.sh +++ b/scripts/indexer-sync-v2.sh @@ -477,8 +477,10 @@ resolve_conflicts() { if [ -n "$schema_conflicts" ]; then log "DEBUG" "Schema conflict exists; using Prowlarr schema" for file in $schema_conflicts; do - git checkout --ours "$file" - git add --force "$file" + if git ls-files | grep -q "^$file$"; then + git checkout --ours "$file" + git add --force "$file" + fi done fi @@ -487,8 +489,12 @@ resolve_conflicts() { while IFS= read -r file; do git rm --force --quiet --ignore-unmatch "$file" done <<<"$nonyml_conflicts" - git checkout --ours package.json package-lock.json .editorconfig - git add --force package.json package-lock.json .editorconfig + for file in package.json package-lock.json .editorconfig; do + if git ls-files | grep -q "^$file$"; then + git checkout --ours "$file" + git add --force "$file" + fi + done fi if [ -n "$yml_conflicts" ]; then @@ -501,7 +507,9 @@ handle_yml_conflicts() { yml_remove=$(git status --porcelain | grep yml | grep -vi "definitions/" | awk -F '[ADUMRC]{1,2} ' '{print $2}' | awk '{ gsub(/^[ \t]+|[ \t]+$/, ""); print }') for def in $yml_remove; do log "DEBUG" "Removing non-definition yml; [$yml_remove]" - git rm --f --ignore-unmatch "$yml_remove" + if git ls-files | grep -q "^$yml_remove$"; then + git rm --f --ignore-unmatch "$yml_remove" + fi yml_conflicts=$(GIT_DIFF_CMD | grep ".yml") done if [ -n "$yml_conflicts" ]; then