git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Schuberth <sschuberth@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: msysgit@googlegroups.com, git@vger.kernel.org
Subject: [PATCH 2/2] git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS
Date: Wed, 11 Jan 2012 10:21:10 +0100	[thread overview]
Message-ID: <4F0D5486.7020707@gmail.com> (raw)
In-Reply-To: <4F0D5367.1000506@gmail.com>

Due to MSYS path mangling GIT_DIR contains a Windows-style path when
checked inside a Perl script even if GIT_DIR was previously set to an
MSYS-style path in a shell script. So explicitly convert to an MSYS-style
path before calling Perl's rel2abs() to make it work.

This fix was inspired by a very similar patch in WebKit:

http://trac.webkit.org/changeset/76255/trunk/Tools/Scripts/commit-log-editor

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
---
 git-cvsexportcommit.perl |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 39a426e..e6bf252 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -30,6 +30,13 @@ if ($opt_w || $opt_W) {
 		chomp($gd);
 		$ENV{GIT_DIR} = $gd;
 	}
+
+	# On MSYS, convert a Windows-style path to an MSYS-style path
+	# so that rel2abs() below works correctly.
+	if ($^O eq 'msys') {
+		$ENV{GIT_DIR} =~ s#^([[:alpha:]]):/#/$1/#;
+	}
+
 	# Make sure GIT_DIR is absolute
 	$ENV{GIT_DIR} = File::Spec->rel2abs($ENV{GIT_DIR});
 }
-- 
1.7.9.rc0.5096.g30a61

  parent reply	other threads:[~2012-01-11  9:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  9:16 [PATCH 0/2] Make t9200-git-cvsexportcommit.sh pass on MSYS Sebastian Schuberth
2012-01-11  9:20 ` [PATCH 1/2] t9200: On MSYS, do not pass Windows-style paths to CVS Sebastian Schuberth
2012-01-12  2:06   ` Junio C Hamano
2012-01-11  9:21 ` Sebastian Schuberth [this message]
2012-01-11 11:29   ` [msysGit] [PATCH 2/2] git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS Pat Thoyts

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=4F0D5486.7020707@gmail.com \
    --to=sschuberth@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=msysgit@googlegroups.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).