Skip to content

Commit 0450f21

Browse files
rcursoragent
andcommitted
v0.42.2: pin morph init --git-init to main
A fresh GitHub-Actions runner that hasn't opted in to git 2.28+'s default-branch rename creates the repo on `master`, but morph's ref-mode contract treats `main` as canonical (it's what `morph checkout`, `morph branch`, `morph push`, and the merge breadcrumbs all assume). The mismatch surfaced as 20 spec failures (spec_checkout_branch, spec_clone_with_explicit_branch_*, the entire merge_* family) all reporting `pathspec 'main' did not match any file(s) known to git` because the very first commit landed on `master`. Pass `-b main` (anchored to morph_core::DEFAULT_BRANCH, now exported from the morph-core crate) so the initial branch matches morph's contract regardless of host config. The error message on failure also names the explicit invocation (`git init -b main <path>`) so a reader of the failure output can reproduce it without guessing. Verified 1187 / 1187 workspace tests pass under a simulated CI environment (GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=init.defaultBranch GIT_CONFIG_VALUE_0=master), and no regressions on hosts that already default to `main`. CHANGELOG.md, site/changelog.html, site/index.html, and morph-cli/tests/specs/version.yaml all bumped to 0.42.2. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d9e78d9 commit 0450f21

8 files changed

Lines changed: 110 additions & 77 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,36 @@ metrics — see `.cursor/rules/behavioral-commits.mdc`.
1616

1717
## [Unreleased]
1818

19+
## [0.42.2] — 2026-05-02
20+
21+
Make `morph init --git-init` deterministic across hosts. The reference-mode
22+
contract uses `main` as the canonical default branch (it's what
23+
`morph checkout`, `morph branch`, `morph push`, and the merge breadcrumbs
24+
all assume), but the underlying `git init` shell-out picked up whatever
25+
the host's `init.defaultBranch` happened to be — `master` on a fresh
26+
GitHub-Actions runner that hadn't opted in to the git 2.28+ rename.
27+
Spec tests like `spec_checkout_branch`, `spec_clone_with_explicit_branch_checks_out_that_branch`,
28+
and the entire `merge_*` family then failed with
29+
`pathspec 'main' did not match any file(s) known to git` because
30+
git landed the very first commit on `master` and morph's
31+
`checkout main` had nothing to point at.
32+
33+
### Fixed
34+
35+
- **`morph init --git-init` now passes `-b main`** to `git init` so
36+
the initial branch matches `morph_core::DEFAULT_BRANCH` regardless
37+
of the host's `init.defaultBranch` setting. The error message on
38+
failure now also names the explicit invocation
39+
(`git init -b main <path>`), so a reader of the failure output
40+
can reproduce it without guessing.
41+
42+
### Tests
43+
44+
- Verified the full workspace (1187 tests) under a simulated CI
45+
environment (`GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=init.defaultBranch
46+
GIT_CONFIG_VALUE_0=master`) passes 1187 / 1187 — no regressions on
47+
hosts that already default to `main`.
48+
1949
## [0.42.1] — 2026-05-01
2050

2151
Mixed-authorship plumbing on the reference-mode commit rebuild
@@ -969,7 +999,8 @@ Three coordinated changes to repo setup, adoption, and migration.
969999
- 15 new YAML acceptance spec cases in the default eval suite:
9701000
`init_at_latest:*` ×4, `init_in_git_dir:*` ×6, `upgrade:*` ×5.
9711001

972-
[Unreleased]: https://github.com/r/morph/compare/v0.42.1...HEAD
1002+
[Unreleased]: https://github.com/r/morph/compare/v0.42.2...HEAD
1003+
[0.42.2]: https://github.com/r/morph/compare/v0.42.1...v0.42.2
9731004
[0.42.1]: https://github.com/r/morph/compare/v0.42.0...v0.42.1
9741005
[0.42.0]: https://github.com/r/morph/compare/v0.41.1...v0.42.0
9751006
[0.41.1]: https://github.com/r/morph/compare/v0.41.0...v0.41.1

‎Cargo.lock‎

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ resolver = "2"
33
members = ["morph-core", "morph-cli", "morph-mcp", "morph-serve", "morph-e2e"]
44

55
[workspace.package]
6-
version = "0.42.1"
6+
version = "0.42.2"

