@@ -340,6 +340,10 @@ static void add_parents_to_list(struct rev_info *revs, struct commit *commit, st
340340{
341341 struct commit_list * parent = commit -> parents ;
342342
343+ if (commit -> object .flags & ADDED )
344+ return ;
345+ commit -> object .flags |= ADDED ;
346+
343347 /*
344348 * If the commit is uninteresting, don't try to
345349 * prune parents - we want the maximal uninteresting
@@ -705,13 +709,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
705709 if (revs -> prune_data ) {
706710 diff_tree_setup_paths (revs -> prune_data );
707711 revs -> prune_fn = try_to_simplify_commit ;
708-
709- /*
710- * If we fix up parent data, we currently cannot
711- * do that on-the-fly.
712- */
713- if (revs -> parents )
714- revs -> limited = 1 ;
715712 }
716713
717714 return left ;
@@ -728,10 +725,12 @@ void prepare_revision_walk(struct rev_info *revs)
728725 revs -> topo_getter );
729726}
730727
731- static int rewrite_one (struct commit * * pp )
728+ static int rewrite_one (struct rev_info * revs , struct commit * * pp )
732729{
733730 for (;;) {
734731 struct commit * p = * pp ;
732+ if (!revs -> limited )
733+ add_parents_to_list (revs , p , & revs -> commits );
735734 if (p -> object .flags & (TREECHANGE | UNINTERESTING ))
736735 return 0 ;
737736 if (!p -> parents )
@@ -740,12 +739,12 @@ static int rewrite_one(struct commit **pp)
740739 }
741740}
742741
743- static void rewrite_parents (struct commit * commit )
742+ static void rewrite_parents (struct rev_info * revs , struct commit * commit )
744743{
745744 struct commit_list * * pp = & commit -> parents ;
746745 while (* pp ) {
747746 struct commit_list * parent = * pp ;
748- if (rewrite_one (& parent -> item ) < 0 ) {
747+ if (rewrite_one (revs , & parent -> item ) < 0 ) {
749748 * pp = parent -> next ;
750749 continue ;
751750 }
@@ -802,7 +801,7 @@ struct commit *get_revision(struct rev_info *revs)
802801 if (!(commit -> object .flags & TREECHANGE ))
803802 continue ;
804803 if (revs -> parents )
805- rewrite_parents (commit );
804+ rewrite_parents (revs , commit );
806805 }
807806 commit -> object .flags |= SHOWN ;
808807 return commit ;
0 commit comments