diff options
Diffstat (limited to 'perl')
| -rw-r--r-- | perl/.gitignore | 3 | ||||
| -rw-r--r-- | perl/Git.pm | 29 | ||||
| -rw-r--r-- | perl/Makefile | 39 | ||||
| -rw-r--r-- | perl/Makefile.PL | 5 | ||||
| -rw-r--r-- | perl/private-Error.pm | 2 |
5 files changed, 65 insertions, 13 deletions
diff --git a/perl/.gitignore b/perl/.gitignore index e990caeea7..98b24772c7 100644 --- a/perl/.gitignore +++ b/perl/.gitignore @@ -1,4 +1,5 @@ -Makefile +perl.mak +perl.mak.old blib blibdirs pm_to_blib diff --git a/perl/Git.pm b/perl/Git.pm index 2b26b65bfb..f2c156cde9 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -63,7 +63,7 @@ for doing easily operations which are not totally trivial to do over the generic command interface. While some commands can be executed outside of any context (e.g. 'version' -or 'init-db'), most operations require a repository context, which in practice +or 'init'), most operations require a repository context, which in practice means getting an instance of the Git object using the repository() constructor. (In the future, we will also get a new_repository() constructor.) All commands called as methods of the object are then executed in the context of the @@ -275,7 +275,7 @@ sub command { } else { my @lines = <$fh>; - chomp @lines; + defined and chomp for @lines; try { _cmd_close($fh, $ctx); } catch Git::Error::Command with { @@ -354,7 +354,7 @@ sub command_input_pipe { =item command_close_pipe ( PIPE [, CTX ] ) Close the C<PIPE> as returned from C<command_*_pipe()>, checking -whether the command finished successfuly. The optional C<CTX> argument +whether the command finished successfully. The optional C<CTX> argument is required if you want to see the command name in the error message, and it is the second value returned by C<command_*_pipe()> when called in array context. The call idiom is: @@ -482,14 +482,14 @@ sub wc_chdir { =item config ( VARIABLE ) -Retrieve the configuration C<VARIABLE> in the same manner as C<repo-config> +Retrieve the configuration C<VARIABLE> in the same manner as C<config> does. In scalar context requires the variable to be set only one time (exception is thrown otherwise), in array context returns allows the variable to be set multiple times and returns all the values. Must be called on a repository instance. -This currently wraps command('repo-config') so it is not so fast. +This currently wraps command('config') so it is not so fast. =cut @@ -500,9 +500,9 @@ sub config { try { if (wantarray) { - return $self->command('repo-config', '--get-all', $var); + return $self->command('config', '--get-all', $var); } else { - return $self->command_oneline('repo-config', '--get', $var); + return $self->command_oneline('config', '--get', $var); } } catch Git::Error::Command with { my $E = shift; @@ -736,13 +736,19 @@ sub _command_common_pipe { _check_valid_cmd($cmd); my $fh; - if ($^O eq '##INSERT_ACTIVESTATE_STRING_HERE##') { + if ($^O eq 'MSWin32') { # ActiveState Perl #defined $opts{STDERR} and # warn 'ignoring STDERR option - running w/ ActiveState'; $direction eq '-|' or die 'input pipe for ActiveState not implemented'; - tie ($fh, 'Git::activestate_pipe', $cmd, @args); + # the strange construction with *ACPIPE is just to + # explain the tie below that we want to bind to + # a handle class, not scalar. It is not known if + # it is something specific to ActiveState Perl or + # just a Perl quirk. + tie (*ACPIPE, 'Git::activestate_pipe', $cmd, @args); + $fh = *ACPIPE; } else { my $pid = open($fh, $direction); @@ -809,8 +815,9 @@ sub TIEHANDLE { # FIXME: This is probably horrible idea and the thing will explode # at the moment you give it arguments that require some quoting, # but I have no ActiveState clue... --pasky - my $cmdline = join " ", @params; - my @data = qx{$cmdline}; + # Let's just hope ActiveState Perl does at least the quoting + # correctly. + my @data = qx{git @params}; bless { i => 0, data => \@data }, $class; } diff --git a/perl/Makefile b/perl/Makefile new file mode 100644 index 0000000000..099beda873 --- /dev/null +++ b/perl/Makefile @@ -0,0 +1,39 @@ +# +# Makefile for perl support modules and routine +# +makfile:=perl.mak + +PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) +prefix_SQ = $(subst ','\'',$(prefix)) + +all install instlibdir: $(makfile) + $(MAKE) -f $(makfile) $@ + +clean: + test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0 + $(RM) ppport.h + $(RM) $(makfile) + $(RM) $(makfile).old + +ifdef NO_PERL_MAKEMAKER +instdir_SQ = $(subst ','\'',$(prefix)/lib) +$(makfile): ../GIT-CFLAGS Makefile + echo all: > $@ + echo ' :' >> $@ + echo install: >> $@ + echo ' mkdir -p $(instdir_SQ)' >> $@ + echo ' $(RM) $(instdir_SQ)/Git.pm; cp Git.pm $(instdir_SQ)' >> $@ + echo ' $(RM) $(instdir_SQ)/Error.pm; \ + cp private-Error.pm $(instdir_SQ)/Error.pm' >> $@ + echo instlibdir: >> $@ + echo ' echo $(instdir_SQ)' >> $@ +else +$(makfile): Makefile.PL ../GIT-CFLAGS + '$(PERL_PATH_SQ)' $< PREFIX='$(prefix_SQ)' +endif + +# this is just added comfort for calling make directly in perl dir +# (even though GIT-CFLAGS aren't used yet. If ever) +../GIT-CFLAGS: + $(MAKE) -C .. GIT-CFLAGS + diff --git a/perl/Makefile.PL b/perl/Makefile.PL index de73235e4c..9b117fd0d7 100644 --- a/perl/Makefile.PL +++ b/perl/Makefile.PL @@ -20,9 +20,14 @@ if ($@) { my %extra; $extra{DESTDIR} = $ENV{DESTDIR} if $ENV{DESTDIR}; +# redirect stdout, otherwise the message "Writing perl.mak for Git" +# disrupts the output for the target 'instlibdir' +open STDOUT, ">&STDERR"; + WriteMakefile( NAME => 'Git', VERSION_FROM => 'Git.pm', PM => \%pm, + MAKEFILE => 'perl.mak', %extra ); diff --git a/perl/private-Error.pm b/perl/private-Error.pm index 8fff86699f..11e9cd9a02 100644 --- a/perl/private-Error.pm +++ b/perl/private-Error.pm @@ -781,7 +781,7 @@ that is a plain string. (Unless C<$Error::ObjectifyCallback> is modified) This variable holds a reference to a subroutine that converts errors that are plain strings to objects. It is used by Error.pm to convert textual -errors to objects, and can be overrided by the user. +errors to objects, and can be overridden by the user. It accepts a single argument which is a hash reference to named parameters. Currently the only named parameter passed is C<'text'> which is the text |
