@@ -5348,6 +5348,19 @@ static int diff_opt_word_diff_regex(const struct option *opt,
53485348 return 0 ;
53495349}
53505350
5351+ static int diff_opt_rotate_to (const struct option * opt , const char * arg , int unset )
5352+ {
5353+ struct diff_options * options = opt -> value ;
5354+
5355+ BUG_ON_OPT_NEG (unset );
5356+ if (!strcmp (opt -> long_name , "skip-to" ))
5357+ options -> skip_instead_of_rotate = 1 ;
5358+ else
5359+ options -> skip_instead_of_rotate = 0 ;
5360+ options -> rotate_to = arg ;
5361+ return 0 ;
5362+ }
5363+
53515364static void prep_parse_options (struct diff_options * options )
53525365{
53535366 struct option parseopts [] = {
@@ -5599,6 +5612,12 @@ static void prep_parse_options(struct diff_options *options)
55995612 DIFF_PICKAXE_REGEX , PARSE_OPT_NONEG ),
56005613 OPT_FILENAME ('O' , NULL , & options -> orderfile ,
56015614 N_ ("control the order in which files appear in the output" )),
5615+ OPT_CALLBACK_F (0 , "rotate-to" , options , N_ ("<path>" ),
5616+ N_ ("show the change in the specified path first" ),
5617+ PARSE_OPT_NONEG , diff_opt_rotate_to ),
5618+ OPT_CALLBACK_F (0 , "skip-to" , options , N_ ("<path>" ),
5619+ N_ ("skip the output to the specified path" ),
5620+ PARSE_OPT_NONEG , diff_opt_rotate_to ),
56025621 OPT_CALLBACK_F (0 , "find-object" , options , N_ ("<object-id>" ),
56035622 N_ ("look for differences that change the number of occurrences of the specified object" ),
56045623 PARSE_OPT_NONEG , diff_opt_find_object ),
@@ -6693,6 +6712,8 @@ void diffcore_std(struct diff_options *options)
66936712 diffcore_pickaxe (options );
66946713 if (options -> orderfile )
66956714 diffcore_order (options -> orderfile );
6715+ if (options -> rotate_to )
6716+ diffcore_rotate (options );
66966717 if (!options -> found_follow )
66976718 /* See try_to_follow_renames() in tree-diff.c */
66986719 diff_resolve_rename_copy ();
0 commit comments