Re: [PATCH v3] git-contacts: allow inputting patch via stdin
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 24, 2026, 04:13 UTC
- Message-ID
- <xmqqtsnf477e.fsf@gitster.g>
- In-Reply-To
- <20260923-git-contacts-stdin-v3-1-56dd43c64d56@brighamcampbell.com>
Brigham Campbell <me@brighamcampbell.com> writes:
> $ git contacts - <patch > $ git contacts patch1 - patch3 <patch2
The second one is an example that we could tell the command to read these three files in patch1 and then patch2 and then patch3.
Show 10 quoted lines
> -my (@files, @rev_args);
> +my (@files, @rev_args, $read_from_stdin);
> for (@ARGV) {
> - if (-e) {
> + if ($_ eq '-') {
> + $read_from_stdin = 1;
> + } elsif (-e) {
> push @files, $_;
> } else {
> push @rev_args, $_;But this does not match what I would expect here, which would be to have something like this ...
if (-e || $_ eq '-') {
push @files, $_;
} else {
push @rev_args, $_;
}... around here, and then tell scan_patch_file that "-" shouldn't be opened and instead read from the standard input stream, perhaps like
sub scan_patch_file {
my ($commits, $file) = @_;
if ($file eq '-') {
$f = \*STDIN;
} else {
open my $f, '<', $file or die "read failure: $file: $!\n";
}
scan_patches($commits, undef, $f);
close $f;
}or something.