Subject: [parse-options] proposal for merge, take 1

From: Pierre Habouzit <[email-masked]>
Date: Tue, 16 Oct 2007 10:16:31 +0200

Hi, thanks to the tremendous help I received from Dscho to make its
API and internals even better, I believe that my parseopt branch is
ready for inclusion.

  There is only _one_ small backward incompatibility (if other ones,
then it's not done on purpose and should be fixed) in git-show-ref: it
had a -h short option, synonym of --head. I made this -H because -h is
automatically diverted to "show usage" now, and it's counter-intuitive
anyways. I rebased -i my series so that this patch comes last if people
think it's a bad idea, so that the rest can be still be merged.

  Note that patch 7/25 has a small discussion in it.

  The series comes in 2 parts: the parse-options construction, split
into small pieces to introduce each feature. And the migration of a few
builtins. Diffstats and shortlogs follow.

  The branch is available from git://git.madism.org/git.git in the topic
branch ph/parseopt. I just rebased it onto the last "next" spearce
produced.

  Thanks to Alex Riesen, Johannes Schindelin, Jonas Fonseca and Kristian
HÃ¸gsberg for their help, patches and advices.

==============================================================================
Part 1
------------------------------------------------------------------------------

  Alex Riesen (1):
      Rework make_usage to print the usage message immediately

  Johannes Schindelin (2):
      Add tests for parse-options.c
      parse-options: Allow abbreviated options when unambiguous

  Pierre Habouzit (5):
      Add a simple option parser.
      parse-options: be able to generate usages automatically
      Add shortcuts for very often used options.
      parse-options: make some arguments optional, add callbacks.
      parse-options: allow callbacks to take no arguments at all.

  .gitignore               |    1 +
  Makefile                 |    6 +-
  parse-options.c          |  328 ++++++++++++++++++++++++++++++++++++++++++++++
  parse-options.h          |   70 ++++++++++
  t/t0040-parse-options.sh |   92 +++++++++++++
  test-parse-options.c     |   35 +++++
  6 files changed, 529 insertions(+), 3 deletions(-)

==============================================================================
Part 2
------------------------------------------------------------------------------

  Jonas Fonseca (1):
      Update manpages to reflect new short and long option aliases

  Kristian HÃ¸gsberg (1):
      Port builtin-add.c to use the new option parser.

  Pierre Habouzit (16):
      Make builtin-rm.c use parse_options.
      Make builtin-mv.c use parse-options
      Make builtin-branch.c use parse_options.
      Make builtin-describe.c use parse_options
      Make builtin-fetch.c use parse_options.
      Make builtin-revert.c use parse_options.
      Make builtin-update-ref.c use parse_options
      Make builtin-symbolic-ref.c use parse_options.
      Make builtin-http-fetch.c use parse_options.
      Make builtin-for-each-ref.c use parse-opts.
      Make builtin-fsck.c use parse_options.
      Make builtin-count-objects.c use parse_options.
      Make builtin-name-rev.c use parse_options.
      Make builtin-pack-refs.c use parse_options.
      Make builtin-show-ref.c use parse_options [small backward incompatibility].
      Make builtin-pack-objects.c use parse_options.

  Documentation/git-add.txt          |    4 +-
  Documentation/git-branch.txt       |    2 +-
  Documentation/git-mv.txt           |    2 +-
  Documentation/git-rm.txt           |    4 +-
  Documentation/git-show-ref.txt     |    4 +-
  Documentation/git-symbolic-ref.txt |    2 +-
  builtin-add.c                      |   70 +++------
  builtin-branch.c                   |  147 +++++++------------
  builtin-count-objects.c            |   32 ++--
  builtin-describe.c                 |   70 ++++-----
  builtin-fetch.c                    |  146 ++++++------------
  builtin-for-each-ref.c             |  138 ++++++++----------
  builtin-fsck.c                     |   80 +++-------
  builtin-http-fetch.c               |   65 ++++-----
  builtin-mv.c                       |   84 +++++------
  builtin-name-rev.c                 |   64 +++-----
  builtin-pack-objects.c             |  294 +++++++++++++++++-------------------
  builtin-pack-refs.c                |   47 +++----
  builtin-revert.c                   |   67 ++++-----
  builtin-rm.c                       |   54 +++----
  builtin-show-ref.c                 |  127 ++++++----------
  builtin-symbolic-ref.c             |   52 +++----
  builtin-update-ref.c               |   65 +++-----
  23 files changed, 654 insertions(+), 966 deletions(-)