Skip to content

Commit be1bb60

Browse files
Denton-Lgitster
authored andcommitted
sequencer: make apply_autostash() accept a path
In order to make apply_autostash() more generic for future extraction, make it accept a `path` argument so that the location from where to read the reference to the autostash commit can be customized. Remove the `opts` argument since it was unused before anyway. Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent efcf6cf commit be1bb60

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sequencer.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3657,13 +3657,13 @@ static enum todo_command peek_command(struct todo_list *todo_list, int offset)
36573657
return -1;
36583658
}
36593659

3660-
static int apply_autostash(struct replay_opts *opts)
3660+
static int apply_autostash(const char *path)
36613661
{
36623662
struct strbuf stash_sha1 = STRBUF_INIT;
36633663
struct child_process child = CHILD_PROCESS_INIT;
36643664
int ret = 0;
36653665

3666-
if (!read_oneliner(&stash_sha1, rebase_path_autostash(),
3666+
if (!read_oneliner(&stash_sha1, path,
36673667
READ_ONELINER_SKIP_IF_EMPTY)) {
36683668
strbuf_release(&stash_sha1);
36693669
return 0;
@@ -3756,7 +3756,7 @@ static int checkout_onto(struct repository *r, struct replay_opts *opts,
37563756
return error(_("%s: not a valid OID"), orig_head);
37573757

37583758
if (run_git_checkout(r, opts, oid_to_hex(onto), action)) {
3759-
apply_autostash(opts);
3759+
apply_autostash(rebase_path_autostash());
37603760
sequencer_remove_state(opts);
37613761
return error(_("could not detach HEAD"));
37623762
}
@@ -4070,7 +4070,7 @@ static int pick_commits(struct repository *r,
40704070
run_command(&hook);
40714071
}
40724072
}
4073-
apply_autostash(opts);
4073+
apply_autostash(rebase_path_autostash());
40744074

40754075
if (!opts->quiet) {
40764076
if (!opts->verbose)
@@ -5079,7 +5079,7 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
50795079
todo_list_add_exec_commands(todo_list, commands);
50805080

50815081
if (count_commands(todo_list) == 0) {
5082-
apply_autostash(opts);
5082+
apply_autostash(rebase_path_autostash());
50835083
sequencer_remove_state(opts);
50845084

50855085
return error(_("nothing to do"));
@@ -5090,12 +5090,12 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
50905090
if (res == -1)
50915091
return -1;
50925092
else if (res == -2) {
5093-
apply_autostash(opts);
5093+
apply_autostash(rebase_path_autostash());
50945094
sequencer_remove_state(opts);
50955095

50965096
return -1;
50975097
} else if (res == -3) {
5098-
apply_autostash(opts);
5098+
apply_autostash(rebase_path_autostash());
50995099
sequencer_remove_state(opts);
51005100
todo_list_release(&new_todo);
51015101

0 commit comments

Comments
 (0)