Repository navigation
What's changed
This release is a significant reliability overhaul following a full code audit. All changes are backwards-compatible — existing configs and volume mounts continue to work without modification.
Bug fixes
- Empty repository crash — repos with no commits (
rev-parse HEAD→ exit 128) previously printedBackup failed. They are now silently skipped with a clearSkipping …: empty repositorymessage. - Single-token run always exited with code 1 —
backup_repositories_for_tokennever returned a value;main()treated the implicitNoneas failure and calledsys.exit(1)even on a successful run. - Token config parsing — indexing
tokens_config[0]without a type check meant a plain string token would be iterated character-by-character. Now handlesstr(split on comma),list(including a single comma-separated element), and exits cleanly on missing/empty/wrong-type config. mkdirreturn value —mkdiralways returnedTrue, so "Created directory" was printed even when the directory already existed. Now returnsTrueonly on actual creation.- Bare
except:inmkdir— replaced withexcept OSError:so signals such asKeyboardInterruptare not swallowed silently. - Dead EEXIST branch — the
except Exception / errno.errorcodebranch inmkdirwas unreachable withexist_ok=Trueand has been removed along with the unusederrnoimport. download_ziperror handling — the warning print was commented out (failures were silent); it has been restored. The catch now covers allRequestException(timeouts, connection errors) instead of onlyHTTPError. Uses the sharedsessionobject instead of a barerequests.get.shlex.splitinjection risk inmirror_repo— building a shell string and splitting it risked misparse ifbase_pathcontained a quote character. Replaced with a direct argument list passed toexecve.- Config overwritten on every container restart —
backup.shunconditionally copiedconfig.json.exampleoverconfig.jsonon each start, discarding any volume-mounted or previously written config. Now seeds the example only when noconfig.jsonexists.
Improvements
- Disable Git auto-GC —
git config --global gc.auto 0is set inbackup.shto prevent Git's automatic garbage collection from running mid-backup and interfering with mirror clones. - Removed duplicate
backup_single_repodefinition — a copy-paste leftover that silently shadowed the first definition.