Skip to contentSkip to conversation

git-sh-setup.sh: Add an pwd() function for MinGW

RFC/PATCH Ramsay Jones 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

---

Hi Johannes,

While working on fixing git-submodule.sh on cygwin, I attempted to run tests on MinGW to ensure that my patches don't cause a regression. (Indeed that is the *only* reason I have MinGW installed!)

In order to test the modified git-submodule.sh I used the following tests:

    $ git grep -l -e 'git *submodule' -- t
    t/t5526-fetch-submodules.sh
    t/t6008-rev-list-submodule.sh
    t/t7003-filter-branch.sh
    t/t7400-submodule-basic.sh
    t/t7401-submodule-summary.sh
    t/t7403-submodule-sync.sh
    t/t7405-submodule-merge.sh
    t/t7406-submodule-update.sh
    t/t7407-submodule-foreach.sh
    t/t7408-submodule-reference.sh
    t/t7506-status-submodule.sh
    t/t7610-mergetool.sh
    t/t9300-fast-import.sh
    t/t9350-fast-export.sh

On MinGW, the following tests failed:

    t5526-fetch-submodules.sh:  1, 2, 5, 8-13, 16, 18-19, 21, 23-24
    t7400-submodule-basic.sh:   7
    t7401-submodule-summary.sh: 16
    t7405-submodule-merge.sh:   7-8
    t7406-submodule-update.sh:  3, 24-25, 30-31
    t7407-submodule-foreach.sh: 2, 5-10, 12-13
    t9300-fast-import.sh:       62

I noticed that 6 of those tests were failing due to CRLF line ending issues. For example, if you redirect the output of git-status to a file, then you will find that the lines output by git-submodule have CRLF line endings, while the remainder of the file has LF only. So, in order to ignore this (ie I don't have a patch to fix it!), if I run the tests something like this:

    $ GIT_TEST_CMP='diff -ub' ./t7400-submodule-basic.sh

then these tests pass. The tests in question being:

    t7400.7, t7401.16, t7405.{7,8}, t7406.3 and t7407.2

[Note that I wanted to use --strip-trailing-cr but the version of diff on MinGW was too old.]

Test #62 in t9300-fast-import.sh is fixed by a separate patch (see email [PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure).

All of the remaining test failures are fixed by this patch!

This is an RFC because I have only run the above tests. In fact the original version of this patch was confined to git-submodule.sh (along with a uname conditional to restrict the definition to MinGW).

HTH

ATB,
Ramsay Jones

 git-sh-setup.sh |    4 ++++
 1 file changed, 4 insertions(+)
git-sh-setup.sh +4 -0
index 5d8e4e6..7b3ae75 100644
@@ -248,6 +248,10 @@ case $(uname -s) in
 	find () {
 		/usr/bin/find "$@"
 	}
+	# git sees Windows-style pwd
+	pwd () {
+		builtin pwd -W
+	}
 	is_absolute_path () {
 		case "$1" in
 		[/\\]* | [A-Za-z]:*)
Signature · 1 line
1.7.10
#1 lore raw

Am 17.04.2012 20:48, schrieb Ramsay Jones:

Quoted 78 lines

---

Hi Johannes,

While working on fixing git-submodule.sh on cygwin, I attempted to run tests on MinGW to ensure that my patches don't cause a regression. (Indeed that is the *only* reason I have MinGW installed!)

In order to test the modified git-submodule.sh I used the following tests:

    $ git grep -l -e 'git *submodule' -- t
    t/t5526-fetch-submodules.sh
    t/t6008-rev-list-submodule.sh
    t/t7003-filter-branch.sh
    t/t7400-submodule-basic.sh
    t/t7401-submodule-summary.sh
    t/t7403-submodule-sync.sh
    t/t7405-submodule-merge.sh
    t/t7406-submodule-update.sh
    t/t7407-submodule-foreach.sh
    t/t7408-submodule-reference.sh
    t/t7506-status-submodule.sh
    t/t7610-mergetool.sh
    t/t9300-fast-import.sh
    t/t9350-fast-export.sh

On MinGW, the following tests failed:

    t5526-fetch-submodules.sh:  1, 2, 5, 8-13, 16, 18-19, 21, 23-24
    t7400-submodule-basic.sh:   7
    t7401-submodule-summary.sh: 16
    t7405-submodule-merge.sh:   7-8
    t7406-submodule-update.sh:  3, 24-25, 30-31
    t7407-submodule-foreach.sh: 2, 5-10, 12-13
    t9300-fast-import.sh:       62

I noticed that 6 of those tests were failing due to CRLF line ending issues. For example, if you redirect the output of git-status to a file, then you will find that the lines output by git-submodule have CRLF line endings, while the remainder of the file has LF only. So, in order to ignore this (ie I don't have a patch to fix it!), if I run the tests something like this:

    $ GIT_TEST_CMP='diff -ub' ./t7400-submodule-basic.sh

then these tests pass. The tests in question being:

    t7400.7, t7401.16, t7405.{7,8}, t7406.3 and t7407.2

[Note that I wanted to use --strip-trailing-cr but the version of diff on MinGW was too old.]

Test #62 in t9300-fast-import.sh is fixed by a separate patch (see email [PATCH] compat/mingw.h: Set S_ISUID to prevent a fast-import test failure).

All of the remaining test failures are fixed by this patch!

This is an RFC because I have only run the above tests. In fact the original version of this patch was confined to git-submodule.sh (along with a uname conditional to restrict the definition to MinGW).

HTH

ATB,
Ramsay Jones

 git-sh-setup.sh |    4 ++++
 1 file changed, 4 insertions(+)
git-sh-setup.sh +0 -0
index 5d8e4e6..7b3ae75 100644

git-sh-setup.sh case $(uname -s) in · line 257

Quoted 10 lines
git-sh-setup.sh +4 -0
@@ -248,6 +248,10 @@ case $(uname -s) in
 	find () {
 		/usr/bin/find "$@"
 	}
+	# git sees Windows-style pwd
+	pwd () {
+		builtin pwd -W
+	}
 	is_absolute_path () {
 		case "$1" in
 		[/\\]* | [A-Za-z]:*)

The test suite passes with this patch. As I already said in a similar context on the msysgit mailing list[1], it looks like all occurrences of 'pwd' in the scripted git commands are exercised, so I trust this does not bring any regressions.

-- Hannes

[1]
http://thread.gmane.org/gmane.comp.version-control.msysgit/14894/focus=14970