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

Re: [PATCH v5 1/2] git-contacts: allow inputting patch via stdin

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 29, 2026, 19:29 UTC
Message-ID
<xmqqv77ng8kk.fsf@gitster.g>
In-Reply-To
<20260928-git-contacts-stdin-v5-1-e9becaebc47e@brighamcampbell.com>
Brigham Campbell <me@brighamcampbell.com> writes:
Show 39 quoted lines
> 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, $_);
>  }
Doesn't the Usage comment at the beginning also want to be updated?
Thanks.
diff --git i/contrib/contacts/git-contacts w/contrib/contacts/git-contacts
index 85ad732fc0..1eb91c4ab1 100755
--- i/contrib/contacts/git-contacts
+++ w/contrib/contacts/git-contacts
@@ -3,7 +3,7 @@
 # List people who might be interested in a patch.  Useful as the argument to
 # git-send-email --cc-cmd option, and in other situations.
 #
-# Usage: git contacts <file | rev-list option> ...
+# Usage: git contacts <file | '-' | rev-list option> ...
 
 use strict;
 use warnings;
Previous: Brigham CampbellNext: Brigham Campbell
Message 14 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.