From c9513c6cb6329a2e8e99c7b95b053fd549acf80e Mon Sep 17 00:00:00 2001 From: Austin Gregg-Smith Date: Fri, 16 Oct 2026 16:24:25 +0100 Subject: [PATCH] test: by-URL push tests set no trap on git 2.56 The tests for devlaunch#638 push a clone's commits "by URL" and expect the clone's refs/remotes/origin/* to stay stale. They pushed to the bare path, which is exactly origin's configured URL. git 2.56 matches a push URL against the configured remotes and, on an exact match, updates that remote's tracking refs. So on git 2.56 the clone read clean before rm ran, and five tests failed on their own precondition. git 2.43 (CI's ubuntu image) does not do this, so CI stayed green. Push to the file:// URL of the same repository instead. That is a different spelling of origin, the way an agent's HTTPS fallback is a different spelling of an SSH origin, and both git versions leave the tracking refs stale. No assertion changes. --- .../src/flows/lifecycle/tests.rs | 32 +++++++++---------- rust/dl/tests/lifecycle.rs | 6 +++- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/rust/devlaunch-core/src/flows/lifecycle/tests.rs b/rust/devlaunch-core/src/flows/lifecycle/tests.rs index 5311436e..7d45446f 100644 --- a/rust/devlaunch-core/src/flows/lifecycle/tests.rs +++ b/rust/devlaunch-core/src/flows/lifecycle/tests.rs @@ -3171,10 +3171,20 @@ fn commit_locally(clone: &Path, count: usize) { /// the HTTPS URL. The commits land on the remote and `refs/remotes/origin/*` in /// the clone does not move, which is the whole of devlaunch#638. fn push_by_url(world: &World, clone: &Path) { - run_git( - clone, - &["push", &world.origin.display().to_string(), "HEAD:main"], - ); + run_git(clone, &["push", &origin_by_url(world), "HEAD:main"]); +} + +/// The remote under a URL that is not `origin`'s own spelling of it. +/// +/// `origin` is the bare path, so this is the `file://` URL of the same +/// repository — as the HTTPS URL an agent falls back to is a different +/// spelling of the SSH `origin`. The spelling has to differ: git 2.56 matches +/// a push URL against the configured remotes and, on an exact match, moves +/// that remote's tracking refs as if the push had gone through `origin`. +/// Pushing to the bare path itself left the clone's tracking refs current on +/// that git, and the trap these tests set was never set. +fn origin_by_url(world: &World) -> String { + format!("file://{}", world.origin.display()) } /// `dl r-main-aa `, through the one call the binary makes. @@ -3270,10 +3280,7 @@ fn a_host_that_prunes_on_fetch_does_not_turn_a_merged_branch_into_unpushed_work( commit(&clone, "side"); run_git(&clone, &["push", "-u", "origin", "side"]); run_git(&clone, &["checkout", "main"]); - run_git( - &clone, - &["push", &world.origin.display().to_string(), ":side"], - ); + run_git(&clone, &["push", &origin_by_url(&world), ":side"]); run_git(&clone, &["config", "fetch.prune", "true"]); commit_locally(&clone, 2); push_by_url(&world, &clone); @@ -3456,14 +3463,7 @@ fn a_site_pushed_by_url_does_not_stop_a_plain_rm() { let (mut world, clone) = a_world_ready_to_remove(); let site = a_site_in(&clone); commit_locally(&site, 2); - run_git( - &site, - &[ - "push", - &world.origin.display().to_string(), - "HEAD:agent-one", - ], - ); + run_git(&site, &["push", &origin_by_url(&world), "HEAD:agent-one"]); as_a_host_sees_them(&clone); assert!( run_git(&world.bare, &["branch", "--list", "agent-one"]) diff --git a/rust/dl/tests/lifecycle.rs b/rust/dl/tests/lifecycle.rs index b71ace98..da03b5a9 100644 --- a/rust/dl/tests/lifecycle.rs +++ b/rust/dl/tests/lifecycle.rs @@ -1086,7 +1086,11 @@ fn a_commit_pushed_by_url_does_not_stop_rm() { // with no `--force`. let world = World::with(&["--unpushed"]); let clone = "cache/devlaunch/repos/blooop/devlaunch/devlaunch-unpushed-committed"; - let origin = world.path("origin.git").display().to_string(); + // `file://`, not the bare path `origin` is set to: git 2.56 moves the + // tracking refs of a remote whose URL the push URL matches exactly, which + // would leave nothing stale to find. An agent's HTTPS fallback is likewise + // a different spelling of its SSH `origin`. + let origin = format!("file://{}", world.path("origin.git").display()); world.git_in(clone, &["push", "-q", &origin, "HEAD:refs/heads/unpushed"]); let run = world.dl(&["devlaunch-unpushed-committed", "rm"]);