Skip to content

Commit 8315bd2

Browse files
pcloudsgitster
authored andcommitted
sequencer.c: use commit-slab to mark seen commits
It's done so that commit->util can be removed. See more explanation in the commit that removes commit->util. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 58dbe58 commit 8315bd2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

sequencer.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "hashmap.h"
2424
#include "notes-utils.h"
2525
#include "sigchain.h"
26+
#include "commit-slab.h"
2627

2728
#define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
2829

@@ -3160,6 +3161,7 @@ static enum check_level get_missing_commit_check_level(void)
31603161
return CHECK_IGNORE;
31613162
}
31623163

3164+
define_commit_slab(commit_seen, unsigned char);
31633165
/*
31643166
* Check if the user dropped some commits by mistake
31653167
* Behaviour determined by rebase.missingCommitsCheck.
@@ -3173,6 +3175,9 @@ int check_todo_list(void)
31733175
struct todo_list todo_list = TODO_LIST_INIT;
31743176
struct strbuf missing = STRBUF_INIT;
31753177
int advise_to_edit_todo = 0, res = 0, i;
3178+
struct commit_seen commit_seen;
3179+
3180+
init_commit_seen(&commit_seen);
31763181

31773182
strbuf_addstr(&todo_file, rebase_path_todo());
31783183
if (strbuf_read_file_or_whine(&todo_list.buf, todo_file.buf) < 0) {
@@ -3189,7 +3194,7 @@ int check_todo_list(void)
31893194
for (i = 0; i < todo_list.nr; i++) {
31903195
struct commit *commit = todo_list.items[i].commit;
31913196
if (commit)
3192-
commit->util = (void *)1;
3197+
*commit_seen_at(&commit_seen, commit) = 1;
31933198
}
31943199

31953200
todo_list_release(&todo_list);
@@ -3205,11 +3210,11 @@ int check_todo_list(void)
32053210
for (i = todo_list.nr - 1; i >= 0; i--) {
32063211
struct todo_item *item = todo_list.items + i;
32073212
struct commit *commit = item->commit;
3208-
if (commit && !commit->util) {
3213+
if (commit && !*commit_seen_at(&commit_seen, commit)) {
32093214
strbuf_addf(&missing, " - %s %.*s\n",
32103215
short_commit_name(commit),
32113216
item->arg_len, item->arg);
3212-
commit->util = (void *)1;
3217+
*commit_seen_at(&commit_seen, commit) = 1;
32133218
}
32143219
}
32153220

@@ -3235,6 +3240,7 @@ int check_todo_list(void)
32353240
"The possible behaviours are: ignore, warn, error.\n\n"));
32363241

32373242
leave_check:
3243+
clear_commit_seen(&commit_seen);
32383244
strbuf_release(&todo_file);
32393245
todo_list_release(&todo_list);
32403246

0 commit comments

Comments
 (0)