git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Preliminary patches to the diff.[hc] parseoptification

From
Pierre Habouzit <madcoder@debian.org>
Date
Nov 7, 2007, 10:20 UTC
Message-ID
<1194430832-6224-1-git-send-email-madcoder@debian.org>

I'm currently working on the very involved task of migrating diff options to parseopts. It's quite involved because for many reasons I won't detail here, it needs to migrate those _and_ revisions options at the same time (most of the diff options users _also_ use the revisions ones).

So I'm trying to see some preliminary patches that I need to make this the less disruptive possible: my goal is that people can use those preliminary series bit by bit, and not a whole 10 to 20 patches (I believe it will really take this amount in the end) at once with breakages hard to find in the mess.

So in the coming days I'll probably send my work bit by bit when I feel it won't change anymore.

Summary: ~~~~~~~

The 3 series are completely independent.
  + this is a patch to fix an issue that begin to irritate me and
    prevents me to build with -Werror.
    [1/1] Make gcc warning about empty if body go away.
  + this series add new features that are needed for the diff options.
    commit 1 implements them (see commit log,
    commits 2 to 4 use them in some commands that benefit from those.
    [1/4] parse-options new features.
    [2/4] Use OPT_SET_INT and OPT_BIT in builtin-branch
    [3/4] Use OPT_BIT in builtin-for-each-ref
    [4/4] Use OPT_BIT in builtin-pack-refs
  + this series does some modifications on the diff_options structure
    and the diff_opt_parse functions. Those are not fundamentally needed
    without parseopt, but parseopt will need them.
    Basically, diff_options had bitfields (the C :1 kind). parseopt cannot
    grok that portably, so I've converted these into a single
    `unsigned flags` with explicit masks to use (and helper macros to
    avoid overlong lines).
    The obvious goal is that I can use the OPTION_BIT feature from the
    previous series to fill them from parse_options.
    [1/2] Make the diff_options bitfields be an unsigned with explicit masks.
    [2/2] Reorder diff_opt_parse options more logically per topics.

Those patches are available on my public repository in the ph/parseopt-stable branch.

ph/parseopt is my WIP and has many many horrible commits right now, that I rebase -i to cleanse them once the big picture pleases me enough, though people may want to look at diff.h in that branch to see where it goes. I'm pleased to say that it seems I'll only need 3 diff-specific callbacks, which is not a lot:

    http://git.madism.org/?p=git.git;a=blobdiff;f=diff.h;h=0e44e5;hp=6ff2b0;hb=def4eb;hpb=bdc1ab

I suppose that the split of this big macro is explanatory enough for the reason behind commit 2/2 of the third series...

Diff stats: ~~~~~~~~~~

  + gcc issue:
     builtin-diff.c |    2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
  + parseopt features:
     builtin-branch.c       |   44 ++++++++++++-----------------------
     builtin-for-each-ref.c |   19 ++++++++-------
     builtin-pack-refs.c    |   12 ++-------
     git-compat-util.h      |    1 
     parse-options.c        |   61 +++++++++++++++++++++++++++++++++++--------------
     parse-options.h        |   15 +++++++++++-
     6 files changed, 88 insertions(+), 64 deletions(-)
  + diff-cleanup:
     builtin-blame.c      |   10 +-
     builtin-diff-files.c |    4 +-
     builtin-diff-index.c |    4 +-
     builtin-diff-tree.c  |    9 +-
     builtin-diff.c       |   12 ++--
     builtin-log.c        |   24 +++---
     combine-diff.c       |   10 +-
     diff-lib.c           |   23 +++---
     diff.c               |  221 ++++++++++++++++++++++++++------------------------
     diff.h               |   40 ++++++----
     log-tree.c           |    6 +-
     merge-recursive.c    |    2 +-
     patch-ids.c          |    2 +-
     revision.c           |   22 +++---
     tree-diff.c          |   14 ++--
     15 files changed, 209 insertions(+), 194 deletions(-)
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Next: Pierre Habouzit
Message 1 of 19 in “Preliminary patches to the diff.[hc] parseoptification”
  1. Pierre HabouzitNov 7, 2007
  2. 1/1 Make gcc warning about empty if body go away.Pierre Habouzit, Nov 7, 2007
  3. 1/4 parse-options new features.Pierre Habouzit, Nov 7, 2007
  4. 2/4 Use OPT_SET_INT and OPT_BIT in builtin-branchPierre Habouzit, Nov 7, 2007
  5. 3/4 Use OPT_BIT in builtin-for-each-refPierre Habouzit, Nov 7, 2007
  6. 4/4 Use OPT_BIT in builtin-pack-refsPierre Habouzit, Nov 7, 2007
  7. 1/2 Make the diff_options bitfields be an unsigned with explicit masks.Pierre Habouzit, Nov 7, 2007
  8. 2/2 Reorder diff_opt_parse options more logically per topics.Pierre Habouzit, Nov 7, 2007
  9. Junio C HamanoNov 8, 2007
  10. Pierre HabouzitNov 8, 2007
  11. 1/2 Make the diff_options bitfields be an unsigned with explicit masks.Pierre Habouzit, Nov 10, 2007
  12. Junio C HamanoNov 8, 2007
  13. Pierre HabouzitNov 9, 2007
  14. Junio C HamanoNov 8, 2007
  15. Junio C HamanoNov 8, 2007
  16. Pierre HabouzitNov 8, 2007
  17. Andreas EricssonNov 8, 2007
  18. Jon LoeligerNov 8, 2007
  19. Andreas EricssonNov 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.