fix(topdata): drop misleading SkipLFS option field; --skip-lfs sets env directly

CRUCIBLE_SKIP_LFS env is the single skip mechanism; BuildAndPackageOptions
had a dead SkipLFS field that implied the option propagated through the build
API but was only ever env-bridged in the CLI run functions. Replace the struct
field with a local buildTopDataArgs wrapper and set the env at the CLI entry
point directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 14:54:45 +02:00
co-authored by Claude Sonnet 4.6
parent bdac6f29f0
commit d2c3b7c719
2 changed files with 23 additions and 19 deletions
+21 -18
View File
@@ -1620,14 +1620,12 @@ func runBuildTopData(ctx context) error {
return err
}
opts, err := parseBuildTopDataArgs("build-topdata", ctx.args[1:])
parsed, err := parseBuildTopDataArgs("build-topdata", ctx.args[1:])
if err != nil {
return err
}
if opts.SkipLFS {
// ponytail: bridge --skip-lfs flag to env rather than threading a new param
// through packageBuiltTopData; CRUCIBLE_SKIP_LFS is already checked there.
if parsed.skipLFS {
os.Setenv("CRUCIBLE_SKIP_LFS", "1") //nolint:errcheck
}
@@ -1635,7 +1633,7 @@ func runBuildTopData(ctx context) error {
spin.configure(ctx.stderr, console.spinnerEnabled)
spin.start("Build Topdata: starting")
defer spin.stop()
result, err := topdata.BuildAndPackageWithOptions(p, opts, console.progress)
result, err := topdata.BuildAndPackageWithOptions(p, parsed.opts, console.progress)
if err != nil {
return err
}
@@ -1650,18 +1648,16 @@ func runBuildTopPackage(ctx context) error {
return err
}
opts, err := parseBuildTopDataArgs("build-top-package", ctx.args[1:])
parsed, err := parseBuildTopDataArgs("build-top-package", ctx.args[1:])
if err != nil {
return err
}
if opts.BuildWiki {
if parsed.opts.BuildWiki {
return fmt.Errorf("--wiki is not supported with build-top-package; use build-topdata when wiki generation is required")
}
if opts.SkipLFS {
// ponytail: bridge --skip-lfs flag to env rather than threading a new param
// through packageBuiltTopData; CRUCIBLE_SKIP_LFS is already checked there.
if parsed.skipLFS {
os.Setenv("CRUCIBLE_SKIP_LFS", "1") //nolint:errcheck
}
@@ -1678,23 +1674,30 @@ func runBuildTopPackage(ctx context) error {
return nil
}
func parseBuildTopDataArgs(commandName string, args []string) (topdata.BuildAndPackageOptions, error) {
opts := topdata.BuildAndPackageOptions{}
type buildTopDataArgs struct {
opts topdata.BuildAndPackageOptions
skipLFS bool
}
func parseBuildTopDataArgs(commandName string, args []string) (buildTopDataArgs, error) {
var parsed buildTopDataArgs
for _, arg := range args {
switch arg {
case "--force":
opts.Force = true
parsed.opts.Force = true
case "--wiki":
opts.BuildWiki = true
parsed.opts.BuildWiki = true
case "--skip-lfs":
opts.SkipLFS = true
// ponytail: CRUCIBLE_SKIP_LFS env is the single skip mechanism; set it at
// the CLI entry point rather than carrying a dead field through BuildAndPackageOptions.
parsed.skipLFS = true
case "-h", "--help":
return opts, fmt.Errorf("usage: %s [--force] [--wiki] [--skip-lfs]", commandName)
return parsed, fmt.Errorf("usage: %s [--force] [--wiki] [--skip-lfs]", commandName)
default:
return opts, fmt.Errorf("unknown %s argument %q", commandName, arg)
return parsed, fmt.Errorf("unknown %s argument %q", commandName, arg)
}
}
return opts, nil
return parsed, nil
}
func runCompareTopData(ctx context) error {
+2 -1
View File
@@ -76,7 +76,8 @@ func BuildAndPackage(p *project.Project, progress func(string)) (PackageResult,
type BuildAndPackageOptions struct {
Force bool
BuildWiki bool
SkipLFS bool
// ponytail: no SkipLFS field — CRUCIBLE_SKIP_LFS env is the single skip mechanism;
// the CLI flag sets it directly before calling into this package.
}
func BuildAndPackageWithOptions(p *project.Project, opts BuildAndPackageOptions, progress func(string)) (PackageResult, error) {