Re: [PATCH 4/6] t7500: add tests for --fixup[amend|reword] options

2 messages, 2 authors, 2021-02-19 · open the first message on its own page

Re: [PATCH 4/6] t7500: add tests for --fixup[amend|reword] options

From: Junio C Hamano <hidden>
Date: 2021-02-18 19:34:00

Charvi Mendiratta [off-list ref] writes:
quoted
quoted
+test_expect_success '--fixup=reword: -F give error message' '
+     echo "fatal: Only one of -c/-C/-F/--fixup can be used." >expect &&
+     test_must_fail git commit --fixup=reword:HEAD~ -F msg  2>actual &&
+     test_cmp expect actual
+'
Why?  If you can use -m msg, you should be able to use -F msgfile,
too, no?
Earlier I was thinking to let the `--fixup=amend:`  use the same options as of
current `--fixup=` . But yes I agree that there should be  -F option
also with `amend`
and `reword`.
Hmph, I was actually imagining the opposite---a context that does
not want to take -c/-C/-F would not want to take -m, either.

Why is -m so special, and a lot more importantly, what would a user
want to achieve by using "-m more-text" combined with this
"--fixup=reword:<commit>" or "--fixup=amend:<commit>" feature?

Re: [PATCH 4/6] t7500: add tests for --fixup[amend|reword] options

From: Charvi Mendiratta <hidden>
Date: 2021-02-19 06:11:50

On Fri, 19 Feb 2021 at 00:56, Junio C Hamano [off-list ref] wrote:
[...]
Hmph, I was actually imagining the opposite---a context that does
not want to take -c/-C/-F would not want to take -m, either.

Why is -m so special, and a lot more importantly, what would a user
want to achieve by using "-m more-text" combined with this
"--fixup=reword:<commit>" or "--fixup=amend:<commit>" feature?
If we run without '-m' option like below:
$ git commit --fixup=reword:<commit>

Then it pops the editor with default "amend!" commit's message i.e:

amend! subject of <commit> we are fixing.

commit log message of <commit> we are fixing.

(Here the end-user is free to edit the above message body of "amend!" commit )

On the other hand, if used with -m option like below:
$ git commit --fixup=reword:<commit> -m "edited <commit> message"

Then it will not pop the editor and the prepared "amend!" commit is :

amend! subject of <commit> we are fixing.

edited <commit> message.

So, with the "-m" option users can do it with the command line only.
And in both the cases upon `git rebase --autosquash` the commit log
message of <commit> we are fixing, will automatically be replaced by
the commit message body of "amend!" commit.

Hope that explains the working and I also wonder if we can improve it
to make it more user friendly ?

Thanks and Regards,
Charvi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help