fix(sort): skip ordering incompatibility check when --key is specified

Previously, the ordering_incompatible check was performed unconditionally, causing errors even when the --key option was used, where such incompatibilities might not apply. This change adds a condition to skip the check if --key is present, ensuring correct behavior for key-based sorting.
This commit is contained in:
mattsu
2026-01-23 08:33:04 +09:00
committed by Sylvestre Ledru
parent ce96a263c8
commit 6cde13e75a
+3 -1
View File
@@ -2081,7 +2081,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let ignore_non_printing = matches.get_flag(options::IGNORE_NONPRINTING);
let ignore_case = matches.get_flag(options::IGNORE_CASE);
if ordering_incompatible(mode_flags, dictionary_order, ignore_non_printing) {
if !matches.contains_id(options::KEY)
&& ordering_incompatible(mode_flags, dictionary_order, ignore_non_printing)
{
let opts = ordering_opts_string(
mode_flags,
dictionary_order,