@@ -345,14 +345,24 @@ static struct commit *handle_commit(struct rev_info *revs,
345345 die ("%s is unknown object" , name );
346346}
347347
348- static int everybody_uninteresting (struct commit_list * orig )
348+ static int everybody_uninteresting (struct commit_list * orig ,
349+ struct commit * * interesting_cache )
349350{
350351 struct commit_list * list = orig ;
352+
353+ if (* interesting_cache ) {
354+ struct commit * commit = * interesting_cache ;
355+ if (!(commit -> object .flags & UNINTERESTING ))
356+ return 0 ;
357+ }
358+
351359 while (list ) {
352360 struct commit * commit = list -> item ;
353361 list = list -> next ;
354362 if (commit -> object .flags & UNINTERESTING )
355363 continue ;
364+ if (interesting_cache )
365+ * interesting_cache = commit ;
356366 return 0 ;
357367 }
358368 return 1 ;
@@ -940,7 +950,8 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
940950/* How many extra uninteresting commits we want to see.. */
941951#define SLOP 5
942952
943- static int still_interesting (struct commit_list * src , unsigned long date , int slop )
953+ static int still_interesting (struct commit_list * src , unsigned long date , int slop ,
954+ struct commit * * interesting_cache )
944955{
945956 /*
946957 * No source list at all? We're definitely done..
@@ -959,7 +970,7 @@ static int still_interesting(struct commit_list *src, unsigned long date, int sl
959970 * Does the source list still have interesting commits in
960971 * it? Definitely not done..
961972 */
962- if (!everybody_uninteresting (src ))
973+ if (!everybody_uninteresting (src , interesting_cache ))
963974 return SLOP ;
964975
965976 /* Ok, we're closing in.. */
@@ -1078,6 +1089,7 @@ static int limit_list(struct rev_info *revs)
10781089 struct commit_list * newlist = NULL ;
10791090 struct commit_list * * p = & newlist ;
10801091 struct commit_list * bottom = NULL ;
1092+ struct commit * interesting_cache = NULL ;
10811093
10821094 if (revs -> ancestry_path ) {
10831095 bottom = collect_bottom_commits (list );
@@ -1094,6 +1106,9 @@ static int limit_list(struct rev_info *revs)
10941106 list = list -> next ;
10951107 free (entry );
10961108
1109+ if (commit == interesting_cache )
1110+ interesting_cache = NULL ;
1111+
10971112 if (revs -> max_age != -1 && (commit -> date < revs -> max_age ))
10981113 obj -> flags |= UNINTERESTING ;
10991114 if (add_parents_to_list (revs , commit , & list , NULL ) < 0 )
@@ -1102,7 +1117,7 @@ static int limit_list(struct rev_info *revs)
11021117 mark_parents_uninteresting (commit );
11031118 if (revs -> show_all )
11041119 p = & commit_list_insert (commit , p )-> next ;
1105- slop = still_interesting (list , date , slop );
1120+ slop = still_interesting (list , date , slop , & interesting_cache );
11061121 if (slop )
11071122 continue ;
11081123 /* If showing all, add the whole pending list to the end */
0 commit comments