sequencer.c: remove implicit dependency on the_repository
Note that the_hash_algo stays, even if we can easily replace it with repo->hash_algo. My reason is I still believe tying hash_algo to a struct repository is a wrong move. But if I'm wrong, we can always go for another round of conversion. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Nov 10, 2018 at 06:48 UTC
005af339c9ad292f9ae2fe3555d8d362a225ca45
5 files changed
+86
-77
builtin/rebase--interactive.c
+6
-5
@@ -114,7 +114,8 @@ static int do_interactive_rebase(struct replay_opts *opts, unsigned flags,
114
error(_("could not generate todo list"));
115
else {
116
discard_cache();
117
- ret = complete_action(opts, flags, shortrevisions, onto_name, onto,
117
+ ret = complete_action(the_repository, opts, flags,
118
+ shortrevisions, onto_name, onto,
119
head_hash, cmd, autosquash);
120
}
121
@@ -252,16 +253,16 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
253
}
254
case SHORTEN_OIDS:
255
case EXPAND_OIDS:
255
- ret = transform_todos(flags);
256
+ ret = transform_todos(the_repository, flags);
257
break;
258
case CHECK_TODO_LIST:
258
- ret = check_todo_list();
259
+ ret = check_todo_list(the_repository);
260
break;
261
case REARRANGE_SQUASH:
261
- ret = rearrange_squash();
262
+ ret = rearrange_squash(the_repository);
263
break;
264
case ADD_EXEC:
264
- ret = sequencer_add_exec_commands(cmd);
265
+ ret = sequencer_add_exec_commands(the_repository, cmd);
266
break;
267
default:
268
BUG("invalid command '%d'", command);
builtin/revert.c
+1
-1
@@ -201,7 +201,7 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts)
201
if (cmd == 'c')
202
return sequencer_continue(the_repository, opts);
203
if (cmd == 'a')
204
- return sequencer_rollback(opts);
204
+ return sequencer_rollback(the_repository, opts);
205
return sequencer_pick_revisions(the_repository, opts);
206
}
207
rebase-interactive.c
+2
-2
@@ -69,7 +69,7 @@ int edit_todo_list(unsigned flags)
69
70
strbuf_release(&buf);
71
72
- transform_todos(flags | TODO_LIST_SHORTEN_IDS);
72
+ transform_todos(the_repository, flags | TODO_LIST_SHORTEN_IDS);
73
74
if (strbuf_read_file(&buf, todo_file, 0) < 0)
75
return error_errno(_("could not read '%s'."), todo_file);
@@ -85,7 +85,7 @@ int edit_todo_list(unsigned flags)
85
if (launch_sequence_editor(todo_file, NULL, NULL))
86
return -1;
87
88
- transform_todos(flags & ~(TODO_LIST_SHORTEN_IDS));
88
+ transform_todos(the_repository, flags & ~(TODO_LIST_SHORTEN_IDS));
89
90
return 0;
91
}
sequencer.c
+71
-63
@@ -356,7 +356,8 @@ static void free_message(struct commit *commit, struct commit_message *msg)
356
unuse_commit_buffer(commit, msg->message);
357
}
358
359
-static void print_advice(int show_hint, struct replay_opts *opts)
359
+static void print_advice(struct repository *r, int show_hint,
360
+ struct replay_opts *opts)
361
{
362
char *msg = getenv("GIT_CHERRY_PICK_HELP");
363
@@ -367,7 +368,7 @@ static void print_advice(int show_hint, struct replay_opts *opts)
368
* (typically rebase --interactive) wants to take care
369
* of the commit itself so remove CHERRY_PICK_HEAD
370
*/
370
- unlink(git_path_cherry_pick_head(the_repository));
371
+ unlink(git_path_cherry_pick_head(r));
372
return;
373
}
374
@@ -440,9 +441,9 @@ static int read_oneliner(struct strbuf *buf,
441
return 1;
442
}
443
443
-static struct tree *empty_tree(void)
444
+static struct tree *empty_tree(struct repository *r)
445
{
445
- return lookup_tree(the_repository, the_repository->hash_algo->empty_tree);
446
+ return lookup_tree(r, the_hash_algo->empty_tree);
447
}
448
449
static int error_dirty_index(struct index_state *istate, struct replay_opts *opts)
@@ -553,8 +554,8 @@ static int do_recursive_merge(struct repository *r,
554
o.show_rename_progress = 1;
555
556
head_tree = parse_tree_indirect(head);
556
- next_tree = next ? get_commit_tree(next) : empty_tree();
557
- base_tree = base ? get_commit_tree(base) : empty_tree();
557
+ next_tree = next ? get_commit_tree(next) : empty_tree(r);
558
+ base_tree = base ? get_commit_tree(base) : empty_tree(r);
559
560
for (xopt = opts->xopts; xopt != opts->xopts + opts->xopts_nr; xopt++)
561
parse_merge_opt(&o, *xopt);
@@ -600,15 +601,16 @@ static struct object_id *get_cache_tree_oid(struct index_state *istate)
601
return &istate->cache_tree->oid;
602
}
603
603
-static int is_index_unchanged(struct index_state *istate)
604
+static int is_index_unchanged(struct repository *r)
605
{
606
struct object_id head_oid, *cache_tree_oid;
607
struct commit *head_commit;
608
+ struct index_state *istate = r->index;
609
610
if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, &head_oid, NULL))
611
return error(_("could not resolve HEAD commit"));
612
611
- head_commit = lookup_commit(the_repository, &head_oid);
613
+ head_commit = lookup_commit(r, &head_oid);
614
615
/*
616
* If head_commit is NULL, check_commit, called from
@@ -1225,7 +1227,7 @@ void print_commit_summary(struct repository *r,
1227
strbuf_release(&format);
1228
}
1229
1228
-static int parse_head(struct commit **head)
1230
+static int parse_head(struct repository *r, struct commit **head)
1231
{
1232
struct commit *current_head;
1233
struct object_id oid;
@@ -1233,7 +1235,7 @@ static int parse_head(struct commit **head)
1235
if (get_oid("HEAD", &oid)) {
1236
current_head = NULL;
1237
} else {
1236
- current_head = lookup_commit_reference(the_repository, &oid);
1238
+ current_head = lookup_commit_reference(r, &oid);
1239
if (!current_head)
1240
return error(_("could not parse HEAD"));
1241
if (!oideq(&oid, ¤t_head->object.oid)) {
@@ -1273,7 +1275,7 @@ static int try_to_commit(struct repository *r,
1275
enum commit_msg_cleanup_mode cleanup;
1276
int res = 0;
1277
1276
- if (parse_head(¤t_head))
1278
+ if (parse_head(r, ¤t_head))
1279
return -1;
1280
1281
if (flags & AMEND_MSG) {
@@ -1440,7 +1442,7 @@ static int allow_empty(struct repository *r,
1442
if (!opts->allow_empty)
1443
return 0; /* let "git commit" barf as necessary */
1444
1443
- index_unchanged = is_index_unchanged(r->index);
1445
+ index_unchanged = is_index_unchanged(r);
1446
if (index_unchanged < 0)
1447
return index_unchanged;
1448
if (!index_unchanged)
@@ -1544,8 +1546,10 @@ static int is_pick_or_similar(enum todo_command command)
1546
}
1547
}
1548
1547
-static int update_squash_messages(enum todo_command command,
1548
- struct commit *commit, struct replay_opts *opts)
1549
+static int update_squash_messages(struct repository *r,
1550
+ enum todo_command command,
1551
+ struct commit *commit,
1552
+ struct replay_opts *opts)
1553
{
1554
struct strbuf buf = STRBUF_INIT;
1555
int res;
@@ -1574,7 +1578,7 @@ static int update_squash_messages(enum todo_command command,
1578
1579
if (get_oid("HEAD", &head))
1580
return error(_("need a HEAD to fixup"));
1577
- if (!(head_commit = lookup_commit_reference(the_repository, &head)))
1581
+ if (!(head_commit = lookup_commit_reference(r, &head)))
1582
return error(_("could not read HEAD"));
1583
if (!(head_message = get_commit_buffer(head_commit, NULL)))
1584
return error(_("could not read HEAD's commit message"));
@@ -1813,7 +1817,7 @@ static int do_pick_commit(struct repository *r,
1817
if (command == TODO_REWORD)
1818
flags |= EDIT_MSG | VERIFY_MSG;
1819
else if (is_fixup(command)) {
1816
- if (update_squash_messages(command, commit, opts))
1820
+ if (update_squash_messages(r, command, commit, opts))
1821
return -1;
1822
flags |= AMEND_MSG;
1823
if (!final_fixup)
@@ -1883,7 +1887,7 @@ static int do_pick_commit(struct repository *r,
1887
? _("could not revert %s... %s")
1888
: _("could not apply %s... %s"),
1889
short_commit_name(commit), msg.subject);
1886
- print_advice(res == 1, opts);
1890
+ print_advice(r, res == 1, opts);
1891
repo_rerere(r, opts->allow_rerere_auto);
1892
goto leave;
1893
}
@@ -1990,7 +1994,8 @@ static struct todo_item *append_new_todo(struct todo_list *todo_list)
1994
return todo_list->items + todo_list->nr++;
1995
}
1996
1993
-static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
1997
+static int parse_insn_line(struct repository *r, struct todo_item *item,
1998
+ const char *bol, char *eol)
1999
{
2000
struct object_id commit_oid;
2001
char *end_of_object_name;
@@ -2075,11 +2080,12 @@ static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
2080
if (status < 0)
2081
return -1;
2082
2078
- item->commit = lookup_commit_reference(the_repository, &commit_oid);
2083
+ item->commit = lookup_commit_reference(r, &commit_oid);
2084
return !item->commit;
2085
}
2086
2082
-static int parse_insn_buffer(char *buf, struct todo_list *todo_list)
2087
+static int parse_insn_buffer(struct repository *r, char *buf,
2088
+ struct todo_list *todo_list)
2089
{
2090
struct todo_item *item;
2091
char *p = buf, *next_p;
@@ -2095,7 +2101,7 @@ static int parse_insn_buffer(char *buf, struct todo_list *todo_list)
2101
2102
item = append_new_todo(todo_list);
2103
item->offset_in_buf = p - todo_list->buf.buf;
2098
- if (parse_insn_line(item, p, eol)) {
2104
+ if (parse_insn_line(r, item, p, eol)) {
2105
res = error(_("invalid line %d: %.*s"),
2106
i, (int)(eol - p), p);
2107
item->command = TODO_NOOP;
@@ -2156,8 +2162,9 @@ static ssize_t strbuf_read_file_or_whine(struct strbuf *sb, const char *path)
2162
return len;
2163
}
2164
2159
-static int read_populate_todo(struct todo_list *todo_list,
2160
- struct replay_opts *opts)
2165
+static int read_populate_todo(struct repository *r,
2166
+ struct todo_list *todo_list,
2167
+ struct replay_opts *opts)
2168
{
2169
struct stat st;
2170
const char *todo_file = get_todo_path(opts);
@@ -2172,7 +2179,7 @@ static int read_populate_todo(struct todo_list *todo_list,
2179
return error(_("could not stat '%s'"), todo_file);
2180
fill_stat_data(&todo_list->stat, &st);
2181
2175
- res = parse_insn_buffer(todo_list->buf.buf, todo_list);
2182
+ res = parse_insn_buffer(r, todo_list->buf.buf, todo_list);
2183
if (res) {
2184
if (is_rebase_i(opts))
2185
return error(_("please fix this using "
@@ -2203,7 +2210,7 @@ static int read_populate_todo(struct todo_list *todo_list,
2210
FILE *f = fopen_or_warn(rebase_path_msgtotal(), "w");
2211
2212
if (strbuf_read_file(&done.buf, rebase_path_done(), 0) > 0 &&
2206
- !parse_insn_buffer(done.buf.buf, &done))
2213
+ !parse_insn_buffer(r, done.buf.buf, &done))
2214
todo_list->done_nr = count_commands(&done);
2215
else
2216
todo_list->done_nr = 0;
@@ -2520,12 +2527,12 @@ static int reset_for_rollback(const struct object_id *oid)
2527
return run_command_v_opt(argv, RUN_GIT_CMD);
2528
}
2529
2523
-static int rollback_single_pick(void)
2530
+static int rollback_single_pick(struct repository *r)
2531
{
2532
struct object_id head_oid;
2533
2527
- if (!file_exists(git_path_cherry_pick_head(the_repository)) &&
2528
- !file_exists(git_path_revert_head(the_repository)))
2534
+ if (!file_exists(git_path_cherry_pick_head(r)) &&
2535
+ !file_exists(git_path_revert_head(r)))
2536
return error(_("no cherry-pick or revert in progress"));
2537
if (read_ref_full("HEAD", 0, &head_oid, NULL))
2538
return error(_("cannot resolve HEAD"));
@@ -2534,7 +2541,7 @@ static int rollback_single_pick(void)
2541
return reset_for_rollback(&head_oid);
2542
}
2543
2537
-int sequencer_rollback(struct replay_opts *opts)
2544
+int sequencer_rollback(struct repository *r, struct replay_opts *opts)
2545
{
2546
FILE *f;
2547
struct object_id oid;
@@ -2548,7 +2555,7 @@ int sequencer_rollback(struct replay_opts *opts)
2555
* If CHERRY_PICK_HEAD or REVERT_HEAD indicates
2556
* a single-cherry-pick in progress, abort that.
2557
*/
2551
- return rollback_single_pick();
2558
+ return rollback_single_pick(r);
2559
}
2560
if (!f)
2561
return error_errno(_("cannot open '%s'"), git_path_head_file());
@@ -3427,14 +3434,14 @@ static int checkout_onto(struct replay_opts *opts,
3434
return update_ref(NULL, "ORIG_HEAD", &oid, NULL, 0, UPDATE_REFS_MSG_ON_ERR);
3435
}
3436
3430
-static int stopped_at_head(void)
3437
+static int stopped_at_head(struct repository *r)
3438
{
3439
struct object_id head;
3440
struct commit *commit;
3441
struct commit_message message;
3442
3443
if (get_oid("HEAD", &head) ||
3437
- !(commit = lookup_commit(the_repository, &head)) ||
3444
+ !(commit = lookup_commit(r, &head)) ||
3445
parse_commit(commit) || get_message(commit, &message))
3446
fprintf(stderr, _("Stopped at HEAD\n"));
3447
else {
@@ -3495,7 +3502,7 @@ static int pick_commits(struct repository *r,
3502
delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
3503
3504
if (item->command == TODO_BREAK)
3498
- return stopped_at_head();
3505
+ return stopped_at_head(r);
3506
}
3507
if (item->command <= TODO_SQUASH) {
3508
if (is_rebase_i(opts))
@@ -3572,7 +3579,7 @@ static int pick_commits(struct repository *r,
3579
get_todo_path(opts));
3580
else if (match_stat_data(&todo_list->stat, &st)) {
3581
todo_list_release(todo_list);
3575
- if (read_populate_todo(todo_list, opts))
3582
+ if (read_populate_todo(r, todo_list, opts))
3583
res = -1; /* message was printed */
3584
/* `current` will be incremented below */
3585
todo_list->current = -1;
@@ -3732,12 +3739,12 @@ cleanup_head_ref:
3739
return sequencer_remove_state(opts);
3740
}
3741
3735
-static int continue_single_pick(void)
3742
+static int continue_single_pick(struct repository *r)
3743
{
3744
const char *argv[] = { "commit", NULL };
3745
3739
- if (!file_exists(git_path_cherry_pick_head(the_repository)) &&
3740
- !file_exists(git_path_revert_head(the_repository)))
3746
+ if (!file_exists(git_path_cherry_pick_head(r)) &&
3747
+ !file_exists(git_path_revert_head(r)))
3748
return error(_("no cherry-pick or revert in progress"));
3749
return run_command_v_opt(argv, RUN_GIT_CMD);
3750
}
@@ -3836,7 +3843,7 @@ static int commit_staged_changes(struct repository *r,
3843
struct commit *commit;
3844
const char *path = rebase_path_squash_msg();
3845
3839
- if (parse_head(&commit) ||
3846
+ if (parse_head(r, &commit) ||
3847
!(p = get_commit_buffer(commit, NULL)) ||
3848
write_message(p, strlen(p), path, 0)) {
3849
unuse_commit_buffer(commit, p);
@@ -3891,20 +3898,20 @@ int sequencer_continue(struct repository *r, struct replay_opts *opts)
3898
if (read_populate_opts(opts))
3899
return -1;
3900
if (is_rebase_i(opts)) {
3894
- if ((res = read_populate_todo(&todo_list, opts)))
3901
+ if ((res = read_populate_todo(r, &todo_list, opts)))
3902
goto release_todo_list;
3903
if (commit_staged_changes(r, opts, &todo_list))
3904
return -1;
3905
} else if (!file_exists(get_todo_path(opts)))
3899
- return continue_single_pick();
3900
- else if ((res = read_populate_todo(&todo_list, opts)))
3906
+ return continue_single_pick(r);
3907
+ else if ((res = read_populate_todo(r, &todo_list, opts)))
3908
goto release_todo_list;
3909
3910
if (!is_rebase_i(opts)) {
3911
/* Verify that the conflict has been resolved */
3912
if (file_exists(git_path_cherry_pick_head(r)) ||
3913
file_exists(git_path_revert_head(r))) {
3907
- res = continue_single_pick();
3914
+ res = continue_single_pick(r);
3915
if (res)
3916
goto release_todo_list;
3917
}
@@ -4477,7 +4484,8 @@ int sequencer_make_script(struct repository *r, FILE *out,
4484
* Add commands after pick and (series of) squash/fixup commands
4485
* in the todo list.
4486
*/
4480
-int sequencer_add_exec_commands(const char *commands)
4487
+int sequencer_add_exec_commands(struct repository *r,
4488
+ const char *commands)
4489
{
4490
const char *todo_file = rebase_path_todo();
4491
struct todo_list todo_list = TODO_LIST_INIT;
@@ -4488,7 +4496,7 @@ int sequencer_add_exec_commands(const char *commands)
4496
if (strbuf_read_file(&todo_list.buf, todo_file, 0) < 0)
4497
return error(_("could not read '%s'."), todo_file);
4498
4491
- if (parse_insn_buffer(todo_list.buf.buf, &todo_list)) {
4499
+ if (parse_insn_buffer(r, todo_list.buf.buf, &todo_list)) {
4500
todo_list_release(&todo_list);
4501
return error(_("unusable todo list: '%s'"), todo_file);
4502
}
@@ -4533,7 +4541,7 @@ int sequencer_add_exec_commands(const char *commands)
4541
return i;
4542
}
4543
4536
-int transform_todos(unsigned flags)
4544
+int transform_todos(struct repository *r, unsigned flags)
4545
{
4546
const char *todo_file = rebase_path_todo();
4547
struct todo_list todo_list = TODO_LIST_INIT;
@@ -4544,7 +4552,7 @@ int transform_todos(unsigned flags)
4552
if (strbuf_read_file(&todo_list.buf, todo_file, 0) < 0)
4553
return error(_("could not read '%s'."), todo_file);
4554
4547
- if (parse_insn_buffer(todo_list.buf.buf, &todo_list)) {
4555
+ if (parse_insn_buffer(r, todo_list.buf.buf, &todo_list)) {
4556
todo_list_release(&todo_list);
4557
return error(_("unusable todo list: '%s'"), todo_file);
4558
}
@@ -4613,7 +4621,7 @@ define_commit_slab(commit_seen, unsigned char);
4621
* Check if there is an unrecognized command or a
4622
* bad SHA-1 in a command.
4623
*/
4616
-int check_todo_list(void)
4624
+int check_todo_list(struct repository *r)
4625
{
4626
enum missing_commit_check_level check_level = get_missing_commit_check_level();
4627
struct strbuf todo_file = STRBUF_INIT;
@@ -4630,7 +4638,7 @@ int check_todo_list(void)
4638
goto leave_check;
4639
}
4640
advise_to_edit_todo = res =
4633
- parse_insn_buffer(todo_list.buf.buf, &todo_list);
4641
+ parse_insn_buffer(r, todo_list.buf.buf, &todo_list);
4642
4643
if (res || check_level == MISSING_COMMIT_CHECK_IGNORE)
4644
goto leave_check;
@@ -4649,7 +4657,7 @@ int check_todo_list(void)
4657
goto leave_check;
4658
}
4659
strbuf_release(&todo_file);
4652
- res = !!parse_insn_buffer(todo_list.buf.buf, &todo_list);
4660
+ res = !!parse_insn_buffer(r, todo_list.buf.buf, &todo_list);
4661
4662
/* Find commits in git-rebase-todo.backup yet unseen */
4663
for (i = todo_list.nr - 1; i >= 0; i--) {
@@ -4713,7 +4721,7 @@ static int rewrite_file(const char *path, const char *buf, size_t len)
4721
}
4722
4723
/* skip picking commits whose parents are unchanged */
4716
-static int skip_unnecessary_picks(struct object_id *output_oid)
4724
+static int skip_unnecessary_picks(struct repository *r, struct object_id *output_oid)
4725
{
4726
const char *todo_file = rebase_path_todo();
4727
struct strbuf buf = STRBUF_INIT;
@@ -4731,7 +4739,7 @@ static int skip_unnecessary_picks(struct object_id *output_oid)
4739
4740
if (strbuf_read_file_or_whine(&todo_list.buf, todo_file) < 0)
4741
return -1;
4734
- if (parse_insn_buffer(todo_list.buf.buf, &todo_list) < 0) {
4742
+ if (parse_insn_buffer(r, todo_list.buf.buf, &todo_list) < 0) {
4743
todo_list_release(&todo_list);
4744
return -1;
4745
}
@@ -4792,7 +4800,7 @@ static int skip_unnecessary_picks(struct object_id *output_oid)
4800
return 0;
4801
}
4802
4795
-int complete_action(struct replay_opts *opts, unsigned flags,
4803
+int complete_action(struct repository *r, struct replay_opts *opts, unsigned flags,
4804
const char *shortrevisions, const char *onto_name,
4805
const char *onto, const char *orig_head, const char *cmd,
4806
unsigned autosquash)
@@ -4810,16 +4818,16 @@ int complete_action(struct replay_opts *opts, unsigned flags,
4818
write_message("noop\n", 5, todo_file, 0))
4819
return -1;
4820
4813
- if (autosquash && rearrange_squash())
4821
+ if (autosquash && rearrange_squash(r))
4822
return -1;
4823
4824
if (cmd && *cmd)
4817
- sequencer_add_exec_commands(cmd);
4825
+ sequencer_add_exec_commands(r, cmd);
4826
4827
if (strbuf_read_file(buf, todo_file, 0) < 0)
4828
return error_errno(_("could not read '%s'."), todo_file);
4829
4822
- if (parse_insn_buffer(buf->buf, &todo_list)) {
4830
+ if (parse_insn_buffer(r, buf->buf, &todo_list)) {
4831
todo_list_release(&todo_list);
4832
return error(_("unusable todo list: '%s'"), todo_file);
4833
}
@@ -4848,7 +4856,7 @@ int complete_action(struct replay_opts *opts, unsigned flags,
4856
return error(_("could not copy '%s' to '%s'."), todo_file,
4857
rebase_path_todo_backup());
4858
4851
- if (transform_todos(flags | TODO_LIST_SHORTEN_IDS))
4859
+ if (transform_todos(r, flags | TODO_LIST_SHORTEN_IDS))
4860
return error(_("could not transform the todo list"));
4861
4862
strbuf_reset(buf);
@@ -4872,24 +4880,24 @@ int complete_action(struct replay_opts *opts, unsigned flags,
4880
4881
todo_list_release(&todo_list);
4882
4875
- if (check_todo_list()) {
4883
+ if (check_todo_list(r)) {
4884
checkout_onto(opts, onto_name, onto, orig_head);
4885
return -1;
4886
}
4887
4880
- if (transform_todos(flags & ~(TODO_LIST_SHORTEN_IDS)))
4888
+ if (transform_todos(r, flags & ~(TODO_LIST_SHORTEN_IDS)))
4889
return error(_("could not transform the todo list"));
4890
4883
- if (opts->allow_ff && skip_unnecessary_picks(&oid))
4891
+ if (opts->allow_ff && skip_unnecessary_picks(r, &oid))
4892
return error(_("could not skip unnecessary pick commands"));
4893
4894
if (checkout_onto(opts, onto_name, oid_to_hex(&oid), orig_head))
4895
return -1;
4896
;
4889
- if (require_clean_work_tree(the_repository, "rebase", "", 1, 1))
4897
+ if (require_clean_work_tree(r, "rebase", "", 1, 1))
4898
return -1;
4899
4892
- return sequencer_continue(the_repository, opts);
4900
+ return sequencer_continue(r, opts);
4901
}
4902
4903
struct subject2item_entry {
@@ -4916,7 +4924,7 @@ define_commit_slab(commit_todo_item, struct todo_item *);
4924
* message will have to be retrieved from the commit (as the oneline in the
4925
* script cannot be trusted) in order to normalize the autosquash arrangement.
4926
*/
4919
-int rearrange_squash(void)
4927
+int rearrange_squash(struct repository *r)
4928
{
4929
const char *todo_file = rebase_path_todo();
4930
struct todo_list todo_list = TODO_LIST_INIT;
@@ -4927,7 +4935,7 @@ int rearrange_squash(void)
4935
4936
if (strbuf_read_file_or_whine(&todo_list.buf, todo_file) < 0)
4937
return -1;
4930
- if (parse_insn_buffer(todo_list.buf.buf, &todo_list) < 0) {
4938
+ if (parse_insn_buffer(r, todo_list.buf.buf, &todo_list) < 0) {
4939
todo_list_release(&todo_list);
4940
return -1;
4941
}
sequencer.h
+6
-6
@@ -78,7 +78,7 @@ void sequencer_init_config(struct replay_opts *opts);
78
int sequencer_pick_revisions(struct repository *repo,
79
struct replay_opts *opts);
80
int sequencer_continue(struct repository *repo, struct replay_opts *opts);
81
-int sequencer_rollback(struct replay_opts *opts);
81
+int sequencer_rollback(struct repository *repo, struct replay_opts *opts);
82
int sequencer_remove_state(struct replay_opts *opts);
83
84
#define TODO_LIST_KEEP_EMPTY (1U << 0)
@@ -95,15 +95,15 @@ int sequencer_make_script(struct repository *repo, FILE *out,
95
int argc, const char **argv,
96
unsigned flags);
97
98
-int sequencer_add_exec_commands(const char *command);
99
-int transform_todos(unsigned flags);
98
+int sequencer_add_exec_commands(struct repository *r, const char *command);
99
+int transform_todos(struct repository *r, unsigned flags);
100
enum missing_commit_check_level get_missing_commit_check_level(void);
101
-int check_todo_list(void);
102
-int complete_action(struct replay_opts *opts, unsigned flags,
101
+int check_todo_list(struct repository *r);
102
+int complete_action(struct repository *r, struct replay_opts *opts, unsigned flags,
103
const char *shortrevisions, const char *onto_name,
104
const char *onto, const char *orig_head, const char *cmd,
105
unsigned autosquash);
106
-int rearrange_squash(void);
106
+int rearrange_squash(struct repository *r);
107
108
extern const char sign_off_header[];
109