Description
In src/core/config.ts:51-55, the config merge uses object spread:
return {
...defaultConfig,
...fileConfig,
...cliOverrides,
}
When --stale-days is NOT provided, src/index.ts:49 passes staleDays: undefined in cliOverrides. JavaScript object spread treats an explicit undefined property as a real value, so { ...{ staleDays: 90 }, ...{ staleDays: undefined } } produces { staleDays: undefined }, destroying the default of 90.
Impact
Running git-broom clean without --stale-days causes staleDays to become undefined. This flows into getStaleBranches(undefined, cwd) which computes cutoff.setDate(cutoff.getDate() - NaN) producing an Invalid Date. All date comparisons against Invalid Date return false, so zero branches are ever classified as stale. The clean command silently does nothing for stale branches.
Suggested Fix
Filter out undefined values from cliOverrides before spreading, or use a deep merge utility that ignores undefined.
Description
In
src/core/config.ts:51-55, the config merge uses object spread:When
--stale-daysis NOT provided,src/index.ts:49passesstaleDays: undefinedincliOverrides. JavaScript object spread treats an explicitundefinedproperty as a real value, so{ ...{ staleDays: 90 }, ...{ staleDays: undefined } }produces{ staleDays: undefined }, destroying the default of 90.Impact
Running
git-broom cleanwithout--stale-dayscausesstaleDaysto becomeundefined. This flows intogetStaleBranches(undefined, cwd)which computescutoff.setDate(cutoff.getDate() - NaN)producing an Invalid Date. All date comparisons against Invalid Date returnfalse, so zero branches are ever classified as stale. The clean command silently does nothing for stale branches.Suggested Fix
Filter out
undefinedvalues fromcliOverridesbefore spreading, or use a deep merge utility that ignoresundefined.