From: Matteo Bertini <naufraghi@develer.com>
To: git@vger.kernel.org
Cc: Matteo Bertini <matteo@naufraghi.net>,
normalperson@yhbt.net, gitster@pobox.com,
Matteo Bertini <naufraghi@develer.com>
Subject: [PATCH 2/4] Git.pm: Add $path and $enable_filters arguments to hash_and_insert_object.
Date: Tue, 31 May 2016 17:07:47 +0200 [thread overview]
Message-ID: <20160531150749.24840-3-naufraghi@develer.com> (raw)
In-Reply-To: <20160531150749.24840-1-naufraghi@develer.com>
From: Matteo Bertini <matteo@naufraghi.net>
The option $enable_filters skips the --no-filters option,
the $path argument provide a path to be used alike the --path argument
to hash-object in the non streaming invocation.
Signed-off-by: Matteo Bertini <naufraghi@develer.com>
---
perl/Git.pm | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/perl/Git.pm b/perl/Git.pm
index ce7e4e8..6c2e3fc 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -963,11 +963,13 @@ The function returns the SHA1 hash.
# TODO: Support for passing FILEHANDLE instead of FILENAME
sub hash_and_insert_object {
- my ($self, $filename) = @_;
-
- carp "Bad filename \"$filename\"" if $filename =~ /[\r\n]/;
+ my ($self, $filename, $path, $enable_filters) = @_;
+ carp "Bad filename \"$filename\"" if $filename =~ /[\r\n\t]/;
+ if (defined($path)) {
+ $filename = join("\t", $filename, $path);
+ }
- $self->_open_hash_and_insert_object_if_needed();
+ $self->_open_hash_and_insert_object_if_needed($enable_filters);
my ($in, $out) = ($self->{hash_object_in}, $self->{hash_object_out});
unless (print $out $filename, "\n") {
@@ -985,13 +987,18 @@ sub hash_and_insert_object {
}
sub _open_hash_and_insert_object_if_needed {
- my ($self) = @_;
+ my ($self, $enable_filters) = @_;
return if defined($self->{hash_object_pid});
+ my @command = qw(hash-object -w --stdin-paths);
+ if (!$enable_filters) {
+ push(@command, "--no-filters");
+ }
+
($self->{hash_object_pid}, $self->{hash_object_in},
$self->{hash_object_out}, $self->{hash_object_ctx}) =
- $self->command_bidi_pipe(qw(hash-object -w --stdin-paths --no-filters));
+ $self->command_bidi_pipe(@command);
}
sub _close_hash_and_insert_object {
--
2.9.0.rc0.39.gb9f310b.dirty
next prev parent reply other threads:[~2016-05-31 15:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 15:07 [PATCH/RFC 0/4] Add option to enable filters in git-svn Matteo Bertini
2016-05-31 15:07 ` [PATCH 1/4] hash-object.c: Allow distinct file/path in stdin mode too Matteo Bertini
2016-05-31 15:07 ` Matteo Bertini [this message]
2016-05-31 15:07 ` [PATCH 3/4] SVN/Fetcher.pm: Add svn-remote.<id>.enable-filters to enable the filters Matteo Bertini
2016-05-31 15:07 ` [PATCH 4/4] git-svn.perl: Add git svn init --enable-filters option Matteo Bertini
2016-05-31 15:34 ` [PATCH/RFC 0/4] Add option to enable filters in git-svn Matteo Bertini
2016-05-31 18:12 ` Eric Wong
2016-05-31 20:34 ` Matteo Bertini
2016-06-02 21:13 ` Eric Wong
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=20160531150749.24840-3-naufraghi@develer.com \
--to=naufraghi@develer.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=matteo@naufraghi.net \
--cc=normalperson@yhbt.net \
/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).