From: Brigham Campbell Date: Fri, 25 Sep 2026 06:42:39 GMT Subject: [PATCH v4] git-contacts: allow inputting patch via stdin Message-ID: <20260925-git-contacts-stdin-v4-1-9b4e4bcbb91c@brighamcampbell.com> In-Reply-To: <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 when the user passes `-` at least once: $ git contacts - --- Junio, you suggested that I make git-contacts process files and stdin with respect to the order in which they appear in argv. I instead removed the implication that git-contacts processes input in any particular order. Even before this patch, git-contacts parses files first, then git rev-lists second, regardless of their order in argv. If we instead want git-contacts to parse arguments in the same order that they're passed, that's a change which should occur in a separate patch. I'm happy to write that patch if you'd like. --- Changes in v4: - Don't imply that git-contacts processes input in any particular order - Link to v3: https://patch.msgid.link/20260923-git-contacts-stdin-v3-1-56dd43c64d56@brighamcampbell.com Changes in v3: - Make user pass '-' instead of an empty argv and non-TTY stdin - Link to v2: https://patch.msgid.link/20260915-git-contacts-stdin-v2-1-2005061d907a@brighamcampbell.com Changes in v2: - Minor variable cleanup / un-spaghettification - Include update to usage comment - Remove Cc trailers from commit message - Link to v1: https://patch.msgid.link/20260914-git-contacts-stdin-v1-1-9ac628e6fd20@brighamcampbell.com To: git@vger.kernel.org Cc: Junio C Hamano Cc: Patrick Steinhardt --- contrib/contacts/git-contacts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts index 85ad732fc0..df7b920d9e 100755 --- a/contrib/contacts/git-contacts +++ b/contrib/contacts/git-contacts @@ -162,9 +162,11 @@ if (!@ARGV) { die "No input revisions or patch files\n"; } -my (@files, @rev_args); +my ($read_from_stdin, @files, @rev_args); for (@ARGV) { - if (-e) { + if ($_ eq '-') { + $read_from_stdin = 1; + } elsif (-e) { push @files, $_; } else { push @rev_args, $_; @@ -172,6 +174,9 @@ for (@ARGV) { } my %sources; +if ($read_from_stdin) { + scan_patches(\%sources, undef, \*STDIN); +} for (@files) { scan_patch_file(\%sources, $_); } --- base-commit: 0f8e75abebff0877cae681a3d5ff31ac47f54220 change-id: 20260914-git-contacts-stdin-1e829930e19b Thanks! -- Brigham Campbell https://brighamcampbell.com