Backtestshugorun-20261002-200313#15223

Issue #15223 Merged fix PR # Run 2 Oct 2026 · run-20261002-200313 gohugoio/hugo

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

Better

Our patch was judged better than the merged fix.

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

Both patches make the same change to commands/config.go: the --lang help text now reads the suggested 'the language to display config for (default is the default content language)'. On correctness they are equal. Patch B also adds a testscript (testscripts/commands/config__lang.txt). It checks the help output for the new text and makes sure the old text is gone, so this part would fail before the change and pass after it. It also sets up a site where defaultContentLanguage='de' is not first by weight (en has weight 1) and confirms that running `hugo config` with no --lang shows the German title. That covers the exact scenario named in the issue and locks in the behavior the new help text describes. It further covers explicit --lang en and the error for an unknown language. Patch B also updates docs/content/en/commands/hugo_config.md so the generated docs match the new flag text. This is consistent with the code and low risk, though it would normally be regenerated. With correctness equal, B wins on tests and on keeping the docs consistent.

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

36m 54s

Wall-clock time in the container

Full test suite

No new failures

3,709 passed · 99 skipped · 3,817 total

Contamination audit

Clean

No sign the agent saw the real fix

Patch size

33vs 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+31 −2
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)docs/content/en/commands/hugo_config.mdindex 3de89f18c..e6b42d0d2 100644@@ -23,7 +23,7 @@ hugo config [command] [flags]   -c, --contentDir string        filesystem path to content directory       --format string            preferred file format (toml, yaml or json) (default "toml")   -h, --help                     help for config-      --lang string              the language to display config for. Defaults to the first language defined.+      --lang string              the language to display config for (default is the default content language)       --printZero                include config options with zero values (e.g. false, 0, "") in the output       --renderSegments strings   named segments to render (configured in the segments config)   -t, --theme strings            themes to use (located in /themes/THEMENAME/)testscripts/commands/config__lang.txtnew file mode 100644index 000000000..279921555@@ -0,0 +1,29 @@+# Test the config command's --lang flag.++hugo config -h+stdout 'the language to display config for \(default is the default content language\)'+! stdout 'Defaults to the first language defined'++# Without --lang, the default content language is used, even when it is not first by weight.+hugo config+stdout '^title = .Site in German.'+! stdout '^title = .Site in English.'++hugo config --lang en+stdout '^title = .Site in English.'+! stdout '^title = .Site in German.'++! hugo config --lang fr+stderr 'language "fr" not found'++# Test files+-- hugo.toml --+baseURL="https://example.com/"+defaultContentLanguage="de"+[languages]+[languages.en]+weight=1+title="Site in English"+[languages.de]+weight=2+title="Site in German" 
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)