Git development
 help / color / mirror / Atom feed
* [PATCH 0/9] Add support for an external command for fetching notes
@ 2026-05-19 16:30 Siddh Raman Pant
  2026-05-19 16:30 ` [PATCH 1/9] Documentation/git-range-diff: add missing notes options in synopsis Siddh Raman Pant
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Siddh Raman Pant @ 2026-05-19 16:30 UTC (permalink / raw)
  To: git
  Cc: Calvin Wan, Patrick Steinhardt, Elijah Newren,
	Kristoffer Haugsbakk, Junio C Hamano

Hi,

This series teaches the notes display machinery to obtain note text from a
long-lived external helper configured by `notes.externalCommand`.

The motivation is mentioned in the main commit message (PATCH 7/9).

The helper protocol is intentionally narrow. Git starts the command once,
sends one commit object ID per request, and expects either:

	<object-id> missing
	<object-id> ok <n>
	<n bytes of UTF-8 note text>

with the documented trailing newlines. The command is read only from protected
configuration, so an untrusted repository cannot make ordinary note display run
arbitrary commands. If the helper cannot be started, times out, exits, or sends
an invalid response, Git warns once, disables it for the rest of the process,
and continues without external notes.

Users can control from command line too with `--external-notes` and
`--no-external-notes`. The semantics are close to `--notes=<ref>`:
`--external-notes` implies naming an explicit notes source by itself, while
`--external-notes --notes` combines it with the default notes refs, and
`--external-notes --notes=<ref>` combines it with specific notes refs. The
series also adds `notes.externalCommandName`, `notes.externalCommandTimeoutMs`,
and the opt-in `notes.externalCommandForGrep` knob for installations that want
external notes to participate in `--grep` matching.

Because this puts an external process on the log-formatting path, the series
also adds the small support pieces needed to keep that boundary bounded:
timeout/deadline variants of the read helpers, a timeout-aware command
finisher, and cleanup that escalates if the helper does not exit promptly.

Testing: https://github.com/siddhpant/git/actions/runs/26107938855

Thanks,
Siddh

Siddh Raman Pant (9):
  Documentation/git-range-diff: add missing notes options in synopsis
  notes: convert raw arg in format_display_notes() to bool
  wrapper: add sleep_nanosec
  run-command: add support for timeout in command finisher
  wrapper: add support for timeout and deadline in read helpers
  t3301: cover generic displayed notes behavior
  notes: support an external command to display notes
  Documentation: document external notes command options
  t: add tests for external notes command

 Documentation/config/notes.adoc             |  57 +++
 Documentation/git-format-patch.adoc         |  11 +-
 Documentation/git-range-diff.adoc           |   8 +-
 Documentation/pretty-options.adoc           |   9 +
 Makefile                                    |   2 +
 builtin/log.c                               |  17 +-
 builtin/name-rev.c                          |   9 +-
 builtin/range-diff.c                        |   2 +
 contrib/completion/git-completion.bash      |   4 +-
 log-tree.c                                  |  10 +-
 meson.build                                 |   1 +
 notes-external.c                            | 330 ++++++++++++++
 notes-external.h                            |  19 +
 notes.c                                     | 244 ++++++++---
 notes.h                                     |  32 +-
 revision.c                                  |  32 +-
 run-command.c                               |  92 +++-
 run-command.h                               |  13 +
 strbuf.c                                    |  26 +-
 strbuf.h                                    |   4 +
 t/helper/meson.build                        |   1 +
 t/helper/test-external-notes                |  64 +++
 t/helper/test-notes-external-config-reset.c |  20 +
 t/helper/test-tool.c                        |   1 +
 t/helper/test-tool.h                        |   1 +
 t/lib-notes.sh                              |  19 +
 t/t3206-range-diff.sh                       |  68 +++
 t/t3301-notes.sh                            | 461 ++++++++++++++++++++
 t/t6120-describe.sh                         |  17 +
 wrapper.c                                   | 188 +++++++-
 wrapper.h                                   |  24 +
 31 files changed, 1702 insertions(+), 84 deletions(-)
 create mode 100644 notes-external.c
 create mode 100644 notes-external.h
 create mode 100755 t/helper/test-external-notes
 create mode 100644 t/helper/test-notes-external-config-reset.c
 create mode 100644 t/lib-notes.sh

-- 
2.53.0


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

end of thread, other threads:[~2026-05-20  0:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-19 16:30 [PATCH 0/9] Add support for an external command for fetching notes Siddh Raman Pant
2026-05-19 16:30 ` [PATCH 1/9] Documentation/git-range-diff: add missing notes options in synopsis Siddh Raman Pant
2026-05-19 23:47   ` Junio C Hamano
2026-05-19 16:30 ` [PATCH 2/9] notes: convert raw arg in format_display_notes() to bool Siddh Raman Pant
2026-05-19 16:30 ` [PATCH 3/9] wrapper: add sleep_nanosec Siddh Raman Pant
2026-05-19 23:50   ` Junio C Hamano
2026-05-19 16:30 ` [PATCH 4/9] run-command: add support for timeout in command finisher Siddh Raman Pant
2026-05-19 16:30 ` [PATCH 5/9] wrapper: add support for timeout and deadline in read helpers Siddh Raman Pant
2026-05-19 16:30 ` [PATCH 6/9] t3301: cover generic displayed notes behavior Siddh Raman Pant
2026-05-19 16:30 ` [PATCH 7/9] notes: support an external command to display notes Siddh Raman Pant
2026-05-20  0:03   ` Junio C Hamano
2026-05-19 16:30 ` [PATCH 8/9] Documentation: document external notes command options Siddh Raman Pant
2026-05-19 16:30 ` [PATCH 9/9] t: add tests for external notes command Siddh Raman Pant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox