git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Baudis <pasky@suse.cz>
To: gitster@pobox.com
Cc: git@vger.kernel.org
Subject: [PATCH] Git.pm: Fix internal git_command_bidi_pipe() users
Date: Mon, 04 Aug 2008 09:56:04 +0200	[thread overview]
Message-ID: <20080804075313.21325.28396.stgit@localhost> (raw)
In-Reply-To: <be6fef0d0808032149p651309a8o773dca5f16923ee1@mail.gmail.com>

The hash_and_insert_object() and cat_blob() helpers were using
an incorrect slice-from-ref Perl syntax. This patch fixes that up
in the _close_*() helpers and make the _open_*() helpers use the
same syntax for consistnecy.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

  Wow, the command_bidi_pipe API really is dirty. Of course, it is
my fault as anyone's since I didn't get around to review the patches
introducing it.

 perl/Git.pm |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/perl/Git.pm b/perl/Git.pm
index 087d3d0..0624428 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -827,8 +827,7 @@ sub _open_hash_and_insert_object_if_needed {
 
 	return if defined($self->{hash_object_pid});
 
-	($self->{hash_object_pid}, $self->{hash_object_in},
-	 $self->{hash_object_out}, $self->{hash_object_ctx}) =
+	@$self{map { "hash_object_$_" } qw(pid in out ctx)} =
 		command_bidi_pipe(qw(hash-object -w --stdin-paths));
 }
 
@@ -837,9 +836,8 @@ sub _close_hash_and_insert_object {
 
 	return unless defined($self->{hash_object_pid});
 
-	my @vars = map { 'hash_object_' . $_ } qw(pid in out ctx);
-
-	command_close_bidi_pipe($self->{@vars});
+	my @vars = map { "hash_object_$_" } qw(pid in out ctx);
+	command_close_bidi_pipe(@$self{@vars});
 	delete $self->{@vars};
 }
 
@@ -916,8 +914,7 @@ sub _open_cat_blob_if_needed {
 
 	return if defined($self->{cat_blob_pid});
 
-	($self->{cat_blob_pid}, $self->{cat_blob_in},
-	 $self->{cat_blob_out}, $self->{cat_blob_ctx}) =
+	@$self{map { "cat_blob_$_" } qw(pid in out ctx)} =
 		command_bidi_pipe(qw(cat-file --batch));
 }
 
@@ -926,9 +923,8 @@ sub _close_cat_blob {
 
 	return unless defined($self->{cat_blob_pid});
 
-	my @vars = map { 'cat_blob_' . $_ } qw(pid in out ctx);
-
-	command_close_bidi_pipe($self->{@vars});
+	my @vars = map { "cat_blob_$_" } qw(pid in out ctx);
+	command_close_bidi_pipe(@$self{@vars});
 	delete $self->{@vars};
 }
 

  parent reply	other threads:[~2008-08-04  7:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-04  4:49 [git/perl] unusual syntax? Ray Chuan
2008-08-04  5:02 ` [PATCH] Fix hash slice syntax error Abhijit Menon-Sen
2008-08-04  7:56 ` Petr Baudis [this message]
2008-08-04  8:05   ` [PATCH] Git.pm: Fix internal git_command_bidi_pipe() users Junio C Hamano
2008-08-04  8:21     ` Petr Baudis
2008-08-04  8:37       ` Junio C Hamano
2008-08-04 11:38         ` [PATCH] Git.pm: localise $? in command_close_bidi_pipe() Abhijit Menon-Sen
2008-08-05  6:12           ` Junio C Hamano
2008-08-04 15:01 ` [git/perl] unusual syntax? David Christensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080804075313.21325.28396.stgit@localhost \
    --to=pasky@suse.cz \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).