git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rafael Kitover <rkitover@io.com>
To: git@vger.kernel.org
Subject: [PATCH] more portable absolute dir check in Git.pm
Date: Sat, 05 Feb 2011 11:19:28 -0500	[thread overview]
Message-ID: <4D4D7890.3020906@io.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 295 bytes --]

I was trying to get msysGit to work with activeperl. I'm not sure how 
far I got, I will revisit this problem in the future, but here is a patch.

It removes a problematic make fragment that doesn't work on nmake (and 
probably dmake as well.) As well as a better absolute dir check in Git.pm .

[-- Attachment #2: 0001-more-portable-absolute-dir-check-in-Git.pm.patch --]
[-- Type: text/plain, Size: 1553 bytes --]

>From 49f6d63f760d8b0b6988ce8cf4ed175965c3bf4b Mon Sep 17 00:00:00 2001
From: Rafael Kitover <rkitover@cpan.org>
Date: Sat, 5 Feb 2011 11:13:31 -0500
Subject: [PATCH] more portable absolute dir check in Git.pm

---
 perl/Git.pm      |    4 +++-
 perl/Makefile.PL |    7 ++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/perl/Git.pm b/perl/Git.pm
index 6cb0dd1..dee06e1 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -101,6 +101,7 @@ use Error qw(:try);
 use Cwd qw(abs_path);
 use IPC::Open2 qw(open2);
 use Fcntl qw(SEEK_SET SEEK_CUR);
+use File::Spec ();
 }
 
 
@@ -184,7 +185,8 @@ sub repository {
 		};
 
 		if ($dir) {
-			$dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir;
+                        File::Spec->file_name_is_absolute($dir)
+				or $dir = $opts{Directory} . '/' . $dir;
 			$opts{Repository} = abs_path($dir);
 
 			# If --git-dir went ok, this shouldn't die either.
diff --git a/perl/Makefile.PL b/perl/Makefile.PL
index 0b9deca..7ceec50 100644
--- a/perl/Makefile.PL
+++ b/perl/Makefile.PL
@@ -1,10 +1,13 @@
 use ExtUtils::MakeMaker;
 
 sub MY::postamble {
-	return <<'MAKE_FRAG';
+	my $make_frag = <<'MAKE_FRAG';
 instlibdir:
 	@echo '$(INSTALLSITELIB)'
 
+MAKE_FRAG
+
+	$make_frag .= <<'MAKE_FRAG' if $^O ne 'MSWin32';
 ifneq (,$(DESTDIR))
 ifeq (0,$(shell expr '$(MM_VERSION)' '>' 6.10))
 $(error ExtUtils::MakeMaker version "$(MM_VERSION)" is older than 6.11 and so \
@@ -14,6 +17,8 @@ endif
 endif
 
 MAKE_FRAG
+
+	return $make_frag;
 }
 
 my %pm = ('Git.pm' => '$(INST_LIBDIR)/Git.pm');
-- 
1.7.3.1


             reply	other threads:[~2011-02-05 16:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-05 16:19 Rafael Kitover [this message]
2011-02-06 22:32 ` [PATCH] more portable absolute dir check in Git.pm Erik Faye-Lund

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=4D4D7890.3020906@io.com \
    --to=rkitover@io.com \
    --cc=git@vger.kernel.org \
    /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).