Skip to content

Hook state files accumulate untracked at the store root, and the day a name collides merge --ff-only refuses #261

Closed

Description

@fdaviddpt

The backup and restore hooks now drop several state files at the memory store's root, and nothing reconciles the .gitignore that would keep them out of git. Latent today; it breaks restore the day a name collides.

The files

Growing across the recent work: .git-backup-rejected (part 1 of #253), .git-restore-diverged and .git-restore-fetch (part 2), plus the existing cooldown marker.

Observed in a live run after two invocations:

?? .git-restore-diverged
?? .git-restore-fetch

Untracked, at the store root, in a repository whose entire purpose is to be pushed to a remote.

Why it is not merely untidy

git merge --ff-only refuses when an untracked file would be overwritten. So the day a remote adds a file with one of those names — another machine on a newer version, a user's own file, a future feature — the restore stops with a "REFUSED by git" that reads like a dirty worktree rather than a name collision. The mechanism the feature depends on is the mechanism that breaks.

It also means every git status in the store shows noise the plugin created, which trains a user to ignore that output.

Why it is not a two-line fix

Worth stating, because it looks like one. Nothing in the codebase writes the store-root .gitignore — scripts/bootstrap-dirs.sh:128 writes only the per-slug one (*). The root file is user-authored, from the README. So "just add the names" would mean the plugin editing a tracked file inside the user's own backup repository, which is new and fairly invasive behaviour, and it would not help any existing install.

Part 1 already set the precedent by documenting .git-backup-rejected in the README without reconciling existing installs, so this is a growing debt rather than a new one.

The likely right shape

Relocate all .git-backup-* / .git-restore-* state under a single already-ignored directory, so one existing rule covers every present and future state file and no user action is required.

That touches part 1's files as well as part 2's, which is exactly why it is a separate PR rather than a rider — and it needs a decision about existing installs, where the old files are already on disk and possibly already committed.

The judgment call

Whether to migrate or merely stop creating new ones at the root. Migration is friendlier and riskier: it means the plugin moving files inside a repo the user may have committed and pushed, and a half-completed migration across two machines sharing a remote is its own divergence. "New location going forward, leave the old files alone, document them" may be the better trade — but establish it rather than assuming.

Provenance

Reported by the agent implementing #253 part 2, which explicitly recommended against folding it into that PR — correctly. Reproduced independently in a live smoke of the restore hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions