Backtestshugorun-20260922-141813#15223

Issue #15223 Merged fix PR # Run 22 Sep 2026 · run-20260922-141813 gohugoio/hugo

commands: Fix "hugo config --lang" flag help text

Better

Our patch was judged better than the merged fix.

In this judgment, Patch A = our agent, Patch B = the merged fix.

Both patches make the identical, correct one-line source change to commands/config.go, replacing the inaccurate 'Defaults to the first language defined' with the issue's suggested 'default is the default content language' text — so on correctness (criterion 1) they are equal and both fix the root cause. The deciding factor is tests (criterion 2): Patch A adds a `stdout 'default is the default content language'` assertion to testscripts/commands/config.txt, which would fail before the change (the old help text lacked that string) and pass after — a genuine, non-tautological regression guard, exactly matching the code being changed. Patch B adds no test at all. The added assertion is minimal and directly scoped to the fix, so it introduces no scope or craft penalty (criterion 3/4). With correctness tied and Patch A strictly better on test coverage at no cost elsewhere, A is the better fix.

The judge saw only the two patches, labelled A and B in random order, with issue links and version numbers removed. The reasoning above is shown verbatim.

Solve

2m 37s17 turns

Wall-clock time in the container

Full test suite

No new failures

3,704 passed · 99 skipped · 3,816 total

Contamination audit

Unknown

See the audit notes for this run

Patch size

3vs 2 merged

Changed lines, ours vs merged

The --lang flag help says "Defaults to the first language defined", but when
the flag is empty the command uses the default content language:

https://github.com/gohugoio/hugo/blob/master/commands/config.go#L74-L76

These differ when defaultContentLanguage is not first by weight.

Suggested text: "the language to display config for (default is the default content language)"

The two patches

Our patch+2 −1
commands/config.goindex 59433b359..d8f20b50b 100644@@ -116,7 +116,7 @@ func (c *configCommand) Init(cd *simplecobra.Commandeer) error { 	cmd.Long = `Display project configuration, both default and custom settings.` 	cmd.Flags().StringVar(&c.format, "format", "toml", "preferred file format (toml, yaml or json)") 	_ = cmd.RegisterFlagCompletionFunc("format", cobra.FixedCompletions([]string{"toml", "yaml", "json"}, cobra.ShellCompDirectiveNoFileComp))-	cmd.Flags().StringVar(&c.lang, "lang", "", "the language to display config for. Defaults to the first language defined.")+	cmd.Flags().StringVar(&c.lang, "lang", "", "the language to display config for (default is the default content language)") 	cmd.Flags().BoolVar(&c.printZero, "printZero", false, `include config options with zero values (e.g. false, 0, "") in the output`) 	_ = cmd.RegisterFlagCompletionFunc("lang", cobra.NoFileCompletions) 	applyLocalFlagsBuildConfig(cmd, c.r)testscripts/commands/config.txtindex 480f1135b..d2e5309e8 100644@@ -2,6 +2,7 @@  hugo config -h stdout 'Display project configuration'+stdout 'default is the default content language'   hugo config 
Merged fix · PR #+1 −1
commands/config.goindex 59433b359..d8f20b50b 100644@@ -116,7 +116,7 @@ func (c *configCommand) Init(cd *simplecobra.Commandeer) error { 	cmd.Long = `Display project configuration, both default and custom settings.` 	cmd.Flags().StringVar(&c.format, "format", "toml", "preferred file format (toml, yaml or json)") 	_ = cmd.RegisterFlagCompletionFunc("format", cobra.FixedCompletions([]string{"toml", "yaml", "json"}, cobra.ShellCompDirectiveNoFileComp))-	cmd.Flags().StringVar(&c.lang, "lang", "", "the language to display config for. Defaults to the first language defined.")+	cmd.Flags().StringVar(&c.lang, "lang", "", "the language to display config for (default is the default content language)") 	cmd.Flags().BoolVar(&c.printZero, "printZero", false, `include config options with zero values (e.g. false, 0, "") in the output`) 	_ = cmd.RegisterFlagCompletionFunc("lang", cobra.NoFileCompletions) 	applyLocalFlagsBuildConfig(cmd, c.r) 

What the agent reported

The diff is minimal and exactly matches the report. I'm confident this is correct and complete.

Summary

What was wrong: The --lang flag on hugo config had help text reading "the language to display config for. Defaults to the first language defined." This is inaccurate: when --lang is empty, the command uses the default content language (commands/config.go:74-76 reads conf.configs.Base.DefaultContentLanguage), not the first language by weight. These differ whenever defaultContentLanguage is not the first-defined language.

What I changed:

  • commands/config.go:119 — updated the --lang flag usage string to the report's suggested text: "the language to display config for (default is the default content language)".
  • testscripts/commands/config.txt — added a regression assertion (stdout 'default is the default content language') to the existing hugo config -h block, run by TestCommands in main_test.go.

Test evidence:

  • Before the code change: the new assertion FAILED — no match for 'default is the default content language' found in stdout (testscripts/commands/config.txt:5).
  • After the code change: ./bt-test . -run TestCommands/config → 10 pass, 0 fail. The regression assertion now passes and no previously-passing assertion regressed.

Requirements checklist:

  1. Fix the --lang help text to reflect that an empty flag uses the default content language, using the suggested wording — Implemented (commands/config.go:119) with regression test evidence (fails before, passes after).

Note: the pre-existing working-tree deletions of AGENTS.md and CLAUDE.md shown in git status are unrelated to this fix and were left untouched. All changes are left uncommitted in the working tree.