Thread (2 messages) flat view 2 messages, 2 authors, 2021-02-18

Re: [PATCH 3/6] commit: add a reword suboption to --fixup

From: Charvi Mendiratta <hidden>
Date: 2021-02-18 12:24:47

On Thu, 18 Feb 2021 at 01:26, Junio C Hamano [off-list ref] wrote:
[...]
The same comment applies to the above as an earlier step.
Okay, will remove it.
quoted
+static void check_fixup_reword_options(void) {
+     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 (all)
+             die(_("cannot combine reword option of --fixup with --all"));
+     if (also)
+             die(_("cannot combine reword option of --fixup with --include"));
+     if (only)
+             die(_("cannot combine reword option of --fixup with --only"));
+}
Not just these options, wouldn't it be an error to ask to commit
anything but an empty commit?  E.g. shouldn't this sequence

        edit builtin/commit.c
        git commit --fixup=reword:HEAD~3 -- builtin/commit.c

trigger an error, as we will *not* be taking any change made to the
working tree file?

Or is that implicitly covered by some other code?
I admit this is a bug here. Thanks for pointing this out and will add the
check for pathspec.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help