@@ -39,6 +39,7 @@ impl DuplicateEntryFilter {
3939 config:: OutputFields :: Directory => entry. directory . hash ( & mut hasher) ,
4040 config:: OutputFields :: File => entry. file . hash ( & mut hasher) ,
4141 config:: OutputFields :: Arguments => entry. arguments . hash ( & mut hasher) ,
42+ config:: OutputFields :: Command => entry. command . hash ( & mut hasher) ,
4243 config:: OutputFields :: Output => entry. output . hash ( & mut hasher) ,
4344 }
4445 }
@@ -50,6 +51,8 @@ impl DuplicateEntryFilter {
5051pub enum ConfigurationError {
5152 #[ error( "Duplicate field: {0:?}" ) ]
5253 DuplicateField ( config:: OutputFields ) ,
54+ #[ error( "Command and Arguments cannot be both specified" ) ]
55+ CommandAndArgumentsBothSpecified ,
5356 #[ error( "Empty field list" ) ]
5457 EmptyFieldList ,
5558}
@@ -68,6 +71,12 @@ impl TryFrom<config::DuplicateFilter> for DuplicateEntryFilter {
6871 }
6972 }
7073
74+ if already_seen. contains ( & config:: OutputFields :: Command )
75+ && already_seen. contains ( & config:: OutputFields :: Arguments )
76+ {
77+ return Err ( ConfigurationError :: CommandAndArgumentsBothSpecified ) ;
78+ }
79+
7180 Ok ( DuplicateEntryFilter {
7281 fields : config. by_fields ,
7382 hash_values : HashSet :: new ( ) ,
@@ -112,6 +121,21 @@ mod tests {
112121 ) ) ;
113122 }
114123
124+ #[ test]
125+ fn test_try_from_failure_command_and_arguments ( ) {
126+ let config = config:: DuplicateFilter {
127+ by_fields : vec ! [
128+ config:: OutputFields :: Command ,
129+ config:: OutputFields :: Arguments ,
130+ ] ,
131+ } ;
132+ let result = DuplicateEntryFilter :: try_from ( config) ;
133+ assert ! ( matches!(
134+ result,
135+ Err ( ConfigurationError :: CommandAndArgumentsBothSpecified )
136+ ) ) ;
137+ }
138+
115139 #[ test]
116140 fn test_is_duplicate_with_file_and_directory_fields ( ) {
117141 let config = config:: DuplicateFilter {
0 commit comments