]> git.ipfire.org Git - thirdparty/git.git/commit
sequencer: allow disabling conflict advice
authorPhilippe Blain <levraiphilippeblain@gmail.com>
Sat, 16 Mar 2024 21:16:29 +0000 (21:16 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Mar 2024 16:28:40 +0000 (09:28 -0700)
commitec0300914b42277077f51a8c7e3438d7565eb261
tree098c6439f74730b97cb6cd2e784ab753146a0821
parent2953d95d402b6bff1a59c4712f4d46f1b9ea137f
sequencer: allow disabling conflict advice

Allow disabling the advice shown when a squencer operation results in a
merge conflict through a new config 'advice.mergeConflict', which is
named generically such that it can be used by other commands eventually.

Remove that final '\n' in the first hunk in sequencer.c to avoid an
otherwise empty 'hint: ' line before the line 'hint: Disable this
message with "git config advice.mergeConflict false"' which is
automatically added by 'advise_if_enabled'.

Note that we use 'advise_if_enabled' for each message in the second hunk
in sequencer.c, instead of using 'if (show_hints &&
advice_enabled(...)', because the former instructs the user how to
disable the advice, which is more user-friendly.

Update the tests accordingly. Note that the body of the second test in
t3507-cherry-pick-conflict.sh is enclosed in double quotes, so we must
escape them in the added line. Note that t5520-pull.sh, which checks
that we display the advice for 'git rebase' (via 'git pull --rebase')
does not have to be updated because it only greps for a specific line in
the advice message.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config/advice.txt
advice.c
advice.h
sequencer.c
t/t3501-revert-cherry-pick.sh
t/t3507-cherry-pick-conflict.sh