git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/9] Add support for an external command for fetching notes

From
Siddh Raman Pant <siddh.raman.pant@oracle.com>
Date
May 19, 2026, 16:30 UTC
Message-ID
<cover.1779207350.git.siddh.raman.pant@oracle.com>
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
Next: Siddh Raman Pant
Message 1 of 29 in “Add support for an external command for fetching notes”
  1. 0/9 Add support for an external command for fetching notesSiddh Raman Pant, May 19, 2026
  2. 1/9 Documentation/git-range-diff: add missing notes options in synopsisSiddh Raman Pant, May 19, 2026
  3. Junio C HamanoMay 19, 2026
  4. Siddh Raman PantMay 20, 2026
  5. Junio C HamanoMay 21, 2026
  6. Siddh Raman PantMay 21, 2026
  7. 4/9 run-command: add support for timeout in command finisherSiddh Raman Pant, May 19, 2026
  8. Johannes SixtMay 21, 2026
  9. Oswald BuddenhagenMay 21, 2026
  10. Siddh Raman PantMay 21, 2026
  11. Johannes SixtMay 21, 2026
  12. Junio C HamanoMay 22, 2026
  13. Siddh Raman PantMay 22, 2026
  14. Jeff KingMay 22, 2026
  15. Siddh Raman PantMay 22, 2026
  16. 5/9 wrapper: add support for timeout and deadline in read helpersSiddh Raman Pant, May 19, 2026
  17. 6/9 t3301: cover generic displayed notes behaviorSiddh Raman Pant, May 19, 2026
  18. 7/9 notes: support an external command to display notesSiddh Raman Pant, May 19, 2026
  19. Junio C HamanoMay 20, 2026
  20. Siddh Raman PantMay 20, 2026
  21. brian m. carlsonMay 21, 2026
  22. Siddh Raman PantMay 21, 2026
  23. brian m. carlsonMay 21, 2026
  24. 2/9 notes: convert raw arg in format_display_notes() to boolSiddh Raman Pant, May 19, 2026
  25. 3/9 wrapper: add sleep_nanosecSiddh Raman Pant, May 19, 2026
  26. Junio C HamanoMay 19, 2026
  27. Siddh Raman PantMay 20, 2026
  28. 8/9 Documentation: document external notes command optionsSiddh Raman Pant, May 19, 2026
  29. 9/9 t: add tests for external notes commandSiddh Raman Pant, May 19, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.