Skip to contentSkip to conversation

Make t9200-git-cvsexportcommit.sh pass on MSYS

PATCH In review Sebastian Schuberth 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover Make t9200-git-cvsexportcommit.sh pass on MSYS

This tiny series makes the long-pending t9200-git-cvsexportcommit.sh pass on MSYS.

Sebastian Schuberth (2):
t9200: On MSYS, do not pass Windows-style paths to CVS
git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS

 git-cvsexportcommit.perl       |    7 +++++++
 t/t9200-git-cvsexportcommit.sh |    6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.9.rc0.5096.g30a61
#1 lore raw

PATCH 1/2 t9200: On MSYS, do not pass Windows-style paths to CVS

For details, see the commit message of 4114156ae9. Note that while using $PWD as part of GIT_DIR is not required here, it does no harm and it is more consistent. In addition, on MSYS using an environment variable should be slightly faster than spawning an external executable.

---
 t/t9200-git-cvsexportcommit.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
t/t9200-git-cvsexportcommit.sh +3 -3
index 41db05c..518358a 100755
@@ -19,9 +19,9 @@ then
     test_done
 fi
 
-CVSROOT=$(pwd)/cvsroot
-CVSWORK=$(pwd)/cvswork
-GIT_DIR=$(pwd)/.git
+CVSROOT=$PWD/cvsroot
+CVSWORK=$PWD/cvswork
+GIT_DIR=$PWD/.git
 export CVSROOT CVSWORK GIT_DIR
 
 rm -rf "$CVSROOT" "$CVSWORK"
Signature · 1 line
1.7.9.rc0.5096.g30a61
#2 lore raw

Re: [PATCH 1/2] t9200: On MSYS, do not pass Windows-style paths to CVS

Quoted 4 lines · Sebastian Schuberth

For details, see the commit message of 4114156ae9. Note that while using $PWD as part of GIT_DIR is not required here, it does no harm and it is more consistent. In addition, on MSYS using an environment variable should be slightly faster than spawning an external executable.

Thanks. It seems that the "Dos and Dont's" from t/README needs to be stressed a bit more strongly.

#3 lore raw

PATCH 2/2 git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS

In reply to Sebastian Schuberth

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

---
 git-cvsexportcommit.perl |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
git-cvsexportcommit.perl +7 -0
index 39a426e..e6bf252 100755
@@ -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});
 }
Signature · 1 line
1.7.9.rc0.5096.g30a61
Tested-by on v1 2/2
#4 lore raw

Re: [msysGit] [PATCH 2/2] git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS

Quoted 33 lines · Sebastian Schuberth

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

---
 git-cvsexportcommit.perl |    7 +++++++

 1 files changed, 7 insertions(+), 0 deletions(-)
git-cvsexportcommit.perl +7 -1
index 39a426e..e6bf252 100755
@@ -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});
  }
--
Quoted 2 lines

1.7.9.rc0.5096.g30a61

Cool - works for me. I just assumed we didn't support cvsexport.