acquaint.sync#
Private-repository sync for the data root: create the repository private, refuse anything else, guard every push.
init creates the GitHub repository through gh as private, refuses to
continue unless gh repo view --json visibility reports PRIVATE, makes the data
root its checkout, and installs a pre-push hook. The hook, and push and pull
in Python, re-check that:
the push goes through
origin, which has exactly one URL, the one recorded at init;no
pushurldiffers from it, and nourl.*.pushInsteadOfrewrites it;that URL is one of the forms that name the recorded repository on github.com (
github_urls(), the same list the hook spells out);ghreports the repository, on github.com whateverGH_HOSTsays, as private.
The hook is installed in the repository’s shared hooks folder, executable, and
core.hooksPath points at it by absolute path, so linked worktrees are guarded too and
a global core.hooksPath cannot silently disable it. init takes over only an empty
folder, or a clone of that same repository; it refuses any other existing repository.
What this does not protect, stated plainly:
a private repository is access control, not encryption: the host can read it all;
git push --no-verifyskips the hook;whoever can change this repository’s git config, or which
ghruns onPATH, controls what the guard sees;moving the data root breaks the absolute hook path until
sync init --existing-onlyruns again (sync pushrefuses in that state; a rawgit pushdoes not);file names and commit messages carry people’s names;
deleting a folder does not remove it from history, other clones, or backups.
git-remote-gcrypt, which would encrypt contents, names and history, is not supported
yet: the guard does not recognise its internal push, so init refuses gcrypt:: URLs.
Every git and gh call goes through run, so tests can script gh while
git runs for real.
Functions
|
Every remote URL accepted for a GitHub repository. |
|
Make |
|
Re-check the remote and its visibility, then rebase local work onto it (uncommitted edits are stashed and restored). |
|
Commit everything, rebase onto the remote, and push, after re-checking the remote, the guard and the visibility. |
|
Run |
|
Whether only the repository's owner can read it, and why not: private, owned by a person (not an organisation), that person its only collaborator, no invitation pending. |
|
Whether the store is synced, where to, uncommitted changes, ahead/behind, the guard, and live visibility. |
|
|
- acquaint.sync.github_urls(repo)[source]#
Every remote URL accepted for a GitHub repository. The pre-push hook spells out the same six forms.
>>> github_urls("example/profiles") ['git@github.com:example/profiles.git', 'git@github.com:example/profiles', 'ssh://git@github.com/example/profiles.git', 'ssh://git@github.com/example/profiles', 'https://github.com/example/profiles.git', 'https://github.com/example/profiles']
- acquaint.sync.init(root, repo, *, remote_url=None, create=True, dry_run=False, run=<function run_command>)[source]#
Make
roota checkout of the private GitHub repositoryrepo, creating it (private) if needed.
- acquaint.sync.pull(root, *, dry_run=False, run=<function run_command>)[source]#
Re-check the remote and its visibility, then rebase local work onto it (uncommitted edits are stashed and restored).
- acquaint.sync.push(root, *, message=None, dry_run=False, run=<function run_command>)[source]#
Commit everything, rebase onto the remote, and push, after re-checking the remote, the guard and the visibility.
- acquaint.sync.run_command(args, *, cwd=None)[source]#
Run
gitorgh(ghpinned to github.com), capturing text output.- Return type:
- acquaint.sync.sole_access(repo, *, run=<function run_command>)[source]#
Whether only the repository’s owner can read it, and why not: private, owned by a person (not an organisation), that person its only collaborator, no invitation pending.
This decides whether profile edits may be committed and pushed without the operator reviewing the diff first: nobody else will see them.
- acquaint.sync.status(root, *, check_visibility=True, run=<function run_command>)[source]#
Whether the store is synced, where to, uncommitted changes, ahead/behind, the guard, and live visibility.
With
check_visibility,auto_commitsays whether edits may be committed and pushed without the operator reviewing them first (sole_access()), andauto_commit_reasonsays why or why not.