Commit 478bd0c00c

478bd0c00c75e518bac97ce806670bf17e8a177b

parent: 6a1ce6c2c8

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-12 05:04 UTC

control: merge refusals name the strategy, not the flag

The same text reaches the web merge form, which has no flags.

Ref #182

Layout: unified · split

internal/control/mr.go +3 −3
@@ -1054,7 +1054,7 @@ func runMRMerge(c *Ctx, args []string) int {
1054 case "ff": 1054 case "ff":
1055 if !ffPossible { 1055 if !ffPossible {
1056 return c.fail(protocol.ExitUsage, 1056 return c.fail(protocol.ExitUsage,
1057 "fast-forward not possible: %s has diverged from the MR head; use --strategy merge or rebase and re-push", mr.TargetRef) 1057 "fast-forward not possible: %s has diverged from the MR head; merge with the merge strategy, or rebase and push again", mr.TargetRef)
1058 } 1058 }
1059 newSHA = headSHA 1059 newSHA = headSHA
1060 1060
@@ -1129,7 +1129,7 @@ func runMRMerge(c *Ctx, args []string) int {
1129 } 1129 }
1130 if len(parents) > 1 { 1130 if len(parents) > 1 {
1131 return c.fail(protocol.ExitUsage, 1131 return c.fail(protocol.ExitUsage,
1132 "the MR contains merge commit %.10s; a rebase merge needs linear history — use --strategy merge or squash", sha) 1132 "the MR contains merge commit %.10s; a rebase merge needs linear history — choose the merge or squash strategy", sha)
1133 } 1133 }
1134 base := onto // root commit: replay against the new tip itself 1134 base := onto // root commit: replay against the new tip itself
1135 if len(parents) == 1 { 1135 if len(parents) == 1 {
@@ -1175,7 +1175,7 @@ func runMRMerge(c *Ctx, args []string) int {
1175 nums = append(nums, fmt.Sprintf("!%d", k.Number)) 1175 nums = append(nums, fmt.Sprintf("!%d", k.Number))
1176 } 1176 }
1177 return c.fail(protocol.ExitUsage, 1177 return c.fail(protocol.ExitUsage,
1178 "%s is stacked on by %s; a %s merge rewrites the commits they build on. Merge with --strategy ff or merge, or merge the stack into %s first", 1178 "%s is stacked on by %s; a %s merge rewrites the commits they build on. Merge with the fast-forward or merge strategy, or merge the stack into %s first",
1179 fmt.Sprintf("!%d", mr.Number), strings.Join(nums, ", "), strategy, mr.SourceRef) 1179 fmt.Sprintf("!%d", mr.Number), strings.Join(nums, ", "), strategy, mr.SourceRef)
1180 } 1180 }
1181 1181