[RFC/PATCH 0/4] update-index: migrate to parse-options API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder wrote:

> Here's a helper to make it easier for commands that use parse-options
> to adopt that nicer behavior.  It writes its output to stdout, so it
> should only be used to be used to handle the -h option.

Alas, "git update-index" does not use parse-options yet.  But that
is easily enough changed...

Patch 1 introduces an OPTION_LOWLEVEL_CALLBACK backdoor to
parse-options, so new option types (like the three-argument type
used by update-index --cacheinfo) can be supported without tempting
inventors of other commands through mention in the public API.

Patch 2 is a toy patch I previously send to Bo.  It makes
parse_option_step() distinguish between stops due to end of options
and stops due to appearance of a nonoption; update-index benefits
from something like this because it needs to deal with filename
parameters as they appear.

Patch 3 converts update-index to parse-options.  The commit message
mentions some potential simplifications.

All three patches ought to introduce new tests, but none do.  I
hope that does not hinder reading them too much.  Thoughts?

Jonathan Nieder (3):
  parse-options: allow git commands to invent new option types
  parse-options: make resuming easier after
    PARSE_OPT_STOP_AT_NON_OPTION
  update-index: migrate to parse-options API

Nguyán ThÃi Ngác Duy (1):
  setup: save prefix (original cwd relative to toplevel) in
    startup_info

 builtin/update-index.c |  389 +++++++++++++++++++++++++++++------------------
 cache.h                |    1 +
 parse-options.c        |    9 +-
 parse-options.h        |   10 ++
 setup.c                |    4 +-
 5 files changed, 259 insertions(+), 154 deletions(-)

-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]