From: Jeff King <peff@peff.net> To: git@vger.kernel.org Subject: [PATCH 06/10] sequencer: drop repository argument from run_git_commit() Date: Wed, 30 Sep 2020 08:29:31 -0400 [thread overview] Message-ID: <20200930122931.GF1901279@coredump.intra.peff.net> (raw) In-Reply-To: <20200930122732.GA1901036@coredump.intra.peff.net> When we switched to using an external git-commit call in b0a3186140 (sequencer: simplify root commit creation, 2019-08-19), this function didn't need to care about the repository object any more. Arguably we could be passing along the repository path to the external git-commit by using "--git-dir=r->path" here. But for the most part the sequencer code relies on sub-process finding the same repository we're already in (using the same environment variables or discovery process we did). But we don't have a convenient interface for doing so, and there's no indication that we need to. Let's just drop the unused parameter for now. Signed-off-by: Jeff King <peff@peff.net> --- sequencer.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sequencer.c b/sequencer.c index e8676e965f..6e9aabaac1 100644 --- a/sequencer.c +++ b/sequencer.c @@ -934,8 +934,7 @@ static int run_command_silent_on_success(struct child_process *cmd) * interactive rebase: in that case, we will want to retain the * author metadata. */ -static int run_git_commit(struct repository *r, - const char *defmsg, +static int run_git_commit(const char *defmsg, struct replay_opts *opts, unsigned int flags) { @@ -1545,7 +1544,7 @@ static int do_commit(struct repository *r, if (is_rebase_i(opts) && oid) if (write_rebase_head(oid)) return -1; - return run_git_commit(r, msg_file, opts, flags); + return run_git_commit(msg_file, opts, flags); } return res; @@ -2060,7 +2059,7 @@ static int do_pick_commit(struct repository *r, *check_todo = !!(flags & EDIT_MSG); if (!res && reword) { fast_forward_edit: - res = run_git_commit(r, NULL, opts, EDIT_MSG | + res = run_git_commit(NULL, opts, EDIT_MSG | VERIFY_MSG | AMEND_MSG | (flags & ALLOW_EMPTY)); *check_todo = 1; @@ -3748,7 +3747,7 @@ static int do_merge(struct repository *r, * command needs to be rescheduled). */ fast_forward_edit: - ret = !!run_git_commit(r, git_path_merge_msg(r), opts, + ret = !!run_git_commit(git_path_merge_msg(r), opts, run_commit_flags); leave_merge: @@ -4437,7 +4436,7 @@ static int commit_staged_changes(struct repository *r, return 0; } - if (run_git_commit(r, final_fixup ? NULL : rebase_path_message(), + if (run_git_commit(final_fixup ? NULL : rebase_path_message(), opts, flags)) return error(_("could not commit staged changes.")); unlink(rebase_path_amend()); -- 2.28.0.1173.gad90222cf0
next prev parent reply other threads:[~2020-09-30 12:29 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-30 12:27 [PATCH 0/10] dropping more unused parameters Jeff King 2020-09-30 12:27 ` [PATCH 01/10] convert: drop unused crlf_action from check_global_conv_flags_eol() Jeff King 2020-09-30 12:28 ` [PATCH 02/10] drop unused argc parameters Jeff King 2020-09-30 12:28 ` [PATCH 03/10] env--helper: write to opt->value in parseopt helper Jeff King 2020-09-30 12:29 ` [PATCH 04/10] assert PARSE_OPT_NONEG in parse-options callbacks Jeff King 2020-09-30 12:29 ` [PATCH 05/10] push: drop unused repo argument to do_push() Jeff King 2020-09-30 12:29 ` Jeff King [this message] 2020-09-30 12:30 ` [PATCH 07/10] sparse-checkout: fill in some options boilerplate Jeff King 2020-09-30 12:30 ` [PATCH 08/10] test-advise: check argument count with argc instead of argv Jeff King 2020-09-30 12:34 ` [PATCH 09/10] sequencer: handle ignore_footer when parsing trailers Jeff King 2020-09-30 12:35 ` [PATCH 10/10] dir.c: drop unused "untracked" from treat_path_fast() Jeff King
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200930122931.GF1901279@coredump.intra.peff.net \ --to=peff@peff.net \ --cc=git@vger.kernel.org \ --subject='Re: [PATCH 06/10] sequencer: drop repository argument from run_git_commit()' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).