#1876·repomix

[BUG] Built-in ignore rules ending in a wildcard (**/npm-debug.log*, **/repomix-output.*) match nothing

Author: sxh313Created Sep 21, 2026Updated Sep 21, 2026
Labelsbug

Five of the built-in default ignore rules match nothing, because normalizeGlobPattern appends /** to them and turns "this file" into "anything under this file".

bash
$ node bin/repomix.cjs . -o /tmp/out.xml   # pristine v1.18.0 (9f01703a)
$ grep -o 'path="[^"]*"' /tmp/out.xml
path="docs/repomix-output.xml"     # **/repomix-output.*  → packed
path="src/a.ts"
path=".gitignore"
path="npm-debug.log.1"             # **/npm-debug.log*    → packed
path="probe-xyz.old1"
path="README.md"
path="repomix-output.1.xml"        # **/repomix-output.*  → packed
path="repomix-output.xml"          # **/repomix-output.*  → packed
path="yarn-error.log.old"          # **/yarn-error.log*   → packed

src/config/defaultIgnore.ts lists them at :20 **/npm-debug.log*, :21 **/yarn-debug.log*, :22 **/yarn-error.log*, :119 **/repomix-output.*, :120 **/repopack-output.*. The output-format ones matter most: a repo that has a committed repomix-output.xml anywhere in it (a docs/ copy, an example, a stale one under another name) gets its previous pack embedded in the new one, which is exactly what those two lines exist to prevent.

Cause

src/core/file/fileSearch.ts:84-86, applied to every pattern repomix hands to globby (defaultIgnore, ignore.customPatterns, .repomixignore, .ignore) at :401:

typescript
  // Convert **/folder to **/folder/** for consistent ignore pattern behavior
  if (pattern.startsWith('**/') && !pattern.includes('/**')) {
    return `${pattern}/**`;
  }

**/npm-debug.log* becomes **/npm-debug.log*/**. A trailing /** requires path segments below the match, so the file the rule names matches only if something lives under it — which a file never does. The rewrite is scoped to directories by its own JSDoc ("Makes **/folder, **/folder/, and **/folder/**/* behave identically") and by the comment (**/folder), but the guard only tests the prefix.

It is not the default list alone. Any user rule in that shape is inert too, while the two neighbouring shapes work:

pattern passed to -i npm-debug-shaped file packed?
**/probe-xyz* yes (inert)
probe-xyz* no
**/probe-xyz.old1 no

Of the 86 default patterns, 32 are rewritten by this branch and 5 of them lose every match — precisely the five above, which is why app.log, src/server.log and directory rules like **/node_modules/** keep working and make this easy to miss.

Expected

A built-in ignore rule should ignore the files it names. **/npm-debug.log* should exclude npm-debug.log.1 at any depth, as git check-ignore and every other glob tool treat it.

Proposed fix

Skip the rewrite when the last segment already ends in a wildcard — i.e. only for rules that today match nothing, so no working pattern changes behavior:

typescript
- if (pattern.startsWith('**/') && !pattern.includes('/**')) {
+ if (pattern.startsWith('**/') && !pattern.includes('/**') && !pattern.endsWith('*')) {

Measured with that guard: the same fixture packs src/a.ts, .gitignore, probe-xyz.old1, README.md only; -i '**/probe-xyz*' now excludes the probe file; and full suite passes (1821 tests, 0 failed).

Related but separate, and not covered here: --split-output writes out.1.xml… next to out.xml, and getIgnorePatterns (:470-479) only adds the base output path, so a second split run re-packs the first run's parts. That is a different line and a different rule.