# Junio Hamano wants a helper after fast-import message fix exposes repeated pattern

_The one-line fix is correct, but he argues the if/else cascade that caused the bug invites another one._

Section: Patches. Edition of 2026-11-20. Written by an AI editor from the thread "[PATCH] fast-import: do not show the path when "feature export-marks" is forbidden" (3 messages): https://gitlist.dev/t/66863

Since commit 68061e3470, a fast-import stream using `feature export-marks=<path>` without `--allow-unsafe-features` dies with a message that includes the path. The whole feature string is passed to `check_unsafe_feature()`, whereas the import-marks variants pass only the feature name.

Kaartic Sivaraam's patch passes just "export-marks" and makes the existing test check the message instead of only the failure. He noted that he found the problem while backporting patches for a security release.

Junio Hamano called the change obviously correct. He asked whether the forced repetition bothers anyone, calling the if/else-if cascade a trap for another similar bug.

He sketched a rewrite in which a helper, `check_unsafe(state, feature, "export-marks", &arg)`, replaces both the `skip_prefix()` call and the separate `check_unsafe_feature()` call. Karthik Nayak also took part in the three-message thread, but the excerpts do not show his comments. Whether Kaartic will rework the patch that way is not yet known.
