Message ID | e0b8e409afbf8d90b4fc6406a67a1a1e930e022f.1585962673.git.liu.denton@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | merge: learn --autostash | expand |
Hi Denton On 04/04/2020 02:11, Denton Liu wrote: > In order to make apply_rebase() I think you mean apply_autostash() (in the subject as well) Best Wishes Phillip > 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 <liu.denton@gmail.com> > --- > sequencer.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/sequencer.c b/sequencer.c > index d1d59867ae..ae9efe5825 100644 > --- a/sequencer.c > +++ b/sequencer.c > @@ -3649,13 +3649,13 @@ static enum todo_command peek_command(struct todo_list *todo_list, int offset) > return -1; > } > > -static int apply_autostash(struct replay_opts *opts) > +static int apply_autostash(const char *path) > { > struct strbuf stash_sha1 = STRBUF_INIT; > struct child_process child = CHILD_PROCESS_INIT; > int ret = 0; > > - if (!read_oneliner(&stash_sha1, rebase_path_autostash(), > + if (!read_oneliner(&stash_sha1, path, > READ_ONELINER_SKIP_IF_EMPTY)) { > strbuf_release(&stash_sha1); > return 0; > @@ -3748,7 +3748,7 @@ static int checkout_onto(struct repository *r, struct replay_opts *opts, > return error(_("%s: not a valid OID"), orig_head); > > if (run_git_checkout(r, opts, oid_to_hex(onto), action)) { > - apply_autostash(opts); > + apply_autostash(rebase_path_autostash()); > sequencer_remove_state(opts); > return error(_("could not detach HEAD")); > } > @@ -4061,7 +4061,7 @@ static int pick_commits(struct repository *r, > run_command(&hook); > } > } > - apply_autostash(opts); > + apply_autostash(rebase_path_autostash()); > > if (!opts->quiet) { > if (!opts->verbose) > @@ -5070,7 +5070,7 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla > todo_list_add_exec_commands(todo_list, commands); > > if (count_commands(todo_list) == 0) { > - apply_autostash(opts); > + apply_autostash(rebase_path_autostash()); > sequencer_remove_state(opts); > > return error(_("nothing to do")); > @@ -5081,12 +5081,12 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla > if (res == -1) > return -1; > else if (res == -2) { > - apply_autostash(opts); > + apply_autostash(rebase_path_autostash()); > sequencer_remove_state(opts); > > return -1; > } else if (res == -3) { > - apply_autostash(opts); > + apply_autostash(rebase_path_autostash()); > sequencer_remove_state(opts); > todo_list_release(&new_todo); > >
diff --git a/sequencer.c b/sequencer.c index d1d59867ae..ae9efe5825 100644 --- a/sequencer.c +++ b/sequencer.c @@ -3649,13 +3649,13 @@ static enum todo_command peek_command(struct todo_list *todo_list, int offset) return -1; } -static int apply_autostash(struct replay_opts *opts) +static int apply_autostash(const char *path) { struct strbuf stash_sha1 = STRBUF_INIT; struct child_process child = CHILD_PROCESS_INIT; int ret = 0; - if (!read_oneliner(&stash_sha1, rebase_path_autostash(), + if (!read_oneliner(&stash_sha1, path, READ_ONELINER_SKIP_IF_EMPTY)) { strbuf_release(&stash_sha1); return 0; @@ -3748,7 +3748,7 @@ static int checkout_onto(struct repository *r, struct replay_opts *opts, return error(_("%s: not a valid OID"), orig_head); if (run_git_checkout(r, opts, oid_to_hex(onto), action)) { - apply_autostash(opts); + apply_autostash(rebase_path_autostash()); sequencer_remove_state(opts); return error(_("could not detach HEAD")); } @@ -4061,7 +4061,7 @@ static int pick_commits(struct repository *r, run_command(&hook); } } - apply_autostash(opts); + apply_autostash(rebase_path_autostash()); if (!opts->quiet) { if (!opts->verbose) @@ -5070,7 +5070,7 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla todo_list_add_exec_commands(todo_list, commands); if (count_commands(todo_list) == 0) { - apply_autostash(opts); + apply_autostash(rebase_path_autostash()); sequencer_remove_state(opts); return error(_("nothing to do")); @@ -5081,12 +5081,12 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla if (res == -1) return -1; else if (res == -2) { - apply_autostash(opts); + apply_autostash(rebase_path_autostash()); sequencer_remove_state(opts); return -1; } else if (res == -3) { - apply_autostash(opts); + apply_autostash(rebase_path_autostash()); sequencer_remove_state(opts); todo_list_release(&new_todo);
In order to make apply_rebase() 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 <liu.denton@gmail.com> --- sequencer.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)