Skip to content

fix: keep addon runtime files out of backups on existing repos - #2

Merged
askb merged 1 commit into
mainfrom
fix/exclude-own-runtime-files
Jul 12, 2026
Merged

fix: keep addon runtime files out of backups on existing repos#2
askb merged 1 commit into
mainfrom
fix/exclude-own-runtime-files

Conversation

@askb

@askb askb commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Problem

seed_gitignore() only writes a .gitignore when the repo doesn't already have one. When the addon is pointed at an existing git repo (the common "migrate my current config repo" case), that guard skips — so the addon's own runtime files are never ignored:

  • .gitops_backup_status — the addon's status heartbeat
  • gitops_backup.log

Both get swept into backup PRs (observed: haos-config#134 shipped .gitops_backup_status + parked integrations), and committing the status file risks the same daily-PR feedback loop the #119-class comment warns about. End users shouldn't have to hand-edit .gitignore for the addon's own files.

Fix

Add ensure_own_excludes(), called on every run against an existing repo:

  • Writes the addon's runtime files to .git/info/exclude — git's local, uncommitted ignore. It's the correct home for addon-managed metadata: independent of the user's committed .gitignore, works whether or not one exists, and never appears in a backup PR. Idempotent (managed block replaced each run).
  • Untracks .gitops_backup_status/gitops_backup.log if a prior buggy run already committed them (removal flows out through the next backup PR).

Test

Added self-check #4: a repo that already has its own .gitignore (lacking the addon entries) and was never excluded — asserts the addon's runtime files stay out of the pushed backup branch while real drift is still backed up. All local self-checks pass; shellcheck clean.

@askb
askb force-pushed the fix/exclude-own-runtime-files branch from 8cd0b01 to 114a1ea Compare July 12, 2026 08:29
seed_gitignore() only writes a .gitignore when none exists, so any repo
that already had one (every 'migrate an existing repo' case) never got
the addon's own entries — .gitops_backup_status and gitops_backup.log
were swept into backup PRs, risking the same status-file PR feedback
loop as the #119 class of bug.

Add ensure_own_excludes(): on every run against an existing repo, write
the addon's runtime files to .git/info/exclude (git's local, uncommitted
ignore — the right home for addon-managed metadata, independent of the
user's committed .gitignore) and untrack them if a prior run committed
them. Add a self-check covering the existing-.gitignore migration path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
@askb
askb force-pushed the fix/exclude-own-runtime-files branch from 114a1ea to 873dab4 Compare July 12, 2026 08:30
@askb
askb merged commit 0ad3a7e into main Jul 12, 2026
6 checks passed
@askb
askb deleted the fix/exclude-own-runtime-files branch July 12, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant