]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Git.pm: use array in command_bidi_pipe example
authorEric Wong <e@80x24.org>
Mon, 17 Jun 2024 10:43:25 +0000 (10:43 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Jun 2024 20:41:51 +0000 (13:41 -0700)
command_bidi_pipe takes the git command and optional arguments as an
array, not a string.  Make sure the documentation example is usable
code.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
perl/Git.pm

index 03bf570bf4c852932973f3a6815c2d3dd4802622..aebfe0c6e07c27b76d6702fb0fe1d1a8a536ad6b 100644 (file)
@@ -418,7 +418,7 @@ argument is required if you want to see the command name in the error message,
 and it is the fourth value returned by C<command_bidi_pipe()>.  The call idiom
 is:
 
-       my ($pid, $in, $out, $ctx) = $r->command_bidi_pipe('cat-file --batch-check');
+       my ($pid, $in, $out, $ctx) = $r->command_bidi_pipe(qw(cat-file --batch-check));
        print $out "000000000\n";
        while (<$in>) { ... }
        $r->command_close_bidi_pipe($pid, $in, $out, $ctx);
@@ -431,7 +431,7 @@ C<PIPE_IN> and C<PIPE_OUT> may be C<undef> if they have been closed prior to
 calling this function.  This may be useful in a query-response type of
 commands where caller first writes a query and later reads response, eg:
 
-       my ($pid, $in, $out, $ctx) = $r->command_bidi_pipe('cat-file --batch-check');
+       my ($pid, $in, $out, $ctx) = $r->command_bidi_pipe(qw(cat-file --batch-check));
        print $out "000000000\n";
        close $out;
        while (<$in>) { ... }