Git development
 help / color / mirror / Atom feed
* [PATCH] git-contacts: allow inputting patch via stdin
@ 2026-09-15  2:43 Brigham Campbell
  2026-09-15  4:29 ` Junio C Hamano
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Brigham Campbell @ 2026-09-15  2:43 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Patrick Steinhardt, Brigham Campbell

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


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

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

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-15  2:43 [PATCH] git-contacts: allow inputting patch via stdin Brigham Campbell
2026-09-15  4:29 ` Junio C Hamano
2026-09-16  4:52 ` [PATCH v2] " Brigham Campbell
2026-09-16 14:25   ` Junio C Hamano
2026-09-17  6:56     ` Brigham Campbell
2026-09-24  1:25 ` [PATCH v3] " Brigham Campbell
2026-09-24  4:13   ` Junio C Hamano
2026-09-25  1:51     ` Brigham Campbell
2026-09-25  4:38       ` Junio C Hamano
2026-09-25  6:42 ` [PATCH v4] " Brigham Campbell
2026-09-25 16:09   ` Junio C Hamano
2026-09-29  5:47 ` [PATCH v5 0/2] " Brigham Campbell
2026-09-29  5:47   ` [PATCH v5 1/2] " Brigham Campbell
2026-09-29 19:29     ` Junio C Hamano
2026-10-02  4:44       ` Brigham Campbell
2026-09-29  5:47   ` [PATCH v5 2/2] git-contacts: add stdin functionality to docs Brigham Campbell
2026-09-29 16:30   ` [PATCH v5 0/2] git-contacts: allow inputting patch via stdin Junio C Hamano
2026-10-02  6:50 ` [PATCH v6] " Brigham Campbell
2026-10-02 14:50   ` Junio C Hamano

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