rebase -m: fix serialization of strategy options
commit4960e5c7bdd399e791353bc6c551f09298746f61
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Mon, 10 Apr 2023 09:08:30 +0000 (10 10:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Apr 2023 16:53:19 +0000 (10 09:53 -0700)
treecdf53e9e92a1cd902e1e1ec00f6f9ebfbc6bdb67
parent4a8bc9860aa09942dd0e6540d53102219a7e920d
rebase -m: fix serialization of strategy options

To store the strategy options rebase prepends " --" to each one and
writes them to a file. To load them it reads the file and passes the
contents to split_cmdline(). This roughly mimics the behavior of the
scripted rebase but has a couple of limitations, (1) options containing
whitespace are not properly preserved (this is true of the scripted
rebase as well) and (2) options containing '"' or '\' are incorrectly
parsed and may cause the parser to return an error.

Fix these limitations by quoting each option when they are stored so
that they can be parsed correctly. Now that "--preserve-merges" no
longer exist this change also stops prepending "--" to the options when
they are stored as that was an artifact of the scripted rebase.

These changes are backwards compatible so the files written by an older
version of git can still be read. They are also forwards compatible,
the file can still be parsed by recent versions of git as they treat the
"--" prefix as optional.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
alias.c
alias.h
sequencer.c
t/t3418-rebase-continue.sh
t/t3436-rebase-more-options.sh