@@ -673,6 +673,51 @@ static void next_commentary_block(struct rev_info *opt, struct strbuf *sb)
673673 opt -> shown_dashes = 1 ;
674674}
675675
676+ static void show_diff_of_diff (struct rev_info * opt )
677+ {
678+ if (!cmit_fmt_is_mail (opt -> commit_format ))
679+ return ;
680+
681+ if (opt -> idiff_oid1 ) {
682+ struct diff_queue_struct dq ;
683+
684+ memcpy (& dq , & diff_queued_diff , sizeof (diff_queued_diff ));
685+ DIFF_QUEUE_CLEAR (& diff_queued_diff );
686+
687+ fprintf_ln (opt -> diffopt .file , "\n%s" , opt -> idiff_title );
688+ show_interdiff (opt -> idiff_oid1 , opt -> idiff_oid2 , 2 ,
689+ & opt -> diffopt );
690+
691+ memcpy (& diff_queued_diff , & dq , sizeof (diff_queued_diff ));
692+ }
693+
694+ if (opt -> rdiff1 ) {
695+ struct diff_queue_struct dq ;
696+ struct diff_options opts ;
697+ struct range_diff_options range_diff_opts = {
698+ .creation_factor = opt -> creation_factor ,
699+ .dual_color = 1 ,
700+ .diffopt = & opts
701+ };
702+
703+ memcpy (& dq , & diff_queued_diff , sizeof (diff_queued_diff ));
704+ DIFF_QUEUE_CLEAR (& diff_queued_diff );
705+
706+ fprintf_ln (opt -> diffopt .file , "\n%s" , opt -> rdiff_title );
707+ /*
708+ * Pass minimum required diff-options to range-diff; others
709+ * can be added later if deemed desirable.
710+ */
711+ repo_diff_setup (the_repository , & opts );
712+ opts .file = opt -> diffopt .file ;
713+ opts .use_color = opt -> diffopt .use_color ;
714+ diff_setup_done (& opts );
715+ show_range_diff (opt -> rdiff1 , opt -> rdiff2 , & range_diff_opts );
716+
717+ memcpy (& diff_queued_diff , & dq , sizeof (diff_queued_diff ));
718+ }
719+ }
720+
676721void show_log (struct rev_info * opt )
677722{
678723 struct strbuf msgbuf = STRBUF_INIT ;
@@ -856,47 +901,6 @@ void show_log(struct rev_info *opt)
856901 strbuf_release (& msgbuf );
857902 free (ctx .notes_message );
858903 free (ctx .after_subject );
859-
860- if (cmit_fmt_is_mail (ctx .fmt ) && opt -> idiff_oid1 ) {
861- struct diff_queue_struct dq ;
862-
863- memcpy (& dq , & diff_queued_diff , sizeof (diff_queued_diff ));
864- DIFF_QUEUE_CLEAR (& diff_queued_diff );
865-
866- next_commentary_block (opt , NULL );
867- fprintf_ln (opt -> diffopt .file , "%s" , opt -> idiff_title );
868- show_interdiff (opt -> idiff_oid1 , opt -> idiff_oid2 , 2 ,
869- & opt -> diffopt );
870-
871- memcpy (& diff_queued_diff , & dq , sizeof (diff_queued_diff ));
872- }
873-
874- if (cmit_fmt_is_mail (ctx .fmt ) && opt -> rdiff1 ) {
875- struct diff_queue_struct dq ;
876- struct diff_options opts ;
877- struct range_diff_options range_diff_opts = {
878- .creation_factor = opt -> creation_factor ,
879- .dual_color = 1 ,
880- .diffopt = & opts
881- };
882-
883- memcpy (& dq , & diff_queued_diff , sizeof (diff_queued_diff ));
884- DIFF_QUEUE_CLEAR (& diff_queued_diff );
885-
886- next_commentary_block (opt , NULL );
887- fprintf_ln (opt -> diffopt .file , "%s" , opt -> rdiff_title );
888- /*
889- * Pass minimum required diff-options to range-diff; others
890- * can be added later if deemed desirable.
891- */
892- repo_diff_setup (the_repository , & opts );
893- opts .file = opt -> diffopt .file ;
894- opts .use_color = opt -> diffopt .use_color ;
895- diff_setup_done (& opts );
896- show_range_diff (opt -> rdiff1 , opt -> rdiff2 , & range_diff_opts );
897-
898- memcpy (& diff_queued_diff , & dq , sizeof (diff_queued_diff ));
899- }
900904}
901905
902906int log_tree_diff_flush (struct rev_info * opt )
@@ -1165,9 +1169,12 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)
11651169 }
11661170 if (opt -> track_linear && !opt -> linear && opt -> reverse_output_stage )
11671171 fprintf (opt -> diffopt .file , "\n%s\n" , opt -> break_bar );
1172+ if (shown )
1173+ show_diff_of_diff (opt );
11681174 opt -> loginfo = NULL ;
11691175 maybe_flush_or_die (opt -> diffopt .file , "stdout" );
11701176 opt -> diffopt .no_free = no_free ;
1177+
11711178 diff_free (& opt -> diffopt );
11721179 return shown ;
11731180}
0 commit comments