A3: offer git's prepared merge message in the commit box

git.mergeMessage reads MERGE_MSG without its comment lines while a merge
is in progress. The Changes window fills an empty box with it once per
merge when conflicts show up, and again on vcs.commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-31 14:25:11 +01:00
parent 95fd9b926f
commit 983319d8a3
7 changed files with 183 additions and 2 deletions

View file

@ -147,11 +147,21 @@ fn merge_conflict_versions_resolve_and_abort() {
);
assert_eq!(host.git_changes(), 0);
let prepared = host.run("git.mergeMessage", Value::Null).unwrap();
let text = prepared["message"].as_str().unwrap();
assert!(text.starts_with("Merge branch 'feature'"), "{text}");
assert!(!text.contains('#'), "{text}");
assert_eq!(host.git_changes(), 0);
let again = host.run("git.merge", json!({"branch": "feature"}));
assert!(matches!(again, Err(EngineError::Failed(m)) if m.contains("in progress")));
host.run("git.mergeAbort", Value::Null).unwrap();
assert_eq!(host.git_changes(), 1);
assert_eq!(
host.run("git.mergeMessage", Value::Null).unwrap(),
json!({"message": null})
);
assert_eq!(
std::fs::read_to_string(root.join("a.php")).unwrap(),
"<?php\nmain\n"