Skip to content

Allow skipping only same-file duplicates with skipDuplicates: "same-file", fixes #601#602

Open
Nic-Polumeyv wants to merge 1 commit into
postcss:masterfrom
Nic-Polumeyv:skipduplicates-same-file
Open

Allow skipping only same-file duplicates with skipDuplicates: "same-file", fixes #601#602
Nic-Polumeyv wants to merge 1 commit into
postcss:masterfrom
Nic-Polumeyv:skipduplicates-same-file

Conversation

@Nic-Polumeyv

Copy link
Copy Markdown

Implements option 2 from #601: skipDuplicates now accepts "same-file", which keeps skipping repeated imports of the same file but no longer skips different files that share the same content.

The diff is small because the two dedup layers are already separate: state.importedFiles handles same-file skips and state.hashFiles handles same-content skips, both gated on options.skipDuplicates being truthy. "same-file" is truthy, so the same-file layer needs no change; the two content-layer checks now require skipDuplicates === true. Behavior for true and false is unchanged, which the existing no-duplicate, same, duplicates, and cyclical fixtures already cover.

The added fixture imports two byte-identical files from different directories plus one of them a second time: the repeated import is dropped by the same-file layer, and the identical-content file survives. The added test fails without the change and passes with it.

If you'd rather take one of the other directions from #601 instead, I'm happy to rework this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant