Git development
 help / color / mirror / Atom feed
From: Siddh Raman Pant <siddh.raman.pant@oracle.com>
To: git@vger.kernel.org
Cc: Calvin Wan <calvinwan@google.com>, Patrick Steinhardt <ps@pks.im>,
	Elijah Newren <newren@gmail.com>,
	Kristoffer Haugsbakk <code@khaugsbakk.name>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 0/9] Add support for an external command for fetching notes
Date: Tue, 19 May 2026 22:00:29 +0530	[thread overview]
Message-ID: <cover.1779207350.git.siddh.raman.pant@oracle.com> (raw)

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


             reply	other threads:[~2026-05-19 16:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 16:30 Siddh Raman Pant [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1779207350.git.siddh.raman.pant@oracle.com \
    --to=siddh.raman.pant@oracle.com \
    --cc=calvinwan@google.com \
    --cc=code@khaugsbakk.name \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox