Skip to content

update-index: migrate to parse-options API

Jonathan Nieder git 1 version In review

Get series with b4
b4 am 20101024081316.GA29630@burratino

Versions newest first

  1. v1 Latest4 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4parse-options: allow git commands to invent new option typesparse-options.c parse-options.h+12 -32 replies
2/4parse-options: make resuming easier after PARSE_OPT_STOP_AT_NON_OPTIONparse-options.c parse-options.h+3 -10 replies
3/4setup: save prefix (original cwd relative to toplevel) in startup_infocache.h setup.c+4 -10 replies
4/4update-index: migrate to parse-options APIbuiltin/update-index.c+240 -1492 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchStephen Boyd
SeriesImproved-by Noticed-by
1/4
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC/PATCH 0/4] update-index: migrate to parse-options API
Quoted 3 lines · Jonathan Nieder

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(-)
Signature · 1 line
1.7.2.3