git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 00/76] Convert diff opt parser to parse_options()
Date: Thu, 17 Jan 2019 20:04:59 +0700	[thread overview]
Message-ID: <20190117130615.18732-1-pclouds@gmail.com> (raw)

This series converts diff option parsing to using parse-options. There
are a couple benefits of using parse-options, including "git <cmd> -h"
output, completion and less duplicate work.

This is the first half. The second one would be converting the option
parser in revision.c.  After that, the end game is, any command can
take a 'struct option[]' somewhere from diff/rev code, remove the
options they are not interested, then merge with their own options and
do parse_options() just once. There will be no separate parse phase
for revision/diff anymore.

I sent a sneak peek [1] last year and got two good comments. I take it
people at least did not oppose to this. The most interesting parts are
at the top and bottom. The middle is just boring conversion, usually
one option per patch.

This will conflict with pw/diff-color-moved-ws-fix on 'pu' because
that series adds --no-color-moved-ws option. I redid the same thing in
73/76 so that conflict resolution could be simply taking this side of
change.

This series is also available for fetching here

https://gitlab.com/pclouds/git/commits/diff-opt-parse-options

[1] http://public-inbox.org/git/20181227162536.15895-1-pclouds@gmail.com/

Nguyễn Thái Ngọc Duy (76):
  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
  diff.c: allow --no-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                         | 1136 ++++++++++++++++++++------------
 diff.h                         |   85 +--
 parse-options-cb.c             |   11 +-
 parse-options.c                |  152 +++--
 parse-options.h                |  114 ++--
 t/t4053-diff-no-index.sh       |    3 +-
 t/t7800-difftool.sh            |    4 +-
 15 files changed, 1054 insertions(+), 627 deletions(-)

-- 
2.20.0.482.g66447595a7


             reply	other threads:[~2019-01-17 13:06 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 13:04 Nguyễn Thái Ngọc Duy [this message]
2019-01-17 13:05 ` [PATCH 01/76] parse-options.h: remove extern on function prototypes Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 02/76] parse-options: add one-shot mode Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 03/76] parse-options: allow keep-unknown + stop-at-non-opt combination Nguyễn Thái Ngọc Duy
2019-01-17 18:33   ` Stefan Beller
2019-01-17 13:05 ` [PATCH 04/76] parse-options: disable option abbreviation with PARSE_OPT_KEEP_UNKNOWN Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 05/76] parse-options: add OPT_BITOP() Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 06/76] parse-options: stop abusing 'callback' for lowlevel callbacks Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 07/76] parse-options: avoid magic return codes Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 08/76] parse-options: allow ll_callback with OPTION_CALLBACK Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 09/76] diff.h: keep forward struct declarations sorted Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 10/76] diff.h: avoid bit fields in struct diff_flags Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 11/76] diff.c: prepare to use parse_options() for parsing Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 12/76] diff.c: convert -u|-p|--patch Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 13/76] diff.c: convert -U|--unified Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 14/76] diff.c: convert -W|--[no-]function-context Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 15/76] diff.c: convert --raw Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 16/76] diff.c: convert --patch-with-raw Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 17/76] diff.c: convert --numstat and --shortstat Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 18/76] diff.c: convert --dirstat and friends Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 19/76] diff.c: convert --check Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 20/76] diff.c: convert --summary Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 21/76] diff.c: convert --patch-with-stat Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 22/76] diff.c: convert --name-only Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 23/76] diff.c: convert --name-status Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 24/76] diff.c: convert -s|--no-patch Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 25/76] diff.c: convert --stat* Nguyễn Thái Ngọc Duy
2019-01-19  1:21   ` SZEDER Gábor
2019-01-17 13:05 ` [PATCH 26/76] diff.c: convert --[no-]compact-summary Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 27/76] diff.c: convert --output-* Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 28/76] diff.c: convert -B|--break-rewrites Nguyễn Thái Ngọc Duy
2019-01-21 12:07   ` Johannes Schindelin
2019-01-17 13:05 ` [PATCH 29/76] diff.c: convert -M|--find-renames Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 30/76] diff.c: convert -D|--irreversible-delete Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 31/76] diff.c: convert -C|--find-copies Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 32/76] diff.c: convert --find-copies-harder Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 33/76] diff.c: convert --no-renames|--[no--rename-empty Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 34/76] diff.c: convert --relative Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 35/76] diff.c: convert --[no-]minimal Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 36/76] diff.c: convert --ignore-some-changes Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 37/76] diff.c: convert --[no-]indent-heuristic Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 38/76] diff.c: convert --patience Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 39/76] diff.c: convert --histogram Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 40/76] diff.c: convert --diff-algorithm Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 41/76] diff.c: convert --anchored Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 42/76] diff.c: convert --binary Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 43/76] diff.c: convert --full-index Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 44/76] diff.c: convert -a|--text Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 45/76] diff.c: convert -R Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 46/76] diff.c: convert --[no-]follow Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 47/76] diff.c: convert --[no-]color Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 48/76] diff.c: convert --word-diff Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 49/76] diff.c: convert --word-diff-regex Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 50/76] diff.c: convert --color-words Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 51/76] diff.c: convert --exit-code Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 52/76] diff.c: convert --quiet Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 53/76] diff.c: convert --ext-diff Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 54/76] diff.c: convert --textconv Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 55/76] diff.c: convert --ignore-submodules Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 56/76] diff.c: convert --submodule Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 57/76] diff.c: convert --ws-error-highlight Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 58/76] diff.c: convert --ita-[in]visible-in-index Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 59/76] diff.c: convert -z Nguyễn Thái Ngọc Duy
2019-01-17 13:05 ` [PATCH 60/76] diff.c: convert -l Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 61/76] diff.c: convert -S|-G Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 62/76] diff.c: convert --pickaxe-all|--pickaxe-regex Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 63/76] diff.c: convert -O Nguyễn Thái Ngọc Duy
2019-01-21 12:14   ` Johannes Schindelin
2019-01-17 13:06 ` [PATCH 64/76] diff.c: convert --find-object Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 65/76] diff.c: convert --diff-filter Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 66/76] diff.c: convert --[no-]abbrev Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 67/76] diff.c: convert --[src|dst]-prefix Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 68/76] diff.c: convert --line-prefix Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 69/76] diff.c: convert --no-prefix Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 70/76] diff.c: convert --inter-hunk-context Nguyễn Thái Ngọc Duy
2019-01-19  1:18   ` SZEDER Gábor
2019-01-17 13:06 ` [PATCH 71/76] diff.c: convert --color-moved Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 72/76] diff.c: convert --color-moved-ws Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 73/76] diff.c: allow --no-color-moved-ws Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 74/76] range-diff: use parse_options() instead of diff_opt_parse() Nguyễn Thái Ngọc Duy
2019-01-17 19:46   ` Stefan Beller
2019-01-18  9:30     ` Duy Nguyen
2019-01-17 13:06 ` [PATCH 75/76] diff --no-index: " Nguyễn Thái Ngọc Duy
2019-01-17 13:06 ` [PATCH 76/76] am: avoid diff_opt_parse() Nguyễn Thái Ngọc Duy
2019-01-17 20:10   ` Johannes Schindelin
2019-01-18  0:19     ` Duy Nguyen
2019-01-17 14:32 ` [PATCH 00/76] Convert diff opt parser to parse_options() Ævar Arnfjörð Bjarmason
2019-01-17 19:50   ` Stefan Beller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190117130615.18732-1-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).