summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-05-19 05:28:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-21 05:07:20 (GMT)
commit8315bd20eac098fa39f1c642e2df4f81949051cf (patch)
tree5e5c548d2912efaab2e1e9925d6f514fd7683a7d /sequencer.c
parent58dbe58faab42a70478627608b129db9a6d9c3e0 (diff)
downloadgit-8315bd20eac098fa39f1c642e2df4f81949051cf.zip
git-8315bd20eac098fa39f1c642e2df4f81949051cf.tar.gz
git-8315bd20eac098fa39f1c642e2df4f81949051cf.tar.bz2
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 <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sequencer.c b/sequencer.c
index 4ce5120..3af296d 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -23,6 +23,7 @@
#include "hashmap.h"
#include "notes-utils.h"
#include "sigchain.h"
+#include "commit-slab.h"
#define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
@@ -3160,6 +3161,7 @@ static enum check_level get_missing_commit_check_level(void)
return CHECK_IGNORE;
}
+define_commit_slab(commit_seen, unsigned char);
/*
* Check if the user dropped some commits by mistake
* Behaviour determined by rebase.missingCommitsCheck.
@@ -3173,6 +3175,9 @@ int check_todo_list(void)
struct todo_list todo_list = TODO_LIST_INIT;
struct strbuf missing = STRBUF_INIT;
int advise_to_edit_todo = 0, res = 0, i;
+ struct commit_seen commit_seen;
+
+ init_commit_seen(&commit_seen);
strbuf_addstr(&todo_file, rebase_path_todo());
if (strbuf_read_file_or_whine(&todo_list.buf, todo_file.buf) < 0) {
@@ -3189,7 +3194,7 @@ int check_todo_list(void)
for (i = 0; i < todo_list.nr; i++) {
struct commit *commit = todo_list.items[i].commit;
if (commit)
- commit->util = (void *)1;
+ *commit_seen_at(&commit_seen, commit) = 1;
}
todo_list_release(&todo_list);
@@ -3205,11 +3210,11 @@ int check_todo_list(void)
for (i = todo_list.nr - 1; i >= 0; i--) {
struct todo_item *item = todo_list.items + i;
struct commit *commit = item->commit;
- if (commit && !commit->util) {
+ if (commit && !*commit_seen_at(&commit_seen, commit)) {
strbuf_addf(&missing, " - %s %.*s\n",
short_commit_name(commit),
item->arg_len, item->arg);
- commit->util = (void *)1;
+ *commit_seen_at(&commit_seen, commit) = 1;
}
}
@@ -3235,6 +3240,7 @@ int check_todo_list(void)
"The possible behaviours are: ignore, warn, error.\n\n"));
leave_check:
+ clear_commit_seen(&commit_seen);
strbuf_release(&todo_file);
todo_list_release(&todo_list);