All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] builtin/refs: introduce subcommand groups
@ 2026-10-01 10:13 Patrick Steinhardt
  2026-10-01 10:13 ` [PATCH 1/3] parse-options: fix completion format when first option is skipped Patrick Steinhardt
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Patrick Steinhardt @ 2026-10-01 10:13 UTC (permalink / raw)
  To: git

Hi,

the git-refs(1) command has grown quite a bunch of different subcommands
by now. These subcommands can easily be grouped into three categories:

  - Operations that span across the whole reference database (migrate,
    verify, optimize).

  - Operations that read references (list, exists).

  - Operations that write references (create, delete, update, rename).

This patch series thus adapts the parse-options subsystem to support
grouping subcommands and then introduces the grouping for git-refs(1).
This results in the following output:

  usage: git refs migrate --ref-format=<format> [--no-reflog] [--dry-run]
     or: git refs verify [--strict] [--verbose]
     or: git refs list [--count=<count>] [--shell|--perl|--python|--tcl]
                                  [(--sort=<key>)...] [--format=<format>]
                                  [--include-root-refs] [--points-at=<object>]
                                  [--merged[=<object>]] [--no-merged[=<object>]]
                                  [--contains[=<object>]] [--no-contains[=<object>]]
                                  [(--exclude=<pattern>)...] [--start-after=<marker>]
                                  [ --stdin | (<pattern>...)]
     or: git refs exists <ref>
     or: git refs optimize [--all] [--no-prune] [--auto] [--include <pattern>] [--exclude <pattern>]
     or: git refs create [--message=<reason>] [--no-deref] [--create-reflog] <ref> <new-value>
     or: git refs delete [--message=<reason>] [--no-deref] <ref> [<old-value>]
     or: git refs update [--message=<reason>] [--no-deref] [--create-reflog] <ref> <new-value> [<old-value>]
     or: git refs rename [--message=<reason>] <old-ref> <new-ref>

  Reference database
      migrate               migrate the reference database to a different format
      verify                verify the consistency of the reference database
      optimize              optimize the reference database

  Reading references
      list                  list references
      exists                check whether a reference exists

  Writing references
      create                create a new reference
      delete                delete a reference
      update                update an existing reference
      rename                rename a reference

I expect that going forward, we'll probably have more use cases where we
can use these new capabilities (e.g. an upcoming git-objects(1) command,
which is going to be the equivalent to git-refs(1)).

Thanks!

Patrick

---
Patrick Steinhardt (3):
      parse-options: fix completion format when first option is skipped
      parse-options: allow grouping subcommands
      builtin/refs: introduce subcommand groups

 Documentation/git-refs.adoc                    |  2 +-
 Documentation/technical/api-parse-options.adoc | 10 ++++-
 builtin/refs.c                                 | 32 ++++++++-----
 parse-options.c                                | 62 ++++++++++++++------------
 parse-options.h                                |  7 +++
 t/helper/test-parse-options.c                  |  4 +-
 t/t0040-parse-options.sh                       | 16 +++++++
 7 files changed, 92 insertions(+), 41 deletions(-)


---
base-commit: a018953688f1b10bddf91bff8747068f5f4746a4
change-id: 20261001-b4-pks-parse-options-subcommand-groups-59b3f27da06c


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-10-02  8:10 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-01 10:13 [PATCH 0/3] builtin/refs: introduce subcommand groups Patrick Steinhardt
2026-10-01 10:13 ` [PATCH 1/3] parse-options: fix completion format when first option is skipped Patrick Steinhardt
2026-10-01 17:38   ` Junio C Hamano
2026-10-02  7:19     ` Patrick Steinhardt
2026-10-01 10:13 ` [PATCH 2/3] parse-options: allow grouping subcommands Patrick Steinhardt
2026-10-01 17:46   ` Junio C Hamano
2026-10-02  7:19     ` Patrick Steinhardt
2026-10-01 10:13 ` [PATCH 3/3] builtin/refs: introduce subcommand groups Patrick Steinhardt
2026-10-01 17:46   ` Junio C Hamano
2026-10-02  8:09 ` [PATCH v2 0/4] " Patrick Steinhardt
2026-10-02  8:09   ` [PATCH v2 1/4] parse-options: fix completion format when first option is skipped Patrick Steinhardt
2026-10-02  8:09   ` [PATCH v2 2/4] parse-options: extract functions to print single option Patrick Steinhardt
2026-10-02  8:09   ` [PATCH v2 3/4] parse-options: allow grouping subcommands Patrick Steinhardt
2026-10-02  8:09   ` [PATCH v2 4/4] builtin/refs: introduce subcommand groups Patrick Steinhardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.