@@ -4852,6 +4852,18 @@ static int diff_opt_anchored(const struct option *opt,
48524852 return 0 ;
48534853}
48544854
4855+ static int diff_opt_binary (const struct option * opt ,
4856+ const char * arg , int unset )
4857+ {
4858+ struct diff_options * options = opt -> value ;
4859+
4860+ BUG_ON_OPT_NEG (unset );
4861+ BUG_ON_OPT_ARG (arg );
4862+ enable_patch_output (& options -> output_format );
4863+ options -> flags .binary = 1 ;
4864+ return 0 ;
4865+ }
4866+
48554867static int diff_opt_break_rewrites (const struct option * opt ,
48564868 const char * arg , int unset )
48574869{
@@ -5116,6 +5128,9 @@ static void prep_parse_options(struct diff_options *options)
51165128 OPT_CALLBACK_F (0 , "compact-summary" , options , NULL ,
51175129 N_ ("generate compact summary in diffstat" ),
51185130 PARSE_OPT_NOARG , diff_opt_compact_summary ),
5131+ OPT_CALLBACK_F (0 , "binary" , options , NULL ,
5132+ N_ ("output a binary diff that can be applied" ),
5133+ PARSE_OPT_NONEG | PARSE_OPT_NOARG , diff_opt_binary ),
51195134 OPT_CALLBACK_F (0 , "output-indicator-new" ,
51205135 & options -> output_indicators [OUTPUT_INDICATOR_NEW ],
51215136 N_ ("<char>" ),
@@ -5229,11 +5244,7 @@ int diff_opt_parse(struct diff_options *options,
52295244 return ac ;
52305245
52315246 /* flags options */
5232- if (!strcmp (arg , "--binary" )) {
5233- enable_patch_output (& options -> output_format );
5234- options -> flags .binary = 1 ;
5235- }
5236- else if (!strcmp (arg , "--full-index" ))
5247+ if (!strcmp (arg , "--full-index" ))
52375248 options -> flags .full_index = 1 ;
52385249 else if (!strcmp (arg , "-a" ) || !strcmp (arg , "--text" ))
52395250 options -> flags .text = 1 ;
0 commit comments