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

[PATCH] git-contacts: allow inputting patch via stdin

From
Brigham Campbell <me@brighamcampbell.com>
Date
Sep 15, 2026, 02:43 UTC
Message-ID
<20260914-git-contacts-stdin-v1-1-9ac628e6fd20@brighamcampbell.com>

Make git-contacts accept patch contents via stdin for better interoperability with other utilities. Read from stdin under the following circumstances:

* stdin is not a terminal
* argv is empty
Cc: Junio C Hamano <gitster@pobox.com>
Cc: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Brigham Campbell <me@brighamcampbell.com>
---
I authored this patch as the first of a two-patch series to enable b4 to
automatically determine patch recipients. The second patch modifies
.b4-config to wire everything up. I discovered, however, that b4 doesn't
yet pass the mbox "Fixes " header as it should. I sent a fix to b4.

The second patch of this series will therefore have to wait until the b4 fix lands in the latest version, so I'm splitting up this series of patches to git. This patch is useful and warranted even by itself.

Link: https://lore.kernel.org/tools/20260914-mbox-from-auto-to-cc-v1-1-fbf0c3fbd460@brighamcampbell.com
---
 contrib/contacts/git-contacts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts
index 85ad732fc0..52f6fbd044 100755
--- a/contrib/contacts/git-contacts
+++ b/contrib/contacts/git-contacts
@@ -158,7 +158,7 @@ sub mailmap_contacts {
 	return \%mapped;
 }
 
-if (!@ARGV) {
+if (!@ARGV && -t STDIN) {
 	die "No input revisions or patch files\n";
 }
 
@@ -178,6 +178,9 @@ for (@files) {
 if (@rev_args) {
 	scan_rev_args(\%sources, \@rev_args)
 }
+if (!@ARGV) {
+	scan_patches(\%sources, undef, \*STDIN);
+}
 
 my $toplevel = `git rev-parse --show-toplevel`;
 chomp $toplevel;

---
base-commit: 47ce80527c56f462cb97db4ca8125342204d3783
change-id: 20260914-git-contacts-stdin-1e829930e19b

Thanks!
-- 
Brigham Campbell
https://brighamcampbell.com
Next: Junio C Hamano
Message 1 of 19 in “git-contacts: allow inputting patch via stdin”
  1. git-contacts: allow inputting patch via stdinBrigham Campbell, Sep 15, 2026
  2. Junio C HamanoSep 15, 2026
  3. git-contacts: allow inputting patch via stdinBrigham Campbell, Sep 16, 2026
  4. Junio C HamanoSep 16, 2026
  5. Brigham CampbellSep 17, 2026
  6. git-contacts: allow inputting patch via stdinBrigham Campbell, Sep 24, 2026
  7. Junio C HamanoSep 24, 2026
  8. Brigham CampbellSep 25, 2026
  9. Junio C HamanoSep 25, 2026
  10. git-contacts: allow inputting patch via stdinBrigham Campbell, Sep 25, 2026
  11. Junio C HamanoSep 25, 2026
  12. 0/2 git-contacts: allow inputting patch via stdinBrigham Campbell, Sep 29, 2026
  13. 1/2 git-contacts: allow inputting patch via stdinBrigham Campbell, Sep 29, 2026
  14. Junio C HamanoSep 29, 2026
  15. Brigham CampbellOct 2, 2026
  16. 2/2 git-contacts: add stdin functionality to docsBrigham Campbell, Sep 29, 2026
  17. Junio C HamanoSep 29, 2026
  18. git-contacts: allow inputting patch via stdinBrigham Campbell, Oct 2, 2026
  19. Junio C HamanoOct 2, 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.