git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 00/75] Convert diff opt parser to parse_options()
@ 2018-12-27 16:25 Nguyễn Thái Ngọc Duy
  2018-12-27 16:25 ` [PATCH 01/75] parse-options.h: remove extern on function prototypes Nguyễn Thái Ngọc Duy
                   ` (14 more replies)
  0 siblings, 15 replies; 18+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2018-12-27 16:25 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

This is a sneak peek of converting diff_opt_parse() to 'struct
option'. The end game is builtin commands can just add diff options to
their 'struct option[]' array, do parse_options() like usual and have
diff parsing for free.

Besides simplifying the parsing code, there are also more benefits of
using struct option, e.g. tab completion and "git cmd -h".

I'm not sending full series because it's looong, the middle is not
that interesting, and I would need to wait for
sb/diff-color-moved-config-option-fixup (and Brian's --literally too,
probably) to land before sending something mergeable. But main patches
are sent here for review.

This is of course just the beginning. Once revision.c parser is
converted, diff_opt_parse() will be killed off, more commands can take
use diff option array directly. And perhaps the diff option array will
be split up into smaller ones to give callers more control what's part
of the command.

Nguyễn Thái Ngọc Duy (75):
  parse-options.h: remove extern on function prototypes
  parse-options: add one-shot mode
  parse-options: allow keep-unknown + stop-at-non-opt combination
  parse-options: disable option abbreviation with PARSE_OPT_KEEP_UNKNOWN
  parse-options: add OPT_BITOP()
  parse-options: stop abusing 'callback' for lowlevel callbacks
  parse-options: avoid magic return codes
  parse-options: allow ll_callback with OPTION_CALLBACK
  diff.h: keep forward struct declarations sorted
  diff.h: avoid bit fields in struct diff_flags
  diff.c: prepare to use parse_options() for parsing
  diff.c: convert -u|-p|--patch
  diff.c: convert -U|--unified
  diff.c: convert -W|--[no-]function-context
  diff.c: convert --raw
  diff.c: convert --patch-with-raw
  diff.c: convert --numstat and --shortstat
  diff.c: convert --dirstat and friends
  diff.c: convert --check
  diff.c: convert --summary
  diff.c: convert --patch-with-stat
  diff.c: convert --name-only
  diff.c: convert --name-status
  diff.c: convert -s|--no-patch
  diff.c: convert --stat*
  diff.c: convert --[no-]compact-summary
  diff.c: convert --output-*
  diff.c: convert -B|--break-rewrites
  diff.c: convert -M|--find-renames
  diff.c: convert -D|--irreversible-delete
  diff.c: convert -C|--find-copies
  diff.c: convert --find-copies-harder
  diff.c: convert --no-renames|--[no--rename-empty
  diff.c: convert --relative
  diff.c: convert --[no-]minimal
  diff.c: convert --ignore-some-changes
  diff.c: convert --[no-]indent-heuristic
  diff.c: convert --patience
  diff.c: convert --histogram
  diff.c: convert --diff-algorithm
  diff.c: convert --anchored
  diff.c: convert --binary
  diff.c: convert --full-index
  diff.c: convert -a|--text
  diff.c: convert -R
  diff.c: convert --[no-]follow
  diff.c: convert --[no-]color
  diff.c: convert --word-diff
  diff.c: convert --word-diff-regex
  diff.c: convert --color-words
  diff.c: convert --exit-code
  diff.c: convert --quiet
  diff.c: convert --ext-diff
  diff.c: convert --textconv
  diff.c: convert --ignore-submodules
  diff.c: convert --submodule
  diff.c: convert --ws-error-highlight
  diff.c: convert --ita-[in]visible-in-index
  diff.c: convert -z
  diff.c: convert -l
  diff.c: convert -S|-G
  diff.c: convert --pickaxe-all|--pickaxe-regex
  diff.c: convert -O
  diff.c: convert --find-object
  diff.c: convert --diff-filter
  diff.c: convert --[no-]abbrev
  diff.c: convert --[src|dst]-prefix
  diff.c: convert --line-prefix
  diff.c: convert --no-prefix
  diff.c: convert --inter-hunk-context
  diff.c: convert --color-moved
  diff.c: convert --color-moved-ws
  range-diff: use parse_options() instead of diff_opt_parse()
  diff --no-index: use parse_options() instead of diff_opt_parse()
  am: avoid diff_opt_parse()

 Documentation/diff-options.txt |   24 +-
 builtin/am.c                   |    4 +-
 builtin/blame.c                |    2 +-
 builtin/diff.c                 |   21 +-
 builtin/merge.c                |    9 +-
 builtin/range-diff.c           |   26 +-
 builtin/update-index.c         |   41 +-
 diff-no-index.c                |   49 +-
 diff.c                         | 1132 ++++++++++++++++++++------------
 diff.h                         |   85 +--
 parse-options-cb.c             |   11 +-
 parse-options.c                |  152 +++--
 parse-options.h                |  116 ++--
 t/t4053-diff-no-index.sh       |    3 +-
 t/t7800-difftool.sh            |    4 +-
 15 files changed, 1051 insertions(+), 628 deletions(-)

-- 
2.20.0.482.g66447595a7


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-01-09 20:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-27 16:25 [PATCH 00/75] Convert diff opt parser to parse_options() Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 01/75] parse-options.h: remove extern on function prototypes Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 02/75] parse-options: add one-shot mode Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 03/75] parse-options: allow keep-unknown + stop-at-non-opt combination Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 04/75] parse-options: disable option abbreviation with PARSE_OPT_KEEP_UNKNOWN Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 05/75] parse-options: add OPT_BITOP() Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 06/75] parse-options: stop abusing 'callback' for lowlevel callbacks Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 07/75] parse-options: avoid magic return codes Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 08/75] parse-options: allow ll_callback with OPTION_CALLBACK Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 09/75] diff.h: keep forward struct declarations sorted Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 10/75] diff.h: avoid bit fields in struct diff_flags Nguyễn Thái Ngọc Duy
2019-01-09 20:21   ` Stefan Beller
2018-12-27 16:25 ` [PATCH 11/75] diff.c: prepare to use parse_options() for parsing Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 12/75] diff.c: convert -u|-p|--patch Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 73/75] range-diff: use parse_options() instead of diff_opt_parse() Nguyễn Thái Ngọc Duy
2018-12-27 16:25 ` [PATCH 74/75] diff --no-index: " Nguyễn Thái Ngọc Duy
2018-12-27 20:34   ` Eric Sunshine
2018-12-27 16:25 ` [PATCH 75/75] am: avoid diff_opt_parse() Nguyễn Thái Ngọc Duy

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).