@@ -345,14 +345,24 @@ static struct commit *handle_commit(struct rev_info *revs,
345
345
die ("%s is unknown object" , name );
346
346
}
347
347
348
- static int everybody_uninteresting (struct commit_list * orig )
348
+ static int everybody_uninteresting (struct commit_list * orig ,
349
+ struct commit * * interesting_cache )
349
350
{
350
351
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
+
351
359
while (list ) {
352
360
struct commit * commit = list -> item ;
353
361
list = list -> next ;
354
362
if (commit -> object .flags & UNINTERESTING )
355
363
continue ;
364
+ if (interesting_cache )
365
+ * interesting_cache = commit ;
356
366
return 0 ;
357
367
}
358
368
return 1 ;
@@ -940,7 +950,8 @@ static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
940
950
/* How many extra uninteresting commits we want to see.. */
941
951
#define SLOP 5
942
952
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 )
944
955
{
945
956
/*
946
957
* 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
959
970
* Does the source list still have interesting commits in
960
971
* it? Definitely not done..
961
972
*/
962
- if (!everybody_uninteresting (src ))
973
+ if (!everybody_uninteresting (src , interesting_cache ))
963
974
return SLOP ;
964
975
965
976
/* Ok, we're closing in.. */
@@ -1078,6 +1089,7 @@ static int limit_list(struct rev_info *revs)
1078
1089
struct commit_list * newlist = NULL ;
1079
1090
struct commit_list * * p = & newlist ;
1080
1091
struct commit_list * bottom = NULL ;
1092
+ struct commit * interesting_cache = NULL ;
1081
1093
1082
1094
if (revs -> ancestry_path ) {
1083
1095
bottom = collect_bottom_commits (list );
@@ -1094,6 +1106,9 @@ static int limit_list(struct rev_info *revs)
1094
1106
list = list -> next ;
1095
1107
free (entry );
1096
1108
1109
+ if (commit == interesting_cache )
1110
+ interesting_cache = NULL ;
1111
+
1097
1112
if (revs -> max_age != -1 && (commit -> date < revs -> max_age ))
1098
1113
obj -> flags |= UNINTERESTING ;
1099
1114
if (add_parents_to_list (revs , commit , & list , NULL ) < 0 )
@@ -1102,7 +1117,7 @@ static int limit_list(struct rev_info *revs)
1102
1117
mark_parents_uninteresting (commit );
1103
1118
if (revs -> show_all )
1104
1119
p = & commit_list_insert (commit , p )-> next ;
1105
- slop = still_interesting (list , date , slop );
1120
+ slop = still_interesting (list , date , slop , & interesting_cache );
1106
1121
if (slop )
1107
1122
continue ;
1108
1123
/* If showing all, add the whole pending list to the end */
0 commit comments