Re: [PATCH v3 3/6] commit: add a reword suboption to --fixup
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 1, 2021, 18:41 UTC
- Message-ID
- <xmqqh7lura1j.fsf@gitster.c.googlers.com>
- In-Reply-To
- <20210301084512.27170-4-charvi077@gmail.com>
Charvi Mendiratta <charvi077@gmail.com> writes:
Show 32 quoted lines
> `git commit --fixup=reword:<commit>` creates an empty "amend!" commit
> that will reword <commit> without changing its contents when it is
> rebased with --autosquash.
>
> Apart from ignoring staged changes it works similarly to
> `--fixup=amend:<commit>`.
>
> Mentored-by: Christian Couder <chriscool@tuxfamily.org>
> Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk>
> Helped-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
> ---
> builtin/commit.c | 44 ++++++++++++++++++++++++++++++++++++--------
> 1 file changed, 36 insertions(+), 8 deletions(-)
>
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 200ef83cc0..a4d18d96df 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -1186,6 +1186,27 @@ static void finalize_deferred_config(struct wt_status *s)
> s->ahead_behind_flags = AHEAD_BEHIND_FULL;
> }
>
> +static void check_fixup_reword_options(int argc, const char *argv[]) {
> + if (whence != FROM_COMMIT) {
> + if (whence == FROM_MERGE)
> + die(_("You are in the middle of a merge -- cannot reword."));
> + else if (is_from_cherry_pick(whence))
> + die(_("You are in the middle of a cherry-pick -- cannot reword."));
> + }
> + if (argc)
> + die(_("cannot combine reword option of --fixup with path %s"), *argv);I think our convention is to quote '%s' with a single-quote pair. See other error messages.
commit.c: die_errno(_("could not read '%s'"), templat... commit.c: die_errno(_("could not open '%s'"), git_path_commit... commit.c: die(_("--author '%s' is not 'Name <email>' and matches no e... commit.c: die(_("Invalid ignored mode '%s'"), ignored_arg); commit.c: die(_("Invalid untracked files mode '%s'"), untrack... ...