[PATCH v5 1/2] git-contacts: allow inputting patch via stdin
- From
Brigham Campbell <me@brighamcampbell.com>
- Date
- Sep 29, 2026, 05:47 UTC
- Message-ID
- <20260928-git-contacts-stdin-v5-1-e9becaebc47e@brighamcampbell.com>
- In-Reply-To
- <20260928-git-contacts-stdin-v5-0-e9becaebc47e@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 - <patch
Signed-off-by: Brigham Campbell <me@brighamcampbell.com> --- 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, $_); }
-- 2.55.0