diff: consolidate diff algorithm option parsing
commit11e95e16e8ef70c6c757d50a99f9b310e6c795f4
authorJohn Cai <johncai86@gmail.com>
Mon, 20 Feb 2023 21:04:41 +0000 (20 21:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Feb 2023 17:29:08 +0000 (21 09:29 -0800)
treeb8843cbc66991f12af733d101cf46f1fa823d0b4
parentcbf04937d5b9fcf0a76c28f69e6294e9e3ecd7e6
diff: consolidate diff algorithm option parsing

A subsequent commit will need the ability to tell if the diff algorithm
was set through the command line through setting a new member of
diff_options. While this logic can be added to the
diff_opt_diff_algorithm() callback, the `--minimal` and `--histogram`
options are handled via OPT_BIT without a callback.

Remedy this by consolidating the options parsing logic for --minimal and
--histogram into one callback. This way we can modify `diff_options` in
that function.

As an additional refactor, the logic that sets the diff algorithm in
diff_opt_diff_algorithm() can be refactored into a helper that will
allow multiple callsites to set the diff algorithm.

Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c