#95 Git auto-commit (download version)
- Settings ▸ Git: per sidebar folder that is a git repository, Off (default), Commit, or Commit, Pull and Push. Stored in user defaults
gitAutoCommitas {root path: mode}. Absent in the App Store build (OrgProgramsisn't linked there). - Tracks the paths orgstar wrote (new
DocumentSession.fileWritten, called from aFileSystemwrapper aroundreplaceinDocumentSession.saver, so buffer saves, Keep Mine, refile, archive, capture and agenda edits all report). Commits only those paths:git statuson them,git add,git commit --only -- <paths>; other staged or unstaged changes are untouched. MessageUpdate a.org, b.org, orUpdate N fileswith paths in the body. - When: 60 s after the last write in a folder (debounced per folder), and on quit (
applicationShouldTerminatereturns.terminateLaterwhile files are pending). - Pull and push:
git pull --no-rebase --ff-onlybefore committing; on refusal nothing is merged, the commit is still made locally, push is skipped and the echo area says to resolve in a terminal. Push only after a successful pull and a commit. - No git at all while
rebase-merge,rebase-apply,MERGE_HEAD,CHERRY_PICK_HEAD,REVERT_HEAD,BISECT_LOGorindex.lockexists; files stay pending. - git is found like Emacs (
ORGSTAR_GIT, Homebrew, /usr/local, nix, then Babel's PATH;/usr/bin/gitonly with developer tools installed).GIT_TERMINAL_PROMPT=0,GIT_ASKPASS/SSH_ASKPASS=/usr/bin/falsewithSSH_ASKPASS_REQUIRE=force, stdin /dev/null; 30 s local, 60 s network (15 s on quit). Auth failures are reported as such. scripts/sync-strings.shnow also reads OrgPrograms' strings.
#155 File history
- Mac: File ▸ History… (id
app.recoveryunchanged) replaces Recovery Versions…: recovery versions plus, in the download version,git log --followcommits for the file, merged by date, each diffed against the buffer, with Restore (DocumentSession.restore(text:), an undoable edit; buffer goes to recovery; no checkout). - iOS and the App Store build: recovery versions only. The iOS screen already had the diff against the buffer, so it is unchanged.
Tests
swift test (all green), both Xcode builds. New: GitAutoCommitTests (only orgstar's files committed with staged and unstaged work left alone, untracked new file, nothing to commit, no commit during a rebase, pull/commit/push fast-forward, ff-only refusal reported and push skipped, no credential prompt against a 401 server, debounce, flush on quit, off folder ignored, session hook) and FileHistoryTests (--follow across a rename, merge by date, restore from a commit). Real git in temporary repositories; skipped without git.
Manual: 01-files-and-folders (History, Committing to git), 03-keys, 13-configuration (Git pane), 15-alongside-emacs, install.
Checked on the Mac with ORGSTAR_SNAPSHOT in a copy with its own bundle ID: Settings ▸ Git and the History sheet with commits and a recovery snapshot.