T-KAU0-backup-isolate-store-git
State: planning/draft · Impact: medium · Complexity: small
A user’s own git setup can change what gets backed up. A file listed in ~/.config/git/ignore is
silently left out of every snapshot. This task makes the store’s git ignore the user’s global
ignore, attributes and templates, so a backup holds the whole vault on every machine.
config::ensure_store_lockedpinsuser.name,user.emailandcommit.gpgsign=falseon first init, andcore.autocrlf=falseandcore.quotepath=falseon every run, in the store’s config.- It pins nothing for
core.excludesFileorcore.attributesFile. When those are unset, git reads$XDG_CONFIG_HOME/git/ignore(default~/.config/git/ignore) and$XDG_CONFIG_HOME/git/attributes. SettingGIT_CONFIG_GLOBALandGIT_CONFIG_NOSYSTEMdoes not stop this. A reproduction with both set still dropped a file listed in~/.config/git/ignorefromadd -A. Settingcore.excludesFile=/dev/nullin the store config fixed it. - This affects production now. A user’s
~/.config/git/ignoresilently drops files from their backups. A user’s global attributes can change binary detection, and with it the numstat counts. git::init_barerunsgit init --bare --initial-branch=main. It copies git’s templates, and a userinit.templateDirapplies. So stores differ by machine, and a user template can install hooks into the store.- The doc comment on
git::scratch()ingit.rssays itsgit_envneutralises the developer’s git config. It has the same gap: a developer’s XDG ignore can drop fixture files.
Proposed
Section titled “Proposed”| Piece | Shape |
|---|---|
| Ignore | ensure_store_locked pins core.excludesFile=/dev/null in the store config on every run, beside core.autocrlf, so existing stores get it too. |
| Attributes | The same for core.attributesFile=/dev/null. |
| Templates | init_bare runs git init --bare --template= --initial-branch=main. An empty template means no sample hooks and no user template, so new stores are the same everywhere. |
| Store excludes | The store’s info/exclude stays the only ignore list. |
This applies to whatever git runs, PATH git today and the bundled git from T-UPPP-backup-bundle-git later.
Approach
Section titled “Approach”- Add the two pins to the every-run block in
ensure_store_locked. Extend the comment there. - Pass
--template=ininit_bare. Update its doc comment. - Fix the
scratch()doc comment ingit.rs. PointXDG_CONFIG_HOMEat the temp dir in itsgit_envtoo, so tests never read the developer’s XDG files. - Add the tests in the ACs.
| Area | Note |
|---|---|
solutions/determined/crates/determined-backup/src/config.rs | Store config pins |
solutions/determined/crates/determined-backup/src/git.rs | init_bare --template=; scratch() env and comment |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: With
XDG_CONFIG_HOMEpointing at a directory whosegit/ignorelists a vault file, a snapshot still contains that file. - AC-2: With a
git/attributesthere that marks a text filebinary(or-diff), its numstat counts are unchanged. - AC-3: A store created with a user
init.templateDirthat holds a hook has nohooks/entries from it. - AC-4: An existing store gains both pins on the next
ensure_store.the_store_config_pins_survive_a_second_ensurechecks them. - AC-5: The change notes the behavior change: files a user’s global ignore used to drop are now backed up.
Out of scope
Section titled “Out of scope”- Bundling git, and the env isolation that comes with it (
GIT_CONFIG_GLOBAL,GIT_CONFIG_NOSYSTEM,GIT_EXEC_PATH,GIT_TERMINAL_PROMPT). See T-UPPP-backup-bundle-git.
Dependencies
Section titled “Dependencies”- none