‎morph-cli/src/main.rs‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,14 +1565,29 @@ fn main() -> anyhow::Result<()> {
15651565
false
15661566
};
15671567
if should_git_init {
1568+
// `-b main` pins the initial branch to `main`
1569+
// regardless of the host's `init.defaultBranch`
1570+
// setting. Without this, a fresh GitHub-Actions
1571+
// runner (or any host that hasn't opted in to
1572+
// git 2.28's default-branch rename) lands on
1573+
// `master`, and downstream `morph checkout main`
1574+
// / `morph branch feature` then fail with
1575+
// `pathspec 'main' did not match` because git's
1576+
// `main` ref doesn't exist. Morph's user-facing
1577+
// contract is `main` (DEFAULT_BRANCH in
1578+
// morph-core); aligning git on init avoids the
1579+
// ref-mode mismatch from the start.
15681580
let status = std::process::Command::new("git")
15691581
.arg("init")
1582+
.arg("-b")
1583+
.arg(morph_core::DEFAULT_BRANCH)
15701584
.arg(&path)
15711585
.status()
15721586
.map_err(|e| anyhow::anyhow!("failed to spawn `git init`: {}", e))?;
15731587
if !status.success() {
15741588
anyhow::bail!(
1575-
"`git init {}` failed (exit {}); fix the underlying error and re-run",
1589+
"`git init -b {} {}` failed (exit {}); fix the underlying error and re-run",
1590+
morph_core::DEFAULT_BRANCH,
15761591
path.display(),
15771592
status.code().map(|c| c.to_string()).unwrap_or_else(|| "?".into())
15781593
);

‎morph-cli/tests/specs/version.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
steps:
44
- morph: ["--version"]
55
stdout_contains:
6-
- "morph 0.42.1 (built"
6+
- "morph 0.42.2 (built"
77
- "Z)"
88

99
# PR 10: a real `morph version` subcommand that mirrors `--version`
@@ -13,7 +13,7 @@
1313
steps:
1414
- morph: [version]
1515
stdout_contains:
16-
- "morph 0.42.1 (built"
16+
- "morph 0.42.2 (built"
1717
- "Z)"
1818

1919
- name: version_subcommand_json_emits_machine_readable_body
@@ -22,7 +22,7 @@
2222
- morph: [version, --json]
2323
stdout_contains:
2424
- '"name":"morph"'
25-
- '"version":"0.42.1"'
25+
- '"version":"0.42.2"'
2626
- '"build_date":"'
2727
- '"protocol_version":'
2828
- '"supported_repo_versions":'

‎morph-core/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub use commit::{
7272
create_merge_commit_full, create_merge_commit_with_retirement, create_tree_commit,
7373
create_tree_commit_with_provenance, current_branch, fold_human_author_into_contributors,
7474
log_from, resolve_head, resolve_provenance_from_run, rollup, set_head_branch,
75-
set_head_detached, CommitProvenance,
75+
set_head_detached, CommitProvenance, DEFAULT_BRANCH,
7676
};
7777
pub use metrics::{aggregate, check_thresholds, check_dominance, check_dominance_with_suite, aggregate_suite, union_suites, retire_metrics};
7878
pub use merge::{

‎site/changelog.html‎

Lines changed: 50 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,56 @@ <h1>What's changed in Morph</h1>
321321

322322
<article class="release">
323323
<header>
324-
<span class="version">0.42.1 <span class="latest">Latest</span></span>
324+
<span class="version">0.42.2 <span class="latest">Latest</span></span>
325+
<span class="date">2026-05-02</span>
326+
</header>
327+
<p class="summary">
328+
<strong><code>morph init --git-init</code> now lands on
329+
<code>main</code> on every host.</strong> The ref-mode
330+
contract treats <code>main</code> as the canonical default
331+
branch (it's what <code>morph checkout</code>,
332+
<code>morph branch</code>, <code>morph push</code>, and
333+
the merge breadcrumbs all assume), but the underlying
334+
<code>git init</code> shell-out picked up whatever the
335+
host's <code>init.defaultBranch</code> happened to be
336+
&mdash; <code>master</code> on a fresh GitHub-Actions
337+
runner that hadn't opted in to the git 2.28+ rename.
338+
Spec tests like <code>spec_checkout_branch</code> and
339+
the entire <code>merge_*</code> family then failed with
340+
<em>pathspec 'main' did not match any file(s) known to
341+
git</em> because git landed the very first commit on
342+
<code>master</code>.
343+
</p>
344+
345+
<h3 class="fixed"><span class="marker"></span>Fixed</h3>
346+
<ul>
347+
<li><code>morph init --git-init</code> passes
348+
<code>-b main</code> (anchored to
349+
<code>morph_core::DEFAULT_BRANCH</code>) so the
350+
initial branch matches morph's contract regardless of
351+
host config. The on-failure error message now also
352+
names the explicit invocation
353+
(<code>git init -b main &lt;path&gt;</code>) so a
354+
reader of the failure output can reproduce it without
355+
guessing.</li>
356+
</ul>
357+
358+
<h3 class="tests"><span class="marker"></span>Tests</h3>
359+
<ul>
360+
<li>Workspace (1187 tests) verified under a simulated CI
361+
environment
362+
(<code>GIT_CONFIG_COUNT=1
363+
GIT_CONFIG_KEY_0=init.defaultBranch
364+
GIT_CONFIG_VALUE_0=master</code>) &mdash;
365+
<strong>1187 / 1187 passing, 0 ignored</strong>. No
366+
regressions on hosts that already default to
367+
<code>main</code>.</li>
368+
</ul>
369+
</article>
370+
371+
<article class="release">
372+
<header>
373+
<span class="version">0.42.1</span>
325374
<span class="date">2026-05-01</span>
326375
</header>
327376
<p class="summary">
@@ -453,68 +502,6 @@ <h3 class="tests"><span class="marker"></span>Tests</h3>
453502
</ul>
454503
</article>
455504

456-
<article class="release">
457-
<header>
458-
<span class="version">0.41.1</span>
459-
<span class="date">2026-05-01</span>
460-
</header>
461-
<p class="summary">
462-
<strong>Reference-mode merge UX gets cleaned up.</strong>
463-
Three fixes triaged out of the v0.40 ignored-spec backlog:
464-
<code>morph status</code> now shows an in-progress
465-
<code>git merge</code> conflict (it was reading the legacy
466-
structural-merge state file and missing the new
467-
<code>MERGE_REF.json</code> breadcrumb);
468-
<code>morph merge --abort</code> outside a merge errors
469-
with exit 1 instead of no-op'ing on exit 0, matching
470-
<code>git merge --abort</code>'s own UX; and the conflict
471-
message ("Auto-merging failed for N path; run
472-
<code>morph merge --continue</code> or <code>--abort</code>")
473-
is now exercised by an un-skipped acceptance spec. 13
474-
ignored specs remain &mdash; all sharing two clear roots
475-
(eval-suite plumbing through the ref-mode merge rebuild
476-
path, mixed-authorship plumbing on the rebuild path)
477-
&mdash; and are scheduled for v0.42.0 / v0.42.1.
478-
</p>
479-
480-
<h3 class="fixed"><span class="marker"></span>Fixed</h3>
481-
<ul>
482-
<li><code>merge_progress_summary</code> in
483-
<code>morph-core/src/merge_flow.rs</code> reads
484-
<code>.morph/MERGE_REF.json</code> in addition to the
485-
legacy <code>.morph/MERGE_HEAD</code>, so
486-
<code>morph status</code> mid-conflict reports
487-
<em>"You have unmerged paths"</em> with the
488-
<code>--continue</code> / <code>--abort</code> hint
489-
banner. Unmerged paths come from
490-
<code>git ls-files --unmerged</code>.</li>
491-
<li><code>morph merge --abort</code> outside a merge now
492-
bails with <code>Error: no merge in progress</code>
493-
(exit 1) instead of printing
494-
<em>"Nothing to abort."</em> and returning success.
495-
Mirrors <code>git merge --abort</code>'s
496-
<code>fatal: There is no merge to abort</code> (exit
497-
128). Earlier ref-mode versions were silent in scripts
498-
when the user mistyped a command they expected to
499-
fail.</li>
500-
</ul>
501-
502-
<h3 class="tests"><span class="marker"></span>Tests</h3>
503-
<ul>
504-
<li><code>merge_with_textual_conflict_drops_into_continue_flow</code>
505-
and <code>merge_abort_without_in_progress_errors</code>
506-
in <code>morph-cli/tests/specs/merge.yaml</code>
507-
un-skipped and rewritten for v0.40+ wording (morph's
508-
hints are on stderr now since <code>git merge -q</code>
509-
swallows git's own <code>CONFLICT (content): ...</code>
510-
lines).
511-
<code>status_during_textual_merge_lists_unmerged_paths_and_hint</code>
512-
in <code>morph-cli/tests/status_merge_integration.rs</code>
513-
un-<code>#[ignore]</code>'d. <code>version.yaml</code>
514-
updated to expect <code>0.41.1</code>.</li>
515-
</ul>
516-
</article>
517-
518505
<div class="older">
519506
<h2>Older versions</h2>
520507
<p>

‎site/index.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@
953953
</div>
954954

955955
<nav>
956-
<a href="./" class="logo">morph<span class="version">v0.42.1 &middot; alpha</span></a>
956+
<a href="./" class="logo">morph<span class="version">v0.42.2 &middot; alpha</span></a>
957957
<ul class="links">
958958
<li><a href="#problem">Problem</a></li>
959959
<li><a href="#solution">Thesis</a></li>
@@ -968,7 +968,7 @@
968968

969969
<!-- Hero -->
970970
<div class="hero">
971-
<span class="badge">Alpha &middot; v0.42.1 &middot; Research prototype</span>
971+
<span class="badge">Alpha &middot; v0.42.2 &middot; Research prototype</span>
972972
<h1>Git for <em>AI-assisted</em> development</h1>
973973
<p class="subtitle">
974974
Morph is a version control system that records every agent session as an immutable

0 commit comments

Comments
 (0)