From cb3160541d858cdf8c3ec628580c98b2fe6b662e Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Sat, 11 Jul 2026 19:32:02 +0200 Subject: [PATCH] feat(editor,firmware): add :gl fast-forward pull command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Effect::Pull and the `:gl` command (fetch + fast-forward only, refuse on divergence). The editor side is host-tested; the firmware arm is a stub posting "pull: not wired yet (v0.7)" — the on-device fetch/fast-forward in git_sync is v0.7 work (only push is wired today). --- editor/src/lib.rs | 10 ++++++++++ firmware/src/main.rs | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/editor/src/lib.rs b/editor/src/lib.rs index 8ecc503..d0d510b 100644 --- a/editor/src/lib.rs +++ b/editor/src/lib.rs @@ -83,6 +83,10 @@ pub enum Effect { /// `:sync` — publish the buffer (save, then git push). The host saves /// first: publishing an unsaved buffer is meaningless. Publish, + /// `:gl` — pull from the remote: fetch, then **fast-forward only**. The host + /// refuses (and surfaces) a divergence rather than merging, and never + /// touches local commits. Complements `:sync` (push) as the download half. + Pull, } /// A pending operator awaiting a motion or text object (`d`elete / `c`hange). @@ -462,6 +466,7 @@ impl Editor { } "w" | "wq" | "x" => Effect::Save, "sync" => Effect::Publish, + "gl" => Effect::Pull, _ => Effect::None, } } @@ -1616,6 +1621,11 @@ mod tests { assert_eq!(command("sync").1, Effect::Publish); } + #[test] + fn gl_command_signals_pull() { + assert_eq!(command("gl").1, Effect::Pull); + } + #[test] fn wq_and_x_alias_save_dropping_the_quit() { assert_eq!(command("wq").1, Effect::Save); diff --git a/firmware/src/main.rs b/firmware/src/main.rs index 8526340..315cf71 100644 --- a/firmware/src/main.rs +++ b/firmware/src/main.rs @@ -175,6 +175,12 @@ fn main() -> anyhow::Result<()> { #[cfg(not(feature = "git"))] log::info!(":sync — saved; light build (no `git` feature) — push skipped"); } + Effect::Pull => { + // `:gl` — fetch + fast-forward from the remote. The on-device + // fetch/fast-forward on the git thread is v0.7 work (git_sync + // only exposes push today), so acknowledge and no-op for now. + ed.set_notice("pull: not wired yet (v0.7)"); + } } // Keyboard attach/detach feeds the panel's disconnect flag.