diff --git a/.gitfield/last_resolution.log b/.gitfield/last_resolution.log new file mode 100644 index 0000000..fc52d5b --- /dev/null +++ b/.gitfield/last_resolution.log @@ -0,0 +1,43 @@ +🛠️ [GITFIELD] Beginning auto-resolution ritual... +✅ No changes to commit. +🔍 Checking bitbucket for divergence... +From bitbucket.org:thefoldwithin/git-sigil + * branch master -> FETCH_HEAD +✅ bitbucket is already in sync. +🔍 Checking github for divergence... +From github.com:mrhavens/git-sigil + * branch master -> FETCH_HEAD +⚠️ Divergence with github. Attempting merge... +From github.com:mrhavens/git-sigil + * branch master -> FETCH_HEAD +Already up to date. +✅ No changes to commit. +To github.com:mrhavens/git-sigil.git + ! [rejected] master -> master (non-fast-forward) +error: failed to push some refs to 'github.com:mrhavens/git-sigil.git' +hint: Updates were rejected because a pushed branch tip is behind its remote +hint: counterpart. If you want to integrate the remote changes, use 'git pull' +hint: before pushing again. +hint: See the 'Note about fast-forwards' in 'git push --help' for details. +⚠️ Final push failed to github +🔍 Checking gitlab for divergence... +From gitlab.com:mrhavens/git-sigil + * branch master -> FETCH_HEAD +✅ gitlab is already in sync. +🔍 Checking local for divergence... +From file:///home/mrhavens/git-local-repos/git-sigil + * branch master -> FETCH_HEAD +✅ local is already in sync. +🔍 Checking origin for divergence... +From ssh://remember.thefoldwithin.earth/mrhavens/git-sigil + * branch master -> FETCH_HEAD +✅ origin is already in sync. +🔍 Checking remember for divergence... +From remember.thefoldwithin.earth:mrhavens/git-sigil + * branch master -> FETCH_HEAD +✅ remember is already in sync. +🧙 Final override: Forcing sync to GitHub... +To github.com:mrhavens/git-sigil.git + + 4b323cb...f57c893 master -> master (forced update) +✅ GitHub forcibly realigned with local truth. +✅ GitField resolution ritual complete. diff --git a/.gitfield/push_log.json b/.gitfield/push_log.json index 36e6721..f3ae38f 100644 --- a/.gitfield/push_log.json +++ b/.gitfield/push_log.json @@ -122,6 +122,12 @@ "branch": "master", "commit": "4467ce03add4752ee46b5f27dc66929f8e53c509", "message": "Post-GitHub sync at 2025-06-07 00:07:23" + }, + { + "timestamp": "2025-06-07 00:42:50", + "branch": "Unknown", + "commit": "38bfa138c36b5afb09001a81d1df873ee7732eb8", + "message": "🔀 Merge: resolved conflicts with github master" } ] } diff --git a/.gitfield/pushed.log b/.gitfield/pushed.log index 3af70c5..feccd3f 100644 --- a/.gitfield/pushed.log +++ b/.gitfield/pushed.log @@ -141,3 +141,4 @@ [2025-06-06 12:25:55] GitLab: https://gitlab.com/mrhavens/git-sigil [2025-06-06 12:26:12] Bitbucket: https://bitbucket.org/thefoldwithin/git-sigil >>>>>>> 4b323cbd7da16625ba04d2a7e8db3532f84bc1e0 +[2025-06-07 00:42:56] Local: diff --git a/bin/gitfield-resolve.sh b/bin/gitfield-resolve.sh new file mode 100644 index 0000000..c36c73b --- /dev/null +++ b/bin/gitfield-resolve.sh @@ -0,0 +1,103 @@ +#!/bin/bash +# gitfield-resolve.sh — 🧠 Recursive GitField Self-Healing Sync Engine +# Author: Solaria + Mark Randall Havens 🌀 +# Version: 𝛂∞.21 + +LOG_FILE=".gitfield/last_resolution.log" +exec > >(tee "$LOG_FILE") 2>&1 + +echo "🛠️ [GITFIELD] Beginning auto-resolution ritual..." + +SIGIL_FILES=$(git diff --name-only --diff-filter=U | grep '\.sigil\.md$') +PUSHED_LOG=".gitfield/pushed.log" + +resolve_sigil_conflicts() { + for file in $SIGIL_FILES; do + echo "⚖️ Resolving conflict in: $file" + + OUR_TIME=$(grep -Eo '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9:]{8}' "$file" | head -n1) + THEIR_TIME=$(grep -Eo '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9:]{8}' "$file" | tail -n1) + + if [[ "$OUR_TIME" > "$THEIR_TIME" ]]; then + echo "🧭 Keeping local version ($OUR_TIME)" + git checkout --ours "$file" + else + echo "🧭 Keeping remote version ($THEIR_TIME)" + git checkout --theirs "$file" + fi + git add "$file" + done +} + +resolve_log_conflict() { + if [[ -f "$PUSHED_LOG" && $(git ls-files -u | grep "$PUSHED_LOG") ]]; then + echo "📜 Resolving pushed.log by merging unique lines..." + git checkout --ours "$PUSHED_LOG" + cp "$PUSHED_LOG" .log_ours + + git checkout --theirs "$PUSHED_LOG" + cp "$PUSHED_LOG" .log_theirs + + cat .log_ours .log_theirs | sort | uniq > "$PUSHED_LOG" + rm .log_ours .log_theirs + + git add "$PUSHED_LOG" + fi +} + +commit_resolution() { + if git diff --cached --quiet; then + echo "✅ No changes to commit." + else + echo "🖋️ Committing auto-resolved changes with GPG signature..." + git commit -S -m "🔄 Auto-resolved sigil + log conflicts via gitfield-resolve" + fi +} + +check_and_sync_remotes() { + for remote in $(git remote); do + echo "🔍 Checking $remote for divergence..." + git fetch "$remote" master + + BASE=$(git merge-base master "$remote/master") + LOCAL=$(git rev-parse master) + REMOTE=$(git rev-parse "$remote/master") + + if [ "$LOCAL" = "$REMOTE" ]; then + echo "✅ $remote is already in sync." + elif [ "$LOCAL" = "$BASE" ]; then + echo "⬇️ Local is behind $remote. Pulling changes..." + git pull --no-rebase "$remote" master || echo "⚠️ Pull failed for $remote" + resolve_sigil_conflicts + resolve_log_conflict + commit_resolution + git push "$remote" master || echo "⚠️ Push failed to $remote" + elif [ "$REMOTE" = "$BASE" ]; then + echo "⬆️ Local is ahead of $remote. Pushing..." + git push "$remote" master || echo "⚠️ Push failed to $remote" + else + echo "⚠️ Divergence with $remote. Attempting merge..." + git pull --no-rebase "$remote" master || echo "❌ Merge failed: Manual fix required." + resolve_sigil_conflicts + resolve_log_conflict + commit_resolution + git push "$remote" master || echo "⚠️ Final push failed to $remote" + fi + done +} + +final_force_github() { + if git remote get-url github &>/dev/null; then + echo "🧙 Final override: Forcing sync to GitHub..." + git push --force github master && echo "✅ GitHub forcibly realigned with local truth." || echo "❌ Force push failed. Manual intervention required." + fi +} + +# --- Ritual Sequence --- +resolve_sigil_conflicts +resolve_log_conflict +commit_resolution +check_and_sync_remotes +final_force_github + +echo "✅ GitField resolution ritual complete."