23
23
#include "hashmap.h"
24
24
#include "notes-utils.h"
25
25
#include "sigchain.h"
26
+ #include "commit-slab.h"
26
27
27
28
#define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
28
29
@@ -3160,6 +3161,7 @@ static enum check_level get_missing_commit_check_level(void)
3160
3161
return CHECK_IGNORE ;
3161
3162
}
3162
3163
3164
+ define_commit_slab (commit_seen , unsigned char );
3163
3165
/*
3164
3166
* Check if the user dropped some commits by mistake
3165
3167
* Behaviour determined by rebase.missingCommitsCheck.
@@ -3173,6 +3175,9 @@ int check_todo_list(void)
3173
3175
struct todo_list todo_list = TODO_LIST_INIT ;
3174
3176
struct strbuf missing = STRBUF_INIT ;
3175
3177
int advise_to_edit_todo = 0 , res = 0 , i ;
3178
+ struct commit_seen commit_seen ;
3179
+
3180
+ init_commit_seen (& commit_seen );
3176
3181
3177
3182
strbuf_addstr (& todo_file , rebase_path_todo ());
3178
3183
if (strbuf_read_file_or_whine (& todo_list .buf , todo_file .buf ) < 0 ) {
@@ -3189,7 +3194,7 @@ int check_todo_list(void)
3189
3194
for (i = 0 ; i < todo_list .nr ; i ++ ) {
3190
3195
struct commit * commit = todo_list .items [i ].commit ;
3191
3196
if (commit )
3192
- commit -> util = ( void * ) 1 ;
3197
+ * commit_seen_at ( & commit_seen , commit ) = 1 ;
3193
3198
}
3194
3199
3195
3200
todo_list_release (& todo_list );
@@ -3205,11 +3210,11 @@ int check_todo_list(void)
3205
3210
for (i = todo_list .nr - 1 ; i >= 0 ; i -- ) {
3206
3211
struct todo_item * item = todo_list .items + i ;
3207
3212
struct commit * commit = item -> commit ;
3208
- if (commit && !commit -> util ) {
3213
+ if (commit && !* commit_seen_at ( & commit_seen , commit ) ) {
3209
3214
strbuf_addf (& missing , " - %s %.*s\n" ,
3210
3215
short_commit_name (commit ),
3211
3216
item -> arg_len , item -> arg );
3212
- commit -> util = ( void * ) 1 ;
3217
+ * commit_seen_at ( & commit_seen , commit ) = 1 ;
3213
3218
}
3214
3219
}
3215
3220
@@ -3235,6 +3240,7 @@ int check_todo_list(void)
3235
3240
"The possible behaviours are: ignore, warn, error.\n\n" ));
3236
3241
3237
3242
leave_check :
3243
+ clear_commit_seen (& commit_seen );
3238
3244
strbuf_release (& todo_file );
3239
3245
todo_list_release (& todo_list );
3240
3246
0 commit comments