feat: status-bar indicator when the graph is unsynced #19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/sync-status-indicator"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The natural companion to in-app sync (#17): instead of having to remember to press
S, weft now shows you when there's something to sync.What it does
A single attention dot (
●, yellow) appears on the right of the status bar whenever the graph work tree is dirty (uncommitted changes) or ahead of its upstream (committed but unpushed). It's hidden when the graph is clean and in-sync, when the dir isn't a git repo, and while a transient hint (e.g.✓ synced) occupies the right side.Design
internal/sync.Status(repoDir)— a read-only sibling ofRun:git status --porcelain(dirty) +rev-list --count @{u}..HEAD(ahead). Returns an error only for a non-repo (callers treat that as "no indicator"). No network fetch — ahead is measured against the local upstream ref only, so "behind remote" is deliberately out of scope.tea.Cmdat the moments git state can actually change: boot, every reindex (R/$EDITOR/ editor-exit-saved), in-app save, journal creation, linkify, and after a sync (success and failure). No timer, no per-keystroke cost.App.statusProbedefaults tosync.Statusbut is stubbed in view tests, so no view test shells out to git.Tests
internal/sync:Statusagainst throwaway repos (clean/dirty/ahead/non-repo), CI-safe (local git identity).internal/views: stubbed-probe round-trip for dirty/ahead/clean/error states, dot-hidden-under-hint, and the$EDITOR-exit-refreshes-even-when-unchanged path (catches a journal stub created forE).go vet ./... && go test ./...green (7 packages). A pre-PR review caught two gaps in the$EDITORpath (stale dot after a journal stub; a dropped cmd in save+exit) — both fixed and covered.Notes
Rdoubles as a manual re-check). That's the intended trade — no background polling.