[PATCH 0/7] fast-import: standardize usage string and SYNOPSIS
From: Christian Couder <hidden>
Date: 2026-07-16 16:55:42
The goal of this series is to improve on `git fast-import`'s usage
string as it is obsolete in many ways.
Along the way it modernizes "builtin/fast-import.c" mostly by using
`struct option`, by starting to remove global variables and libify
that command, and by introducing a new `OPT_HIDDEN_GROUP` macro.
`struct option` is used only for the usage string for now and there
are still many global variables left, so it's left to future work to
finish on these directions.
But this is already enough to standardize the usage string and make it
consistent with the SYNOPSIS in the docs, so that the command can be
removed from "t/t0450/adoc-help-mismatches".
Overview of the patches
=======================
- Patch 1/7: Introduces OPT_HIDDEN_GROUP and improves on the hidden
option tests.
- Patches 2/7 and 3/7: Improves on the parse-options API docs.
- Patch 4/7: Cleans up an 'i' loop counter variable in
cmd_fast_import().
- Patches 5/7 and 6/7: Starts libifying "builtin/fast-import.c" by
introducing a 'struct fast_import_state' and using it to store
some global variables.
- Patch 7/7: Improves the usage string and SYNOPSIS by introducing
`struct option`.
CI tests
========
They all pass, see: https://github.com/chriscool/git/actions/runs/29513714019
Christian Couder (7):
parse-options: introduce OPT_HIDDEN_GROUP
api-parse-options.adoc: document per-option flags
api-parse-options.adoc: document hidden and OPT_*_F option macros
fast-import: localize 'i' into the 'for' loops using it
fast-import: introduce 'struct fast_import_state'
fast-import: move command state globals into 'struct
fast_import_state'
fast-import: use struct option for usage string
Documentation/git-fast-import.adoc | 2 +-
.../technical/api-parse-options.adoc | 79 ++++
builtin/fast-import.c | 372 +++++++++++-------
parse-options.c | 4 +-
parse-options.h | 5 +
t/helper/test-parse-options.c | 4 +
t/t0040-parse-options.sh | 25 +-
t/t0450/adoc-help-mismatches | 1 -
8 files changed, 344 insertions(+), 148 deletions(-)
--
2.55.0.185.g9120d2b5c0