]> git.ipfire.org Git - thirdparty/git.git/commit - sequencer.h
sequencer: use struct strvec to store merge strategy options
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Mon, 10 Apr 2023 09:08:28 +0000 (10:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 10 Apr 2023 16:53:19 +0000 (09:53 -0700)
commitfb60b9f37f87241a886e183f0ec6261debb9c1c5
tree8d99df1e8a7adf0045021ef5283bf9a4c4cc696d
parent461434a013c2289fb59070e1a118d39441828847
sequencer: use struct strvec to store merge strategy options

The sequencer stores the merge strategy options in an array of strings
which allocated with ALLOC_GROW(). Using "struct strvec" avoids manually
managing the memory of that array and simplifies the code.

Aside from memory allocation the changes to the sequencer are largely
mechanical, changing xopts_nr to xopts.nr and xopts[i] to xopts.v[i]. A
new option parsing macro OPT_STRVEC() is also added to collect the
strategy options.  Hopefully this can be used to simplify the code in
builtin/merge.c in the future.

Note that there is a change of behavior to "git cherry-pick" and "git
revert" as passing “--no-strategy-option” will now clear any previous
strategy options whereas before this change it did nothing.

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>
builtin/revert.c
parse-options-cb.c
parse-options.h
sequencer.c
sequencer.h