All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/19] Let Git's tests pass on Windows
@ 2016-01-24 15:43 Johannes Schindelin
  2016-01-24 15:43 ` [PATCH 01/19] mingw: let's use gettext with MSYS2 Johannes Schindelin
                   ` (20 more replies)
  0 siblings, 21 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

This is a big milestone. With these modifications, Git's source code
does not only build without warnings in Git for Windows' SDK, but
passes the entire regression test suite.

The patch series contains three different types of patches. First,
there are a couple of real fixes that were triggered by failures in
the regression tests. Then there are a couple of fixes to the
regression tests themselves. And finally, we have to disable a couple
of tests because we simply cannot make them work on Windows.


Johannes Schindelin (13):
  mingw: let's use gettext with MSYS2
  mingw: do not trust MSYS2's MinGW gettext.sh
  Git.pm: stop assuming that absolute paths start with a slash
  mingw: prepare the TMPDIR environment variable for shell scripts
  mingw: let lstat() fail with errno == ENOTDIR when appropriate
  mingw: fix t5601-clone.sh
  mingw: accomodate t0060-path-utils for MSYS2
  mingw: disable mkfifo-based tests
  tests: turn off git-daemon tests if FIFOs are not available
  mingw: fix t9700's assumption about directory separators
  mingw: work around pwd issues in the tests
  mingw: skip a couple of git-svn tests that cannot pass on Windows
  mingw: do not bother to test funny file names

Karsten Blees (2):
  mingw: factor out Windows specific environment setup
  mingw: do not use symlinks with SVN in t9100

Pat Thoyts (1):
  mingw: avoid absolute path in t0008

Thomas Braun (1):
  mingw: outsmart MSYS2's path substitution in t1508

마누엘 (2):
  mingw: try to delete target directory before renaming
  mingw: fix git-svn tests that expect chmod to work

 Makefile                              |  1 +
 compat/mingw.c                        | 91 +++++++++++++++++++++++++++++------
 config.mak.uname                      |  3 +-
 perl/Git.pm                           |  3 +-
 t/lib-git-daemon.sh                   |  5 ++
 t/t0008-ignores.sh                    |  8 ++-
 t/t0060-path-utils.sh                 | 37 ++++++++------
 t/t1508-at-combinations.sh            | 13 ++++-
 t/t3300-funny-names.sh                |  1 +
 t/t3600-rm.sh                         |  3 +-
 t/t3703-add-magic-pathspec.sh         |  2 +-
 t/t3902-quoted.sh                     |  1 +
 t/t4016-diff-quote.sh                 |  1 +
 t/t4135-apply-weird-filenames.sh      |  3 +-
 t/t5601-clone.sh                      | 18 +++----
 t/t7800-difftool.sh                   | 14 +++---
 t/t9100-git-svn-basic.sh              | 29 +++++++----
 t/t9118-git-svn-funky-branch-names.sh | 12 +++--
 t/t9124-git-svn-dcommit-auto-props.sh | 20 ++++++--
 t/t9130-git-svn-authors-file.sh       |  2 +-
 t/t9200-git-cvsexportcommit.sh        |  2 +-
 t/t9400-git-cvsserver-server.sh       |  6 +--
 t/t9401-git-cvsserver-crlf.sh         |  6 +--
 t/t9402-git-cvsserver-refs.sh         |  6 +--
 t/t9700/test.pl                       |  2 +-
 t/t9903-bash-prompt.sh                |  2 +-
 t/test-lib.sh                         |  2 +-
 test-fake-ssh.c                       | 30 ++++++++++++
 28 files changed, 238 insertions(+), 85 deletions(-)
 create mode 100644 test-fake-ssh.c

-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH 01/19] mingw: let's use gettext with MSYS2
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
@ 2016-01-24 15:43 ` Johannes Schindelin
  2016-01-25  1:42   ` Junio C Hamano
  2016-01-24 15:43 ` [PATCH 02/19] mingw: do not trust MSYS2's MinGW gettext.sh Johannes Schindelin
                   ` (19 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This solves two problems:

- we now have proper localisation even on Windows

- we sidestep the infamous "BUG: your vsnprintf is broken (returned -1)"
  message when running "git init" (which otherwise prevents the entire
  test suite from running)

The latter issue is rather crucial, as *no* test passes in Git for
Windows without this fix.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mak.uname b/config.mak.uname
index 4b2e1b8..6b25661 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -560,7 +560,7 @@ else
 		NO_R_TO_GCC_LINKER = YesPlease
 		INTERNAL_QSORT = YesPlease
 		HAVE_LIBCHARSET_H = YesPlease
-		NO_GETTEXT = YesPlease
+		NO_GETTEXT =
 		USE_LIBPCRE= YesPlease
 		NO_CURL =
 		USE_NED_ALLOCATOR = YesPlease
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 02/19] mingw: do not trust MSYS2's MinGW gettext.sh
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
  2016-01-24 15:43 ` [PATCH 01/19] mingw: let's use gettext with MSYS2 Johannes Schindelin
@ 2016-01-24 15:43 ` Johannes Schindelin
  2016-01-24 15:43 ` [PATCH 03/19] Git.pm: stop assuming that absolute paths start with a slash Johannes Schindelin
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

It does not quite work because it produces DOS line endings which the
shell does not like at all.

This lets t0200-gettext-basic.sh, t0204-gettext-reencode-sanity.sh,
t3406-rebase-message.sh, t3903-stash.sh, t7400-submodule-basic.sh,
t7401-submodule-summary.sh, t7406-submodule-update.sh and
t7407-submodule-foreach.sh pass in Git for Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname | 1 +
 1 file changed, 1 insertion(+)

diff --git a/config.mak.uname b/config.mak.uname
index 6b25661..d6f7980 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -561,6 +561,7 @@ else
 		INTERNAL_QSORT = YesPlease
 		HAVE_LIBCHARSET_H = YesPlease
 		NO_GETTEXT =
+		USE_GETTEXT_SCHEME = fallthrough
 		USE_LIBPCRE= YesPlease
 		NO_CURL =
 		USE_NED_ALLOCATOR = YesPlease
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 03/19] Git.pm: stop assuming that absolute paths start with a slash
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
  2016-01-24 15:43 ` [PATCH 01/19] mingw: let's use gettext with MSYS2 Johannes Schindelin
  2016-01-24 15:43 ` [PATCH 02/19] mingw: do not trust MSYS2's MinGW gettext.sh Johannes Schindelin
@ 2016-01-24 15:43 ` Johannes Schindelin
  2016-01-24 15:43 ` [PATCH 04/19] mingw: factor out Windows specific environment setup Johannes Schindelin
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Windows, absolute paths never start with a slash, unless a POSIX
emulation layer is used. The latter is the case for MSYS2's Perl that
Git for Windows leverages. However, in the tests we also go through
plain `git.exe`, which does *not* leverage the POSIX emulation layer,
and therefore the paths we pass to Perl may actually be DOS-style paths
such as C:/Program Files/Git.

So let's just use Perl's own way to test whether a given path is
absolute or not instead of home-brewing our own.

This patch partially fixes t7800 and t9700 when running in Git for
Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 perl/Git.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/perl/Git.pm b/perl/Git.pm
index 19ef081..49eb88a 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -188,7 +188,8 @@ sub repository {
 		};
 
 		if ($dir) {
-			$dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir;
+			_verify_require();
+			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.
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 04/19] mingw: factor out Windows specific environment setup
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (2 preceding siblings ...)
  2016-01-24 15:43 ` [PATCH 03/19] Git.pm: stop assuming that absolute paths start with a slash Johannes Schindelin
@ 2016-01-24 15:43 ` Johannes Schindelin
  2016-01-24 15:43 ` [PATCH 05/19] mingw: prepare the TMPDIR environment variable for shell scripts Johannes Schindelin
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Karsten Blees, git

From: Karsten Blees <blees@dcon.de>

We will add more environment-related code to that new function
in the next patch.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 8437c9a..a12197e 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2040,6 +2040,22 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
 	return -1;
 }
 
+static void setup_windows_environment()
+{
+	/* on Windows it is TMP and TEMP */
+	if (!getenv("TMPDIR")) {
+		const char *tmp = getenv("TMP");
+		if (!tmp)
+			tmp = getenv("TEMP");
+		if (tmp)
+			setenv("TMPDIR", tmp, 1);
+	}
+
+	/* simulate TERM to enable auto-color (see color.c) */
+	if (!getenv("TERM"))
+		setenv("TERM", "cygwin", 1);
+}
+
 /*
  * Disable MSVCRT command line wildcard expansion (__getmainargs called from
  * mingw startup code, see init.c in mingw runtime).
@@ -2118,19 +2134,7 @@ void mingw_startup()
 	qsort(environ, i, sizeof(char*), compareenv);
 
 	/* fix Windows specific environment settings */
-
-	/* on Windows it is TMP and TEMP */
-	if (!mingw_getenv("TMPDIR")) {
-		const char *tmp = mingw_getenv("TMP");
-		if (!tmp)
-			tmp = mingw_getenv("TEMP");
-		if (tmp)
-			setenv("TMPDIR", tmp, 1);
-	}
-
-	/* simulate TERM to enable auto-color (see color.c) */
-	if (!getenv("TERM"))
-		setenv("TERM", "cygwin", 1);
+	setup_windows_environment();
 
 	/* initialize critical section for waitpid pinfo_t list */
 	InitializeCriticalSection(&pinfo_cs);
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 05/19] mingw: prepare the TMPDIR environment variable for shell scripts
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (3 preceding siblings ...)
  2016-01-24 15:43 ` [PATCH 04/19] mingw: factor out Windows specific environment setup Johannes Schindelin
@ 2016-01-24 15:43 ` Johannes Schindelin
  2016-01-25  2:11   ` Eric Sunshine
  2016-01-24 15:44 ` [PATCH 06/19] mingw: try to delete target directory before renaming Johannes Schindelin
                   ` (15 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

When shell scripts access a $TMPDIR variable containing backslashes,
they will be mistaken for escape characters. Let's not let that happen
by converting them to forward slashes.

This partially fixes t7800 with MSYS2.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index a12197e..db92f5d 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2042,13 +2042,28 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
 
 static void setup_windows_environment()
 {
+	char *tmp = getenv("TMPDIR");
+
 	/* on Windows it is TMP and TEMP */
-	if (!getenv("TMPDIR")) {
-		const char *tmp = getenv("TMP");
-		if (!tmp)
+	if (tmp) {
+		if (!(tmp = getenv("TMP")))
 			tmp = getenv("TEMP");
-		if (tmp)
+		if (tmp) {
 			setenv("TMPDIR", tmp, 1);
+			tmp = getenv("TMPDIR");
+		}
+	}
+
+	if (tmp) {
+		/*
+		 * Convert all dir separators to forward slashes,
+		 * to help shell commands called from the Git
+		 * executable (by not mistaking the dir separators
+		 * for escape characters).
+		 */
+		for (; *tmp; tmp++)
+			if (*tmp == '\\')
+				*tmp = '/';
 	}
 
 	/* simulate TERM to enable auto-color (see color.c) */
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 06/19] mingw: try to delete target directory before renaming
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (4 preceding siblings ...)
  2016-01-24 15:43 ` [PATCH 05/19] mingw: prepare the TMPDIR environment variable for shell scripts Johannes Schindelin
@ 2016-01-24 15:44 ` Johannes Schindelin
  2016-01-24 17:42   ` Philip Oakley
  2016-01-24 15:44 ` [PATCH 07/19] mingw: let lstat() fail with errno == ENOTDIR when appropriate Johannes Schindelin
                   ` (14 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

From: 마누엘 <nalla@users.noreply.github.com>

When the rename() function tries to move a directory it fails if the
target directory exists. It should check if it can delete the (possibly
empty) target directory and then try again to move the directory.

This partially fixes t9100-git-svn-basic.sh.

Signed-off-by: 마누엘 <nalla@users.noreply.github.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index db92f5d..e4839b9 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1603,7 +1603,12 @@ repeat:
 	if (gle == ERROR_ACCESS_DENIED &&
 	    (attrs = GetFileAttributesW(wpnew)) != INVALID_FILE_ATTRIBUTES) {
 		if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
-			errno = EISDIR;
+			DWORD attrsold = GetFileAttributesW(wpold);
+			if (attrsold == INVALID_FILE_ATTRIBUTES ||
+			    !(attrsold & FILE_ATTRIBUTE_DIRECTORY))
+				errno = EISDIR;
+			else if (!_wrmdir(wpnew))
+				goto repeat;
 			return -1;
 		}
 		if ((attrs & FILE_ATTRIBUTE_READONLY) &&
-- 
2.7.0.windows.1.7.g55a05c8


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 07/19] mingw: let lstat() fail with errno == ENOTDIR when appropriate
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (5 preceding siblings ...)
  2016-01-24 15:44 ` [PATCH 06/19] mingw: try to delete target directory before renaming Johannes Schindelin
@ 2016-01-24 15:44 ` Johannes Schindelin
  2016-01-24 15:44 ` [PATCH 08/19] mingw: fix t5601-clone.sh Johannes Schindelin
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

POSIX semantics requires lstat() to fail with ENOTDIR when "[a]
component of the path prefix names an existing file that is neither a
directory nor a symbolic link to a directory".

See http://pubs.opengroup.org/onlinepubs/9699919799/functions/lstat.html

This behavior is expected by t1404-update-ref-df-conflicts now.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/compat/mingw.c b/compat/mingw.c
index e4839b9..9e60335 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -454,6 +454,39 @@ static inline time_t filetime_to_time_t(const FILETIME *ft)
 	return (time_t)(filetime_to_hnsec(ft) / 10000000);
 }
 
+/**
+ * Verifies that safe_create_leading_directories() would succeed.
+ */
+static int has_valid_directory_prefix(wchar_t *wfilename)
+{
+	int n = wcslen(wfilename);
+
+	while (n > 0) {
+		wchar_t c = wfilename[--n];
+		DWORD attributes;
+
+		if (!is_dir_sep(c))
+			continue;
+
+		wfilename[n] = L'\0';
+		attributes = GetFileAttributesW(wfilename);
+		wfilename[n] = c;
+		if (attributes == FILE_ATTRIBUTE_DIRECTORY ||
+				attributes == FILE_ATTRIBUTE_DEVICE)
+			return 1;
+		if (attributes == INVALID_FILE_ATTRIBUTES)
+			switch (GetLastError()) {
+			case ERROR_PATH_NOT_FOUND:
+				continue;
+			case ERROR_FILE_NOT_FOUND:
+				/* This implies parent directory exists. */
+				return 1;
+			}
+		return 0;
+	}
+	return 1;
+}
+
 /* We keep the do_lstat code in a separate function to avoid recursion.
  * When a path ends with a slash, the stat will fail with ENOENT. In
  * this case, we strip the trailing slashes and stat again.
@@ -514,6 +547,12 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
 	case ERROR_NOT_ENOUGH_MEMORY:
 		errno = ENOMEM;
 		break;
+	case ERROR_PATH_NOT_FOUND:
+		if (!has_valid_directory_prefix(wfilename)) {
+			errno = ENOTDIR;
+			break;
+		}
+		/* fallthru */
 	default:
 		errno = ENOENT;
 		break;
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 08/19] mingw: fix t5601-clone.sh
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (6 preceding siblings ...)
  2016-01-24 15:44 ` [PATCH 07/19] mingw: let lstat() fail with errno == ENOTDIR when appropriate Johannes Schindelin
@ 2016-01-24 15:44 ` Johannes Schindelin
  2016-01-24 15:44 ` [PATCH 09/19] mingw: accomodate t0060-path-utils for MSYS2 Johannes Schindelin
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Since baaf233 (connect: improve check for plink to reduce false
positives, 2015-04-26), t5601 writes out a `plink.exe` for testing that
is actually a shell script. So the assumption that the `.exe` extension
implies that the file is *not* a shell script is now wrong.

Since there was no love for the idea of allowing `.exe` files to be
shell scripts on Windows, let's go the other way round: *make*
`plink.exe` a real `.exe`.

This fixes t5601-clone.sh in Git for Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile         |  1 +
 t/t5601-clone.sh | 18 ++++++++----------
 test-fake-ssh.c  | 30 ++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 10 deletions(-)
 create mode 100644 test-fake-ssh.c

diff --git a/Makefile b/Makefile
index fc2f1ab..10566d6 100644
--- a/Makefile
+++ b/Makefile
@@ -583,6 +583,7 @@ TEST_PROGRAMS_NEED_X += test-delta
 TEST_PROGRAMS_NEED_X += test-dump-cache-tree
 TEST_PROGRAMS_NEED_X += test-dump-split-index
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
+TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-genrandom
 TEST_PROGRAMS_NEED_X += test-hashmap
 TEST_PROGRAMS_NEED_X += test-index-version
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 669ec9b..2f4272a 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -4,6 +4,9 @@ test_description=clone
 
 . ./test-lib.sh
 
+X=
+! test_have_prereq MINGW || X=.exe
+
 test_expect_success setup '
 
 	rm -fr .git &&
@@ -305,14 +308,9 @@ test_expect_success 'clone checking out a tag' '
 
 setup_ssh_wrapper () {
 	test_expect_success 'setup ssh wrapper' '
-		write_script "$TRASH_DIRECTORY/ssh-wrapper" <<-\EOF &&
-		echo >>"$TRASH_DIRECTORY/ssh-output" "ssh: $*" &&
-		# throw away all but the last argument, which should be the
-		# command
-		while test $# -gt 1; do shift; done
-		eval "$1"
-		EOF
-		GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
+		cp "$GIT_BUILD_DIR/test-fake-ssh$X" \
+			"$TRASH_DIRECTORY/ssh-wrapper$X" &&
+		GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper$X" &&
 		export GIT_SSH &&
 		export TRASH_DIRECTORY &&
 		>"$TRASH_DIRECTORY"/ssh-output
@@ -320,8 +318,8 @@ setup_ssh_wrapper () {
 }
 
 copy_ssh_wrapper_as () {
-	cp "$TRASH_DIRECTORY/ssh-wrapper" "$1" &&
-	GIT_SSH="$1" &&
+	cp "$TRASH_DIRECTORY/ssh-wrapper$X" "${1%$X}$X" &&
+	GIT_SSH="${1%$X}$X" &&
 	export GIT_SSH
 }
 
diff --git a/test-fake-ssh.c b/test-fake-ssh.c
new file mode 100644
index 0000000..980de21
--- /dev/null
+++ b/test-fake-ssh.c
@@ -0,0 +1,30 @@
+#include "git-compat-util.h"
+#include "run-command.h"
+#include "strbuf.h"
+
+int main(int argc, char **argv)
+{
+	const char *trash_directory = getenv("TRASH_DIRECTORY");
+	struct strbuf buf = STRBUF_INIT;
+	FILE *f;
+	int i;
+	const char *child_argv[] = { NULL, NULL };
+
+	/* First, print all parameters into $TRASH_DIRECTORY/ssh-output */
+	if (!trash_directory)
+		die("Need a TRASH_DIRECTORY!");
+	strbuf_addf(&buf, "%s/ssh-output", trash_directory);
+	f = fopen(buf.buf, "w");
+	if (!f)
+		die("Could not write to %s", buf.buf);
+	for (i = 0; i < argc; i++)
+		fprintf(f, "%s%s", i > 0 ? " " : "", i > 0 ? argv[i] : "ssh:");
+	fprintf(f, "\n");
+	fclose(f);
+
+	/* Now, evaluate the *last* parameter */
+	if (argc < 2)
+		return 0;
+	child_argv[0] = argv[argc - 1];
+	return run_command_v_opt(child_argv, RUN_USING_SHELL);
+}
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 09/19] mingw: accomodate t0060-path-utils for MSYS2
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (7 preceding siblings ...)
  2016-01-24 15:44 ` [PATCH 08/19] mingw: fix t5601-clone.sh Johannes Schindelin
@ 2016-01-24 15:44 ` Johannes Schindelin
  2016-01-24 19:51   ` Johannes Sixt
  2016-01-24 15:44 ` [PATCH 10/19] mingw: disable mkfifo-based tests Johannes Schindelin
                   ` (11 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Windows, there are no POSIX paths, only Windows ones (an absolute
Windows path looks like "C:\Program Files\Git\ReleaseNotes.html", under
most circumstances, forward slashes are also allowed and synonymous to
backslashes).

So when a POSIX shell (such as MSYS2's Bash, which is used by Git for
Windows to execute all those shell scripts that are part of Git) passes
a POSIX path to test-path-utils.exe (which is not POSIX-aware), the path
is translated into a Windows path. For example, /etc/profile becomes
C:/Program Files/Git/etc/profile.

This path translation poses a problem when passing the root directory as
parameter to test-path-utils.exe, as it is not well defined whether the
translated root directory should end in a slash or not. MSys1 stripped
the trailing slash, but MSYS2 does not.

To work with both behaviors, we simply test what the current system does
in the beginning of t0060-path-utils.sh and then adjust the expected
longest ancestor length accordingly.

Originally, the Git for Windows project patched MSYS2's runtime to
accomodate Git's regression test, but we really should do it the other
way round.

Thanks to Ray Donnelly for his patient help with this issue.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t0060-path-utils.sh | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index f0152a7..89d03e7 100755
--- a/t/t0060-path-utils.sh
+++ b/t/t0060-path-utils.sh
@@ -7,6 +7,13 @@ test_description='Test various path utilities'
 
 . ./test-lib.sh
 
+# On Windows, the root directory "/" is translated into a Windows directory.
+# As it is not well-defined whether that Windows directory should end in a
+# slash or not, let's test for that and adjust our expected longest ancestor
+# length accordingly.
+root_offset=0
+case "$(test-path-utils print_path /)" in ?*/) root_offset=-1;; esac
+
 norm_path() {
 	expected=$(test-path-utils print_path "$2")
 	test_expect_success $3 "normalize path: $1 => $2" \
@@ -112,30 +119,30 @@ norm_path /d1/.../d2 /d1/.../d2
 norm_path /d1/..././../d2 /d1/d2
 
 ancestor / / -1
-ancestor /foo / 0
+ancestor /foo / $root_offset
 ancestor /foo /fo -1
 ancestor /foo /foo -1
 ancestor /foo /bar -1
 ancestor /foo /foo/bar -1
 ancestor /foo /foo:/bar -1
-ancestor /foo /:/foo:/bar 0
-ancestor /foo /foo:/:/bar 0
-ancestor /foo /:/bar:/foo 0
-ancestor /foo/bar / 0
+ancestor /foo /:/foo:/bar $root_offset
+ancestor /foo /foo:/:/bar $root_offset
+ancestor /foo /:/bar:/foo $root_offset
+ancestor /foo/bar / $root_offset
 ancestor /foo/bar /fo -1
-ancestor /foo/bar /foo 4
+ancestor /foo/bar /foo $((4+$root_offset))
 ancestor /foo/bar /foo/ba -1
-ancestor /foo/bar /:/fo 0
-ancestor /foo/bar /foo:/foo/ba 4
+ancestor /foo/bar /:/fo $root_offset
+ancestor /foo/bar /foo:/foo/ba $((4+$root_offset))
 ancestor /foo/bar /bar -1
 ancestor /foo/bar /fo -1
-ancestor /foo/bar /foo:/bar 4
-ancestor /foo/bar /:/foo:/bar 4
-ancestor /foo/bar /foo:/:/bar 4
-ancestor /foo/bar /:/bar:/fo 0
-ancestor /foo/bar /:/bar 0
-ancestor /foo/bar /foo 4
-ancestor /foo/bar /foo:/bar 4
+ancestor /foo/bar /foo:/bar $((4+$root_offset))
+ancestor /foo/bar /:/foo:/bar $((4+$root_offset))
+ancestor /foo/bar /foo:/:/bar $((4+$root_offset))
+ancestor /foo/bar /:/bar:/fo $root_offset
+ancestor /foo/bar /:/bar $root_offset
+ancestor /foo/bar /foo $((4+$root_offset))
+ancestor /foo/bar /foo:/bar $((4+$root_offset))
 ancestor /foo/bar /bar -1
 
 test_expect_success 'strip_path_suffix' '
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 10/19] mingw: disable mkfifo-based tests
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (8 preceding siblings ...)
  2016-01-24 15:44 ` [PATCH 09/19] mingw: accomodate t0060-path-utils for MSYS2 Johannes Schindelin
@ 2016-01-24 15:44 ` Johannes Schindelin
  2016-01-24 15:44 ` [PATCH 11/19] tests: turn off git-daemon tests if FIFOs are not available Johannes Schindelin
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

MSYS2 (the POSIX emulation layer used by Git for Windows' Bash) actually
has a working mkfifo. The only problem is that it is only emulating
named pipes through the MSYS2 runtime; The Win32 API has no idea about
named pipes, hence the Git executable cannot access those pipes either.

The symptom is that Git fails with a '<name>: No such file or directory'
because MSYS2 emulates named pipes through special-crafted '.lnk' files.

The solution is to tell the test suite explicitly that we cannot use
named pipes when we want to test on Windows.

This lets t4056-diff-order.sh, t9010-svn-fe.sh and t9300-fast-import.sh
pass.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/test-lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index bd4b02e..1470c8d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -998,7 +998,7 @@ test_i18ngrep () {
 test_lazy_prereq PIPE '
 	# test whether the filesystem supports FIFOs
 	case $(uname -s) in
-	CYGWIN*)
+	CYGWIN*|MINGW*)
 		false
 		;;
 	*)
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 11/19] tests: turn off git-daemon tests if FIFOs are not available
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (9 preceding siblings ...)
  2016-01-24 15:44 ` [PATCH 10/19] mingw: disable mkfifo-based tests Johannes Schindelin
@ 2016-01-24 15:44 ` Johannes Schindelin
  2016-01-24 15:45 ` [PATCH 12/19] mingw: do not use symlinks with SVN in t9100 Johannes Schindelin
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

The Git daemon tests create a FIFO first thing and will hang if said
FIFO is not available.

This is a problem with Git for Windows, where `mkfifo` is an MSYS2
program that leverages MSYS2's POSIX emulation layer, but
`git-daemon.exe` is a MINGW program that has not the first clue about
that POSIX emulation layer and therefore blinks twice when it sees
MSYS2's emulated FIFOs and then just stares into space.

This lets t5570-git-daemon.sh and t5811-proto-disable-git.sh pass.

Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/lib-git-daemon.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh
index bc4b341..9b1271c 100644
--- a/t/lib-git-daemon.sh
+++ b/t/lib-git-daemon.sh
@@ -23,6 +23,11 @@ then
 	test_done
 fi
 
+if ! test_have_prereq PIPE
+then
+	test_skip_or_die $GIT_TEST_GIT_DAEMON "file system does not support FIFOs"
+fi
+
 LIB_GIT_DAEMON_PORT=${LIB_GIT_DAEMON_PORT-${this_test#t}}
 
 GIT_DAEMON_PID=
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 12/19] mingw: do not use symlinks with SVN in t9100
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (10 preceding siblings ...)
  2016-01-24 15:44 ` [PATCH 11/19] tests: turn off git-daemon tests if FIFOs are not available Johannes Schindelin
@ 2016-01-24 15:45 ` Johannes Schindelin
  2016-01-25  1:51   ` Junio C Hamano
  2016-01-24 15:45 ` [PATCH 13/19] mingw: outsmart MSYS2's path substitution in t1508 Johannes Schindelin
                   ` (8 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Karsten Blees, git

From: Karsten Blees <blees@dcon.de>

The SVN library does not seem to support symlinks, even if symlinks are
enabled in MSYS2 and Git. Use 'cp' instead of 'ln -s'.

This partially fixes t/t9100-git-svn-basic.sh

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9100-git-svn-basic.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 258d9b8..dbb440b 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -25,7 +25,14 @@ test_expect_success \
 	(
 		cd import &&
 		echo foo >foo &&
-		ln -s foo foo.link
+		if test_have_prereq !MINGW
+		then
+			ln -s foo foo.link
+		else
+			# MSYS libsvn does not support symlinks, so always use cp, even if
+			# ln -s actually works
+			cp foo foo.link
+		fi
 		mkdir -p dir/a/b/c/d/e &&
 		echo "deep dir" >dir/a/b/c/d/e/file &&
 		mkdir bar &&
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 13/19] mingw: outsmart MSYS2's path substitution in t1508
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (11 preceding siblings ...)
  2016-01-24 15:45 ` [PATCH 12/19] mingw: do not use symlinks with SVN in t9100 Johannes Schindelin
@ 2016-01-24 15:45 ` Johannes Schindelin
  2016-01-25  2:03   ` Junio C Hamano
  2016-01-24 15:45 ` [PATCH 14/19] mingw: fix t9700's assumption about directory separators Johannes Schindelin
                   ` (7 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Braun, git

From: Thomas Braun <thomas.braun@byte-physics.de>

A string of the form "@/abcd" is considered a file path
by the msys layer and therefore translated to a Windows path.

Here the trick is to double the slashes.

The MSYS2 patch translation can be studied by calling

	test-path-utils print_path <path>

Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t1508-at-combinations.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
index 078e119..1d9fd7b 100755
--- a/t/t1508-at-combinations.sh
+++ b/t/t1508-at-combinations.sh
@@ -29,13 +29,22 @@ fail() {
 	"$@" failure
 }
 
+if test_have_prereq MINGW
+then
+	# MSYS2 interprets `@/abc` to be a file list, and wants to substitute
+	# the Unix-y path with a Windows one (e.g. @C:\msys64\abc)
+	AT_SLASH=@//at-test
+else
+	AT_SLASH=@/at-test
+fi
+
 test_expect_success 'setup' '
 	test_commit master-one &&
 	test_commit master-two &&
 	git checkout -b upstream-branch &&
 	test_commit upstream-one &&
 	test_commit upstream-two &&
-	git checkout -b @/at-test &&
+	git checkout -b $AT_SLASH &&
 	git checkout -b @@/at-test &&
 	git checkout -b @at-test &&
 	git checkout -b old-branch &&
@@ -64,7 +73,7 @@ check "@{-1}@{u}@{1}" commit master-one
 check "@" commit new-two
 check "@@{u}" ref refs/heads/upstream-branch
 check "@@/at-test" ref refs/heads/@@/at-test
-check "@/at-test" ref refs/heads/@/at-test
+check "$AT_SLASH" ref refs/heads/@/at-test
 check "@at-test" ref refs/heads/@at-test
 nonsense "@{u}@{-1}"
 nonsense "@{0}@{0}"
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 14/19] mingw: fix t9700's assumption about directory separators
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (12 preceding siblings ...)
  2016-01-24 15:45 ` [PATCH 13/19] mingw: outsmart MSYS2's path substitution in t1508 Johannes Schindelin
@ 2016-01-24 15:45 ` Johannes Schindelin
  2016-01-24 15:45 ` [PATCH 15/19] mingw: work around pwd issues in the tests Johannes Schindelin
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This test assumed that there is only one directory separator (the
forward slash), not two equivalent directory separators.
However, on Windows, the back slash and the forward slash *are*
equivalent.

Let's paper over this issue by converting the backward slashes to
forward ones in the test that fails with MSYS2 otherwise.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9700/test.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index 1140767..7e8c40b 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -33,7 +33,7 @@ is($r->config_int("test.int"), 2048, "config_int: integer");
 is($r->config_int("test.nonexistent"), undef, "config_int: nonexistent");
 ok($r->config_bool("test.booltrue"), "config_bool: true");
 ok(!$r->config_bool("test.boolfalse"), "config_bool: false");
-is($r->config_path("test.path"), $r->config("test.pathexpanded"),
+is($r->config_path("test.path") =~ s/\\/\//gr, $r->config("test.pathexpanded"),
    "config_path: ~/foo expansion");
 is_deeply([$r->config_path("test.pathmulti")], ["foo", "bar"],
    "config_path: multiple values");
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 15/19] mingw: work around pwd issues in the tests
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (13 preceding siblings ...)
  2016-01-24 15:45 ` [PATCH 14/19] mingw: fix t9700's assumption about directory separators Johannes Schindelin
@ 2016-01-24 15:45 ` Johannes Schindelin
  2016-01-24 15:45 ` [PATCH 16/19] mingw: avoid absolute path in t0008 Johannes Schindelin
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

In Git for Windows' SDK, the tests are run using a Bash that relies on
the POSIX emulation layer MSYS2 (itself a friendly fork of Cygwin). As
such, paths in tests can be POSIX paths. As soon as those paths are
passed to git.exe (which does *not* use the POSIX emulation layer),
those paths are converted into Windows paths, though. This happens
for command-line parameters, but not when reading, say, config variables.

To help with that, the `pwd` command is overridden to return the Windows
path of the current working directory when testing Git on Windows.

However, when talking to anything using the POSIX emulation layer, it is
really much better to use POSIX paths because Windows paths contain a
colon after the drive letter that will easily be mistaken for the common
separator in path lists.

So let's just use the $PWD variable when the POSIX path is needed.

This lets t7800-difftool.sh, t9400-git-cvsserver-server.sh,
t9402-git-cvsserver-refs.sh and t9401-git-cvsserver-crlf.sh pass in Git
for Windows' SDK.

Note: the cvsserver tests require not only the `cvs` package (install
it into Git for Windows' SDK via `pacman -S cvs`) but also the Perl
SQLite bindings (install them into Git for Windows' SDK via
`cpan DBD::SQLite`).

This patch is based on earlier work by 마누엘 and Karsten Blees.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t7800-difftool.sh             | 14 +++++++-------
 t/t9400-git-cvsserver-server.sh |  6 +++---
 t/t9401-git-cvsserver-crlf.sh   |  6 +++---
 t/t9402-git-cvsserver-refs.sh   |  6 +++---
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index ec8bc8c..4e713f7 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -430,11 +430,11 @@ EOF
 test_expect_success PERL,SYMLINKS 'difftool --dir-diff --symlink without unstaged changes' '
 	cat >expect <<-EOF &&
 	file
-	$(pwd)/file
+	$PWD/file
 	file2
-	$(pwd)/file2
+	$PWD/file2
 	sub/sub
-	$(pwd)/sub/sub
+	$PWD/sub/sub
 	EOF
 	git difftool --dir-diff --symlink \
 		--extcmd "./.git/CHECK_SYMLINKS" branch HEAD &&
@@ -448,14 +448,14 @@ EOF
 run_dir_diff_test 'difftool --dir-diff syncs worktree with unstaged change' '
 	test_when_finished git reset --hard &&
 	echo "orig content" >file &&
-	git difftool -d $symlinks --extcmd "$(pwd)/modify-right-file" branch &&
+	git difftool -d $symlinks --extcmd "$PWD/modify-right-file" branch &&
 	echo "new content" >expect &&
 	test_cmp expect file
 '
 
 run_dir_diff_test 'difftool --dir-diff syncs worktree without unstaged change' '
 	test_when_finished git reset --hard &&
-	git difftool -d $symlinks --extcmd "$(pwd)/modify-right-file" branch &&
+	git difftool -d $symlinks --extcmd "$PWD/modify-right-file" branch &&
 	echo "new content" >expect &&
 	test_cmp expect file
 '
@@ -466,7 +466,7 @@ EOF
 
 test_expect_success PERL 'difftool --no-symlinks does not overwrite working tree file ' '
 	echo "orig content" >file &&
-	git difftool --dir-diff --no-symlinks --extcmd "$(pwd)/modify-file" branch &&
+	git difftool --dir-diff --no-symlinks --extcmd "$PWD/modify-file" branch &&
 	echo "new content" >expect &&
 	test_cmp expect file
 '
@@ -482,7 +482,7 @@ test_expect_success PERL 'difftool --no-symlinks detects conflict ' '
 		TMPDIR=$TRASH_DIRECTORY &&
 		export TMPDIR &&
 		echo "orig content" >file &&
-		test_must_fail git difftool --dir-diff --no-symlinks --extcmd "$(pwd)/modify-both-files" branch &&
+		test_must_fail git difftool --dir-diff --no-symlinks --extcmd "$PWD/modify-both-files" branch &&
 		echo "wt content" >expect &&
 		test_cmp expect file &&
 		echo "tmp content" >expect &&
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 6146c3f..d708cbf 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -25,11 +25,11 @@ perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
     test_done
 }
 
-WORKDIR=$(pwd)
-SERVERDIR=$(pwd)/gitcvs.git
+WORKDIR=$PWD
+SERVERDIR=$PWD/gitcvs.git
 git_config="$SERVERDIR/config"
 CVSROOT=":fork:$SERVERDIR"
-CVSWORK="$(pwd)/cvswork"
+CVSWORK="$PWD/cvswork"
 CVS_SERVER=git-cvsserver
 export CVSROOT CVS_SERVER
 
diff --git a/t/t9401-git-cvsserver-crlf.sh b/t/t9401-git-cvsserver-crlf.sh
index 5a4ed28..f324b9f 100755
--- a/t/t9401-git-cvsserver-crlf.sh
+++ b/t/t9401-git-cvsserver-crlf.sh
@@ -74,11 +74,11 @@ perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
 }
 
 unset GIT_DIR GIT_CONFIG
-WORKDIR=$(pwd)
-SERVERDIR=$(pwd)/gitcvs.git
+WORKDIR=$PWD
+SERVERDIR=$PWD/gitcvs.git
 git_config="$SERVERDIR/config"
 CVSROOT=":fork:$SERVERDIR"
-CVSWORK="$(pwd)/cvswork"
+CVSWORK="$PWD/cvswork"
 CVS_SERVER=git-cvsserver
 export CVSROOT CVS_SERVER
 
diff --git a/t/t9402-git-cvsserver-refs.sh b/t/t9402-git-cvsserver-refs.sh
index d00df08..6d2d3c8 100755
--- a/t/t9402-git-cvsserver-refs.sh
+++ b/t/t9402-git-cvsserver-refs.sh
@@ -82,11 +82,11 @@ perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
 }
 
 unset GIT_DIR GIT_CONFIG
-WORKDIR=$(pwd)
-SERVERDIR=$(pwd)/gitcvs.git
+WORKDIR=$PWD
+SERVERDIR=$PWD/gitcvs.git
 git_config="$SERVERDIR/config"
 CVSROOT=":fork:$SERVERDIR"
-CVSWORK="$(pwd)/cvswork"
+CVSWORK="$PWD/cvswork"
 CVS_SERVER=git-cvsserver
 export CVSROOT CVS_SERVER
 
-- 
2.7.0.windows.1.7.g55a05c8


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 16/19] mingw: avoid absolute path in t0008
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (14 preceding siblings ...)
  2016-01-24 15:45 ` [PATCH 15/19] mingw: work around pwd issues in the tests Johannes Schindelin
@ 2016-01-24 15:45 ` Johannes Schindelin
  2016-01-25  2:11   ` Junio C Hamano
  2016-01-24 15:45 ` [PATCH 17/19] mingw: fix git-svn tests that expect chmod to work Johannes Schindelin
                   ` (4 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Pat Thoyts, git

From: Pat Thoyts <patthoyts@users.sourceforge.net>

The test separator char is a colon which means any absolute paths on
Windows confuse the tests that use global_excludes.

Suggested-by: Karsten Blees <karsten.blees@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t0008-ignores.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
index 4ef5ed4..68749f5 100755
--- a/t/t0008-ignores.sh
+++ b/t/t0008-ignores.sh
@@ -5,7 +5,13 @@ test_description=check-ignore
 . ./test-lib.sh
 
 init_vars () {
-	global_excludes="$(pwd)/global-excludes"
+	# On Windows, avoid using "C:" in the global-excludes paths.
+	if test_have_prereq MINGW
+	then
+		global_excludes="global-excludes"
+	else
+		global_excludes="$(pwd)/global-excludes"
+	fi
 }
 
 enable_global_excludes () {
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 17/19] mingw: fix git-svn tests that expect chmod to work
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (15 preceding siblings ...)
  2016-01-24 15:45 ` [PATCH 16/19] mingw: avoid absolute path in t0008 Johannes Schindelin
@ 2016-01-24 15:45 ` Johannes Schindelin
  2016-01-25  2:14   ` Junio C Hamano
  2016-01-24 15:45 ` [PATCH 18/19] mingw: skip a couple of git-svn tests that cannot pass on Windows Johannes Schindelin
                   ` (3 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

From: 마누엘 <nalla@users.noreply.github.com>

Some git-svn tests expect that the executable bit of files can be
toggled. On Windows, this is not possible because Windows' Access
Control Lists are much more fine-grained than the POSIX permission
concept. Let's just not try to flip the executable bit.

This lets t9118-git-svn-funky-branch-names.sh and
t9124-git-svn-dcommit-auto-props.sh pass in Git for Windows' SDK,
and partially fixes t9100-git-svn-basic.sh.

Signed-off-by: 마누엘 <nalla@users.noreply.github.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9100-git-svn-basic.sh              |  5 ++++-
 t/t9118-git-svn-funky-branch-names.sh | 12 +++++++++---
 t/t9124-git-svn-dcommit-auto-props.sh | 20 ++++++++++++++++----
 3 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index dbb440b..bca7ec8 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -38,7 +38,10 @@ test_expect_success \
 		mkdir bar &&
 		echo "zzz" >bar/zzz &&
 		echo "#!/bin/sh" >exec.sh &&
-		chmod +x exec.sh &&
+		{
+			test_have_prereq !POSIXPERM ||
+			chmod +x exec.sh
+		} &&
 		svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null
 	) &&
 	rm -rf import &&
diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh
index a221915..49775a5 100755
--- a/t/t9118-git-svn-funky-branch-names.sh
+++ b/t/t9118-git-svn-funky-branch-names.sh
@@ -23,8 +23,11 @@ test_expect_success 'setup svnrepo' '
 	              "$svnrepo/pr ject/branches/$scary_uri" &&
 	svn_cmd cp -m "leading dot" "$svnrepo/pr ject/trunk" \
 			"$svnrepo/pr ject/branches/.leading_dot" &&
-	svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
-			"$svnrepo/pr ject/branches/trailing_dot." &&
+	{
+		test_have_prereq MINGW ||
+		svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
+			"$svnrepo/pr ject/branches/trailing_dot."
+	} &&
 	svn_cmd cp -m "trailing .lock" "$svnrepo/pr ject/trunk" \
 			"$svnrepo/pr ject/branches/trailing_dotlock.lock" &&
 	svn_cmd cp -m "reflog" "$svnrepo/pr ject/trunk" \
@@ -45,7 +48,10 @@ test_expect_success 'test clone with funky branch names' '
 		git rev-parse "refs/remotes/origin/more%20fun%20plugin!" &&
 		git rev-parse "refs/remotes/origin/$scary_ref" &&
 		git rev-parse "refs/remotes/origin/%2Eleading_dot" &&
-		git rev-parse "refs/remotes/origin/trailing_dot%2E" &&
+		{
+			test_have_prereq MINGW ||
+			git rev-parse "refs/remotes/origin/trailing_dot%2E"
+		} &&
 		git rev-parse "refs/remotes/origin/trailing_dotlock%2Elock" &&
 		git rev-parse "refs/remotes/origin/$non_reflog"
 	)
diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh
index aa841e1..c851121 100755
--- a/t/t9124-git-svn-dcommit-auto-props.sh
+++ b/t/t9124-git-svn-dcommit-auto-props.sh
@@ -35,7 +35,10 @@ test_expect_success 'enable auto-props config' '
 
 test_expect_success 'add files matching auto-props' '
 	echo "#!$SHELL_PATH" >exec1.sh &&
-	chmod +x exec1.sh &&
+	{
+		test_have_prereq !POSIXPERM ||
+		chmod +x exec1.sh
+	} &&
 	echo "hello" >hello.txt &&
 	echo bar >bar &&
 	git add exec1.sh hello.txt bar &&
@@ -49,7 +52,10 @@ test_expect_success 'disable auto-props config' '
 
 test_expect_success 'add files matching disabled auto-props' '
 	echo "#$SHELL_PATH" >exec2.sh &&
-	chmod +x exec2.sh &&
+	{
+		test_have_prereq !POSIXPERM ||
+		chmod +x exec2.sh
+	} &&
 	echo "world" >world.txt &&
 	echo zot >zot &&
 	git add exec2.sh world.txt zot &&
@@ -65,7 +71,10 @@ test_expect_success 'check resulting svn repository' '
 	cd svnrepo &&
 
 	# Check properties from first commit.
-	test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*" &&
+	{
+		test_have_prereq !POSIXPERM ||
+		test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*"
+	} &&
 	test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \
 	     "xapplication/x-shellscript" &&
 	test "x$(svn_cmd propget svn:mime-type hello.txt)" = "xtext/plain" &&
@@ -73,7 +82,10 @@ test_expect_success 'check resulting svn repository' '
 	test "x$(svn_cmd propget svn:mime-type bar)" = "x" &&
 
 	# Check properties from second commit.
-	test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*" &&
+	{
+		test_have_prereq !POSIXPERM ||
+		test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*"
+	} &&
 	test "x$(svn_cmd propget svn:mime-type exec2.sh)" = "x" &&
 	test "x$(svn_cmd propget svn:mime-type world.txt)" = "x" &&
 	test "x$(svn_cmd propget svn:eol-style world.txt)" = "x" &&
-- 
2.7.0.windows.1.7.g55a05c8


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 18/19] mingw: skip a couple of git-svn tests that cannot pass on Windows
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (16 preceding siblings ...)
  2016-01-24 15:45 ` [PATCH 17/19] mingw: fix git-svn tests that expect chmod to work Johannes Schindelin
@ 2016-01-24 15:45 ` Johannes Schindelin
  2016-01-25  2:16   ` Junio C Hamano
  2016-01-24 15:45 ` [PATCH 19/19] mingw: do not bother to test funny file names Johannes Schindelin
                   ` (2 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=X-UNKNOWN, Size: 3241 bytes --]

Some of the tests expect that executable bits can be toggled, others
expect that paths are POSIX paths (but when they come through git.exe,
they are converted into Windows paths and necessarily differ), yet
others expect symbolic links to be available.

This lets t9100-git-svn-basic.sh and t9130-git-svn-authors-file.sh pass
in Git for Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9100-git-svn-basic.sh        | 15 +++++++--------
 t/t9130-git-svn-authors-file.sh |  2 +-
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index bca7ec8..8c74ffa 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -127,7 +127,7 @@ test_expect_success "$name" '
 
 
 name='remove executable bit from a file'
-test_expect_success "$name" '
+test_expect_success !MINGW "$name" '
 	rm -f "$GIT_DIR"/index &&
 	git checkout -f -b mybranch5 ${remotes_git_svn} &&
 	chmod -x exec.sh &&
@@ -140,7 +140,7 @@ test_expect_success "$name" '
 
 
 name='add executable bit back file'
-test_expect_success "$name" '
+test_expect_success !MINGW "$name" '
 	chmod +x exec.sh &&
 	git update-index exec.sh &&
 	git commit -m "$name" &&
@@ -151,7 +151,7 @@ test_expect_success "$name" '
 
 
 name='executable file becomes a symlink to file'
-test_expect_success "$name" '
+test_expect_success !MINGW "$name" '
 	rm exec.sh &&
 	ln -s file exec.sh &&
 	git update-index exec.sh &&
@@ -163,8 +163,7 @@ test_expect_success "$name" '
 
 name='new symlink is added to a file that was also just made executable'
 
-test_expect_success "$name" '
-	chmod +x file &&
+test_expect_success !MINGW "$name" '
 	ln -s file exec-2.sh &&
 	git update-index --add file exec-2.sh &&
 	git commit -m "$name" &&
@@ -175,7 +174,7 @@ test_expect_success "$name" '
 	test -h "$SVN_TREE"/exec-2.sh'
 
 name='modify a symlink to become a file'
-test_expect_success "$name" '
+test_expect_success !MINGW "$name" '
 	echo git help >help &&
 	rm exec-2.sh &&
 	cp help exec-2.sh &&
@@ -191,7 +190,7 @@ test_expect_success "$name" '
 name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
 LC_ALL="$GIT_SVN_LC_ALL"
 export LC_ALL
-test_expect_success UTF8 "$name" "
+test_expect_success !MINGW,UTF8 "$name" "
 	echo '# hello' >> exec-2.sh &&
 	git update-index exec-2.sh &&
 	git commit -m '???????' &&
@@ -224,7 +223,7 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
 tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4
 EOF
 
-test_expect_success "$name" "test_cmp a expected"
+test_expect_success !MINGW "$name" "test_cmp a expected"
 
 test_expect_success 'exit if remote refs are ambigious' "
         git config --add svn-remote.svn.fetch \
diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh
index d306b77..4126481 100755
--- a/t/t9130-git-svn-authors-file.sh
+++ b/t/t9130-git-svn-authors-file.sh
@@ -91,7 +91,7 @@ test_expect_success 'fetch continues after authors-file is fixed' '
 	)
 	'
 
-test_expect_success 'fresh clone with svn.authors-file in config' '
+test_expect_success !MINGW 'fresh clone with svn.authors-file in config' '
 	(
 		rm -r "$GIT_DIR" &&
 		test x = x"$(git config svn.authorsfile)" &&
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH 19/19] mingw: do not bother to test funny file names
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (17 preceding siblings ...)
  2016-01-24 15:45 ` [PATCH 18/19] mingw: skip a couple of git-svn tests that cannot pass on Windows Johannes Schindelin
@ 2016-01-24 15:45 ` Johannes Schindelin
  2016-01-25  1:34 ` [PATCH 00/19] Let Git's tests pass on Windows Junio C Hamano
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-24 15:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=X-UNKNOWN, Size: 4398 bytes --]

MSYS2 actually allows to create files or directories whose names contain
tabs, newlines or colors, even if plain Win32 API cannot access them.
As we are using an MSYS2 bash to run the tests, such files or
directories are created successfully, but Git itself has no chance to
work with them because it is a regular Windows program, hence limited by
the Win32 API.

With this change, on Windows otherwise failing tests in
t3300-funny-names.sh, t3600-rm.sh, t3703-add-magic-pathspec.sh,
t3902-quoted.sh, t4016-diff-quote.sh, t4135-apply-weird-filenames.sh,
t9200-git-cvsexportcommit.sh, and t9903-bash-prompt.sh are skipped.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t3300-funny-names.sh           | 1 +
 t/t3600-rm.sh                    | 3 ++-
 t/t3703-add-magic-pathspec.sh    | 2 +-
 t/t3902-quoted.sh                | 1 +
 t/t4016-diff-quote.sh            | 1 +
 t/t4135-apply-weird-filenames.sh | 3 ++-
 t/t9200-git-cvsexportcommit.sh   | 2 +-
 t/t9903-bash-prompt.sh           | 2 +-
 8 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh
index 9a146f1..04de03c 100755
--- a/t/t3300-funny-names.sh
+++ b/t/t3300-funny-names.sh
@@ -13,6 +13,7 @@ tree, index, and tree objects.
 
 HT='	'
 
+test_have_prereq MINGW ||
 echo 2>/dev/null > "Name with an${HT}HT"
 if ! test -f "Name with an${HT}HT"
 then
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 2e47a2b..5232ee9 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -14,7 +14,8 @@ test_expect_success \
      git add -- foo bar baz 'space embedded' -q &&
      git commit -m 'add normal files'"
 
-if touch -- 'tab	embedded' 'newline
+
+if ! test_have_prereq MINGW && touch -- 'tab	embedded' 'newline
 embedded' 2>/dev/null
 then
 	test_set_prereq FUNNYNAMES
diff --git a/t/t3703-add-magic-pathspec.sh b/t/t3703-add-magic-pathspec.sh
index 5115de7..aaff784 100755
--- a/t/t3703-add-magic-pathspec.sh
+++ b/t/t3703-add-magic-pathspec.sh
@@ -38,7 +38,7 @@ cat >expected <<EOF
 add 'sub/foo'
 EOF
 
-if mkdir ":" 2>/dev/null
+if ! test_have_prereq MINGW && mkdir ":" 2>/dev/null
 then
 	test_set_prereq COLON_DIR
 fi
diff --git a/t/t3902-quoted.sh b/t/t3902-quoted.sh
index 892f567..f528008 100755
--- a/t/t3902-quoted.sh
+++ b/t/t3902-quoted.sh
@@ -12,6 +12,7 @@ GN='???'
 HT='	'
 DQ='"'
 
+test_have_prereq MINGW ||
 echo foo 2>/dev/null > "Name and an${HT}HT"
 if ! test -f "Name and an${HT}HT"
 then
diff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh
index cd543ec..9c48e5c 100755
--- a/t/t4016-diff-quote.sh
+++ b/t/t4016-diff-quote.sh
@@ -13,6 +13,7 @@ P1='pathname	with HT'
 P2='pathname with SP'
 P3='pathname
 with LF'
+test_have_prereq !MINGW &&
 echo 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" || {
 	skip_all='Your filesystem does not allow tabs in filenames'
 	test_done
diff --git a/t/t4135-apply-weird-filenames.sh b/t/t4135-apply-weird-filenames.sh
index bf5dc57..6d6b96d 100755
--- a/t/t4135-apply-weird-filenames.sh
+++ b/t/t4135-apply-weird-filenames.sh
@@ -19,7 +19,8 @@ test_expect_success 'setup' '
 
 	test_when_finished "rm -f \"tab	embedded.txt\"" &&
 	test_when_finished "rm -f '\''\"quoteembedded\".txt'\''" &&
-	if touch -- "tab	embedded.txt" '\''"quoteembedded".txt'\''
+	if ! test_have_prereq MINGW &&
+		touch -- "tab	embedded.txt" '\''"quoteembedded".txt'\''
 	then
 		test_set_prereq FUNNYNAMES
 	fi
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index 812c9cd..5cfb9cf 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -197,7 +197,7 @@ if p="??/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/??/??/??" &&
 then
 
 # This test contains UTF-8 characters
-test_expect_success \
+test_expect_success !MINGW \
      'File with non-ascii file name' \
      'mkdir -p ??/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/??/??/?? &&
       echo Foo >??/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/??/??/??/g??rdets??g??rdet.txt &&
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index af82049..2ee6564 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -67,7 +67,7 @@ repo_with_newline='repo
 with
 newline'
 
-if mkdir "$repo_with_newline" 2>/dev/null
+if ! test_have_prereq MINGW && mkdir "$repo_with_newline" 2>/dev/null
 then
 	test_set_prereq FUNNYNAMES
 else
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* Re: [PATCH 06/19] mingw: try to delete target directory before renaming
  2016-01-24 15:44 ` [PATCH 06/19] mingw: try to delete target directory before renaming Johannes Schindelin
@ 2016-01-24 17:42   ` Philip Oakley
  2016-01-25  6:59     ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Philip Oakley @ 2016-01-24 17:42 UTC (permalink / raw)
  To: Johannes Schindelin, Junio C Hamano; +Cc: git, nalla

From: "Johannes Schindelin" <johannes.schindelin@gmx.de>
>From: 마누엘 <nalla@users.noreply.github.com>

Is this Nalla's preferred email, or just a carry over from cautions of the 
Github interface?

>
>When the rename() function tries to move a directory it fails if the
>target directory exists. It should check if it can delete the (possibly
>empty) target directory and then try again to move the directory.
>
>This partially fixes t9100-git-svn-basic.sh.
>
>Signed-off-by: 마누엘 <nalla@users.noreply.github.com>
>Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>---
>compat/mingw.c | 7 ++++++-
>1 file changed, 6 insertions(+), 1 deletion(-)
>
>diff --git a/compat/mingw.c b/compat/mingw.c
>index db92f5d..e4839b9 100644
>--- a/compat/mingw.c
>+++ b/compat/mingw.c
>@@ -1603,7 +1603,12 @@ repeat:
>  if (gle == ERROR_ACCESS_DENIED &&
>      (attrs = GetFileAttributesW(wpnew)) != INVALID_FILE_ATTRIBUTES) {
>  if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
>- errno = EISDIR;
>+ DWORD attrsold = GetFileAttributesW(wpold);
>+ if (attrsold == INVALID_FILE_ATTRIBUTES ||
>+     !(attrsold & FILE_ATTRIBUTE_DIRECTORY))
>+ errno = EISDIR;
>+ else if (!_wrmdir(wpnew))
>+ goto repeat;
>  return -1;
>  }
>  if ((attrs & FILE_ATTRIBUTE_READONLY) &&
>-- 
>2.7.0.windows.1.7.g55a05c8
--
Philip

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 09/19] mingw: accomodate t0060-path-utils for MSYS2
  2016-01-24 15:44 ` [PATCH 09/19] mingw: accomodate t0060-path-utils for MSYS2 Johannes Schindelin
@ 2016-01-24 19:51   ` Johannes Sixt
  2016-01-25 15:39     ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Johannes Sixt @ 2016-01-24 19:51 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git

Am 24.01.2016 um 16:44 schrieb Johannes Schindelin:
> On Windows, there are no POSIX paths, only Windows ones (an absolute
> Windows path looks like "C:\Program Files\Git\ReleaseNotes.html", under
> most circumstances, forward slashes are also allowed and synonymous to
> backslashes).
> 
> So when a POSIX shell (such as MSYS2's Bash, which is used by Git for
> Windows to execute all those shell scripts that are part of Git) passes
> a POSIX path to test-path-utils.exe (which is not POSIX-aware), the path
> is translated into a Windows path. For example, /etc/profile becomes
> C:/Program Files/Git/etc/profile.
> 
> This path translation poses a problem when passing the root directory as
> parameter to test-path-utils.exe, as it is not well defined whether the
> translated root directory should end in a slash or not. MSys1 stripped
> the trailing slash, but MSYS2 does not.
> 
> To work with both behaviors, we simply test what the current system does
> in the beginning of t0060-path-utils.sh and then adjust the expected
> longest ancestor length accordingly.
> 
> Originally, the Git for Windows project patched MSYS2's runtime to
> accomodate Git's regression test, but we really should do it the other
> way round.
> 
> Thanks to Ray Donnelly for his patient help with this issue.
> 
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>   t/t0060-path-utils.sh | 37 ++++++++++++++++++++++---------------
>   1 file changed, 22 insertions(+), 15 deletions(-)
> 
> diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
> index f0152a7..89d03e7 100755
> --- a/t/t0060-path-utils.sh
> +++ b/t/t0060-path-utils.sh
> @@ -7,6 +7,13 @@ test_description='Test various path utilities'
>   
>   . ./test-lib.sh
>   
> +# On Windows, the root directory "/" is translated into a Windows directory.
> +# As it is not well-defined whether that Windows directory should end in a
> +# slash or not, let's test for that and adjust our expected longest ancestor
> +# length accordingly.
> +root_offset=0
> +case "$(test-path-utils print_path /)" in ?*/) root_offset=-1;; esac
> +
>   norm_path() {
>   	expected=$(test-path-utils print_path "$2")
>   	test_expect_success $3 "normalize path: $1 => $2" \

In t0060-path-utils.sh, I currently find this:

# On Windows, we are using MSYS's bash, which mangles the paths.
# Absolute paths are anchored at the MSYS installation directory,
# which means that the path / accounts for this many characters:
rootoff=$(test-path-utils normalize_path_copy / | wc -c)
# Account for the trailing LF:
if test $rootoff = 2; then
	rootoff=	# we are on Unix
else
	rootoff=$(($rootoff-1))
fi

ancestor() {
	# We do some math with the expected ancestor length.
	expected=$3
	if test -n "$rootoff" && test "x$expected" != x-1; then
		expected=$(($expected+$rootoff))
	fi
	test_expect_success "longest ancestor: $1 $2 => $expected" \
	"actual=\$(test-path-utils longest_ancestor_length '$1' '$2') &&
	 test \"\$actual\" = '$expected'"
}

Furthermore, since you are modifying only cases where the expected
value is not -1 and we already have a check for this case in the
helper function, wouldn't it be simpler to merge the offset that your
case needs with the one that we already have?

> @@ -112,30 +119,30 @@ norm_path /d1/.../d2 /d1/.../d2
>   norm_path /d1/..././../d2 /d1/d2
>   
>   ancestor / / -1
> -ancestor /foo / 0
> +ancestor /foo / $root_offset
>   ancestor /foo /fo -1
>   ancestor /foo /foo -1
>   ancestor /foo /bar -1
>   ancestor /foo /foo/bar -1
>   ancestor /foo /foo:/bar -1
> -ancestor /foo /:/foo:/bar 0
> -ancestor /foo /foo:/:/bar 0
> -ancestor /foo /:/bar:/foo 0
> -ancestor /foo/bar / 0
> +ancestor /foo /:/foo:/bar $root_offset
> +ancestor /foo /foo:/:/bar $root_offset
> +ancestor /foo /:/bar:/foo $root_offset
> +ancestor /foo/bar / $root_offset
>   ancestor /foo/bar /fo -1
> -ancestor /foo/bar /foo 4
> +ancestor /foo/bar /foo $((4+$root_offset))
>   ancestor /foo/bar /foo/ba -1
> -ancestor /foo/bar /:/fo 0
> -ancestor /foo/bar /foo:/foo/ba 4
> +ancestor /foo/bar /:/fo $root_offset
> +ancestor /foo/bar /foo:/foo/ba $((4+$root_offset))
>   ancestor /foo/bar /bar -1
>   ancestor /foo/bar /fo -1
> -ancestor /foo/bar /foo:/bar 4
> -ancestor /foo/bar /:/foo:/bar 4
> -ancestor /foo/bar /foo:/:/bar 4
> -ancestor /foo/bar /:/bar:/fo 0
> -ancestor /foo/bar /:/bar 0
> -ancestor /foo/bar /foo 4
> -ancestor /foo/bar /foo:/bar 4
> +ancestor /foo/bar /foo:/bar $((4+$root_offset))
> +ancestor /foo/bar /:/foo:/bar $((4+$root_offset))
> +ancestor /foo/bar /foo:/:/bar $((4+$root_offset))
> +ancestor /foo/bar /:/bar:/fo $root_offset
> +ancestor /foo/bar /:/bar $root_offset
> +ancestor /foo/bar /foo $((4+$root_offset))
> +ancestor /foo/bar /foo:/bar $((4+$root_offset))
>   ancestor /foo/bar /bar -1
>   
>   test_expect_success 'strip_path_suffix' '
> 

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 00/19] Let Git's tests pass on Windows
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (18 preceding siblings ...)
  2016-01-24 15:45 ` [PATCH 19/19] mingw: do not bother to test funny file names Johannes Schindelin
@ 2016-01-25  1:34 ` Junio C Hamano
  2016-01-25 15:45   ` Johannes Schindelin
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
  20 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-25  1:34 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> This is a big milestone. With these modifications, Git's source code
> does not only build without warnings in Git for Windows' SDK, but
> passes the entire regression test suite.

;-)

It is somewhat surprising that with only these changes my tree is no
longer behind the Git for Windows effort--all tests pass so everything
should be working perfectly, right ;-)

There were a few changes in the series that raised my eyebrows,
which I'll respond separately, but overall it's a great
achievement.

Thanks.

>
> The patch series contains three different types of patches. First,
> there are a couple of real fixes that were triggered by failures in
> the regression tests. Then there are a couple of fixes to the
> regression tests themselves. And finally, we have to disable a couple
> of tests because we simply cannot make them work on Windows.
>
>
> Johannes Schindelin (13):
>   mingw: let's use gettext with MSYS2
>   mingw: do not trust MSYS2's MinGW gettext.sh
>   Git.pm: stop assuming that absolute paths start with a slash
>   mingw: prepare the TMPDIR environment variable for shell scripts
>   mingw: let lstat() fail with errno == ENOTDIR when appropriate
>   mingw: fix t5601-clone.sh
>   mingw: accomodate t0060-path-utils for MSYS2
>   mingw: disable mkfifo-based tests
>   tests: turn off git-daemon tests if FIFOs are not available
>   mingw: fix t9700's assumption about directory separators
>   mingw: work around pwd issues in the tests
>   mingw: skip a couple of git-svn tests that cannot pass on Windows
>   mingw: do not bother to test funny file names
>
> Karsten Blees (2):
>   mingw: factor out Windows specific environment setup
>   mingw: do not use symlinks with SVN in t9100
>
> Pat Thoyts (1):
>   mingw: avoid absolute path in t0008
>
> Thomas Braun (1):
>   mingw: outsmart MSYS2's path substitution in t1508
>
> 마누엘 (2):
>   mingw: try to delete target directory before renaming
>   mingw: fix git-svn tests that expect chmod to work
>
>  Makefile                              |  1 +
>  compat/mingw.c                        | 91 +++++++++++++++++++++++++++++------
>  config.mak.uname                      |  3 +-
>  perl/Git.pm                           |  3 +-
>  t/lib-git-daemon.sh                   |  5 ++
>  t/t0008-ignores.sh                    |  8 ++-
>  t/t0060-path-utils.sh                 | 37 ++++++++------
>  t/t1508-at-combinations.sh            | 13 ++++-
>  t/t3300-funny-names.sh                |  1 +
>  t/t3600-rm.sh                         |  3 +-
>  t/t3703-add-magic-pathspec.sh         |  2 +-
>  t/t3902-quoted.sh                     |  1 +
>  t/t4016-diff-quote.sh                 |  1 +
>  t/t4135-apply-weird-filenames.sh      |  3 +-
>  t/t5601-clone.sh                      | 18 +++----
>  t/t7800-difftool.sh                   | 14 +++---
>  t/t9100-git-svn-basic.sh              | 29 +++++++----
>  t/t9118-git-svn-funky-branch-names.sh | 12 +++--
>  t/t9124-git-svn-dcommit-auto-props.sh | 20 ++++++--
>  t/t9130-git-svn-authors-file.sh       |  2 +-
>  t/t9200-git-cvsexportcommit.sh        |  2 +-
>  t/t9400-git-cvsserver-server.sh       |  6 +--
>  t/t9401-git-cvsserver-crlf.sh         |  6 +--
>  t/t9402-git-cvsserver-refs.sh         |  6 +--
>  t/t9700/test.pl                       |  2 +-
>  t/t9903-bash-prompt.sh                |  2 +-
>  t/test-lib.sh                         |  2 +-
>  test-fake-ssh.c                       | 30 ++++++++++++
>  28 files changed, 238 insertions(+), 85 deletions(-)
>  create mode 100644 test-fake-ssh.c

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/19] mingw: let's use gettext with MSYS2
  2016-01-24 15:43 ` [PATCH 01/19] mingw: let's use gettext with MSYS2 Johannes Schindelin
@ 2016-01-25  1:42   ` Junio C Hamano
  2016-01-25 16:16     ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-25  1:42 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> This solves two problems:
>
> - we now have proper localisation even on Windows
>
> - we sidestep the infamous "BUG: your vsnprintf is broken (returned -1)"
>   message when running "git init" (which otherwise prevents the entire
>   test suite from running)

It is unclear to me how gettext is related to use of vsnprintf().
"sidestep" hints me that perhaps we do not call vsnprintf() from
strbuf_vaddf() in a way that reveals its breakage when we are using
gettext, but I am not quite seeing how.

Because as the next sentence says, that does sound like a critical
issue not to be able to even run "init", I wanted to learn more
about the real issue.

>
> The latter issue is rather crucial, as *no* test passes in Git for
> Windows without this fix.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  config.mak.uname | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/config.mak.uname b/config.mak.uname
> index 4b2e1b8..6b25661 100644
> --- a/config.mak.uname
> +++ b/config.mak.uname
> @@ -560,7 +560,7 @@ else
>  		NO_R_TO_GCC_LINKER = YesPlease
>  		INTERNAL_QSORT = YesPlease
>  		HAVE_LIBCHARSET_H = YesPlease
> -		NO_GETTEXT = YesPlease
> +		NO_GETTEXT =
>  		USE_LIBPCRE= YesPlease
>  		NO_CURL =
>  		USE_NED_ALLOCATOR = YesPlease

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 12/19] mingw: do not use symlinks with SVN in t9100
  2016-01-24 15:45 ` [PATCH 12/19] mingw: do not use symlinks with SVN in t9100 Johannes Schindelin
@ 2016-01-25  1:51   ` Junio C Hamano
  2016-01-25 16:53     ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-25  1:51 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Karsten Blees, git

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> From: Karsten Blees <blees@dcon.de>
>
> The SVN library does not seem to support symlinks, even if symlinks are
> enabled in MSYS2 and Git. Use 'cp' instead of 'ln -s'.
>
> This partially fixes t/t9100-git-svn-basic.sh
>
> Signed-off-by: Karsten Blees <blees@dcon.de>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  t/t9100-git-svn-basic.sh | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

For the purpose of SVN test, is it important that foo.link is a link
to foo?  I am wondering what would be the fallout from making this
change without "only on MINGW do this".

On the other hand, perhaps such a change may make this particular
test meaningless for whatever reason.  Perhaps this test is about
git-svn handling a symbolic link correctly, and you wouldn't be
testing anything useful if you unconditionally changed "ln -s" to
"cp" on all platforms.  But if that is the case, I suspect that it
would make more sense to mark the test to be skipped using the
prerequiste, instead of pretending that this test passes.  While the
updated test may be testing that the same "works correctly on
symbolic links" as before on all the other platforms, on MINGW, it
is testing something completely different.

I cannot quite tell if that is the case.

> diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
> index 258d9b8..dbb440b 100755
> --- a/t/t9100-git-svn-basic.sh
> +++ b/t/t9100-git-svn-basic.sh
> @@ -25,7 +25,14 @@ test_expect_success \
>  	(
>  		cd import &&
>  		echo foo >foo &&
> -		ln -s foo foo.link
> +		if test_have_prereq !MINGW
> +		then
> +			ln -s foo foo.link
> +		else
> +			# MSYS libsvn does not support symlinks, so always use cp, even if
> +			# ln -s actually works
> +			cp foo foo.link
> +		fi
>  		mkdir -p dir/a/b/c/d/e &&
>  		echo "deep dir" >dir/a/b/c/d/e/file &&
>  		mkdir bar &&

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 13/19] mingw: outsmart MSYS2's path substitution in t1508
  2016-01-24 15:45 ` [PATCH 13/19] mingw: outsmart MSYS2's path substitution in t1508 Johannes Schindelin
@ 2016-01-25  2:03   ` Junio C Hamano
  2016-01-25  6:22     ` Eric Sunshine
  2016-01-25 16:30     ` Johannes Schindelin
  0 siblings, 2 replies; 113+ messages in thread
From: Junio C Hamano @ 2016-01-25  2:03 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Thomas Braun, git

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> From: Thomas Braun <thomas.braun@byte-physics.de>
>
> A string of the form "@/abcd" is considered a file path
> by the msys layer and therefore translated to a Windows path.
>
> Here the trick is to double the slashes.
>
> The MSYS2 patch translation can be studied by calling
>
> 	test-path-utils print_path <path>
>
> Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---

This feels wrong.

The point of this test is that you can ask to checkout a branch
whose name is a strangely looking "@/at-test", and a ref whose name
is "refs/heads/@/at-test" indeed is created.

The current "checkout" may be lazy and not signal an error for a
branch name with two consecutive slashes, but I wouldn't be
surprised if we tighten that later, and more importantly, I do not
think we ever promised users if you asked a branch "a//b" to be
created, we would create "refs/heads/a/b".

The new test hardcodes and promises such an incompatible behaviour,
i.e. a request to create "@//b" results in "@/b" created, only to
users on MINGW, fracturing the expectations of the Git userbase.

Wouldn't it be better to declare "On other people's Git, @/foo is
just as normal a branch name as a/foo, but on MINGW @/foo cannot be
used" by skipping some tests using prerequisites instead?


>  t/t1508-at-combinations.sh | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
> index 078e119..1d9fd7b 100755
> --- a/t/t1508-at-combinations.sh
> +++ b/t/t1508-at-combinations.sh
> @@ -29,13 +29,22 @@ fail() {
>  	"$@" failure
>  }
>  
> +if test_have_prereq MINGW
> +then
> +	# MSYS2 interprets `@/abc` to be a file list, and wants to substitute
> +	# the Unix-y path with a Windows one (e.g. @C:\msys64\abc)
> +	AT_SLASH=@//at-test
> +else
> +	AT_SLASH=@/at-test
> +fi
> +
>  test_expect_success 'setup' '
>  	test_commit master-one &&
>  	test_commit master-two &&
>  	git checkout -b upstream-branch &&
>  	test_commit upstream-one &&
>  	test_commit upstream-two &&
> -	git checkout -b @/at-test &&
> +	git checkout -b $AT_SLASH &&
>  	git checkout -b @@/at-test &&
>  	git checkout -b @at-test &&
>  	git checkout -b old-branch &&
> @@ -64,7 +73,7 @@ check "@{-1}@{u}@{1}" commit master-one
>  check "@" commit new-two
>  check "@@{u}" ref refs/heads/upstream-branch
>  check "@@/at-test" ref refs/heads/@@/at-test
> -check "@/at-test" ref refs/heads/@/at-test
> +check "$AT_SLASH" ref refs/heads/@/at-test
>  check "@at-test" ref refs/heads/@at-test
>  nonsense "@{u}@{-1}"
>  nonsense "@{0}@{0}"

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 16/19] mingw: avoid absolute path in t0008
  2016-01-24 15:45 ` [PATCH 16/19] mingw: avoid absolute path in t0008 Johannes Schindelin
@ 2016-01-25  2:11   ` Junio C Hamano
  2016-01-25 16:48     ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-25  2:11 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Pat Thoyts, git

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> From: Pat Thoyts <patthoyts@users.sourceforge.net>
>
> The test separator char is a colon which means any absolute paths on
> Windows confuse the tests that use global_excludes.
>
> Suggested-by: Karsten Blees <karsten.blees@gmail.com>
> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  t/t0008-ignores.sh | 8 +++++++-

Is the fact that $global_excludes is specified using an absolute
path significant to the correctness of this test script?  This patch
suggests me that it is not (i.e. if the tests chdir's around, then
relative reference to global-excludes file would not work at all,
but apparently tests run with MINGW prereq does not exhibit such an
issue, so the remainder of the test would see the file we want it
see with the relative reference just fine).

And in that case, I think it would be more correct to use the
"global-excludes in the current directory" definition regardless of
MINGW prerequisite.  Adding a comment that says "The value of this
variable is a colon separated list, so avoid absolute path, because
..." is a very welcome addition while doing so.

A larger question is if it would make more sense for Git ported to
Windows environment to use semicolon (that is the element separator
for %PATH% in the Windows land, right?) instead where POSIXy port
would use colon as the separator.  A variable that is a list of
locations (e.g. $PATH) makes little sense when elements can only be
relative paths in practice.

>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
> index 4ef5ed4..68749f5 100755
> --- a/t/t0008-ignores.sh
> +++ b/t/t0008-ignores.sh
> @@ -5,7 +5,13 @@ test_description=check-ignore
>  . ./test-lib.sh
>  
>  init_vars () {
> -	global_excludes="$(pwd)/global-excludes"
> +	# On Windows, avoid using "C:" in the global-excludes paths.
> +	if test_have_prereq MINGW
> +	then
> +		global_excludes="global-excludes"
> +	else
> +		global_excludes="$(pwd)/global-excludes"
> +	fi
>  }
>  
>  enable_global_excludes () {

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 05/19] mingw: prepare the TMPDIR environment variable for shell scripts
  2016-01-24 15:43 ` [PATCH 05/19] mingw: prepare the TMPDIR environment variable for shell scripts Johannes Schindelin
@ 2016-01-25  2:11   ` Eric Sunshine
  2016-01-26  8:38     ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Eric Sunshine @ 2016-01-25  2:11 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, Git List

On Sun, Jan 24, 2016 at 10:43 AM, Johannes Schindelin
<johannes.schindelin@gmx.de> wrote:
> When shell scripts access a $TMPDIR variable containing backslashes,
> they will be mistaken for escape characters. Let's not let that happen
> by converting them to forward slashes.
>
> This partially fixes t7800 with MSYS2.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> diff --git a/compat/mingw.c b/compat/mingw.c
> @@ -2042,13 +2042,28 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
>  static void setup_windows_environment()
>  {
> +       char *tmp = getenv("TMPDIR");
> +
>         /* on Windows it is TMP and TEMP */
> -       if (!getenv("TMPDIR")) {
> -               const char *tmp = getenv("TMP");
> -               if (!tmp)
> +       if (tmp) {
> +               if (!(tmp = getenv("TMP")))
>                         tmp = getenv("TEMP");
> -               if (tmp)
> +               if (tmp) {
>                         setenv("TMPDIR", tmp, 1);
> +                       tmp = getenv("TMPDIR");
> +               }
> +       }

Let me see if I understand this...

In the original code, if TMPDIR was *not* set, it would assign the
value of TMP or TEMP to TEMPDIR.

The new code, however, checks TMP and TEMP only if TMPDIR is *already*
set. Am I reading this correctly? Is this revised behavior correct?

> +       if (tmp) {
> +               /*
> +                * Convert all dir separators to forward slashes,
> +                * to help shell commands called from the Git
> +                * executable (by not mistaking the dir separators
> +                * for escape characters).
> +                */
> +               for (; *tmp; tmp++)
> +                       if (*tmp == '\\')
> +                               *tmp = '/';

This transformation is performed on whatever memory was returned by
getenv(). It is also performed after setenv(), so presumably setenv()
isn't making a copy of the incoming string. Is that correct? Is it a
good idea to rely upon that detail of implementation (even if we
control the implementation, which I suppose is the case here)?

>         }
>
>         /* simulate TERM to enable auto-color (see color.c) */
> --
> 2.7.0.windows.1.7.g55a05c8

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 17/19] mingw: fix git-svn tests that expect chmod to work
  2016-01-24 15:45 ` [PATCH 17/19] mingw: fix git-svn tests that expect chmod to work Johannes Schindelin
@ 2016-01-25  2:14   ` Junio C Hamano
  2016-01-26  6:31     ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-25  2:14 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> From: 마누엘 <nalla@users.noreply.github.com>
>
> Some git-svn tests expect that the executable bit of files can be
> toggled. On Windows, this is not possible because Windows' Access
> Control Lists are much more fine-grained than the POSIX permission
> concept. Let's just not try to flip the executable bit.

Most of the changes are protected by !POSIXPERM but one of them
seems to use MINGW, which looks inconsistent and I suspect was not a
distinction made on purpose.  The above description sounds to me
that the !POSIXPERM prerequisite is the right thing to use.

I am not sure if it is a good idea to sprinkle test-have-prereq and
make the test script test different things on different platforms,
though.



> This lets t9118-git-svn-funky-branch-names.sh and
> t9124-git-svn-dcommit-auto-props.sh pass in Git for Windows' SDK,
> and partially fixes t9100-git-svn-basic.sh.
>
> Signed-off-by: 마누엘 <nalla@users.noreply.github.com>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  t/t9100-git-svn-basic.sh              |  5 ++++-
>  t/t9118-git-svn-funky-branch-names.sh | 12 +++++++++---
>  t/t9124-git-svn-dcommit-auto-props.sh | 20 ++++++++++++++++----
>  3 files changed, 29 insertions(+), 8 deletions(-)
>
> diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
> index dbb440b..bca7ec8 100755
> --- a/t/t9100-git-svn-basic.sh
> +++ b/t/t9100-git-svn-basic.sh
> @@ -38,7 +38,10 @@ test_expect_success \
>  		mkdir bar &&
>  		echo "zzz" >bar/zzz &&
>  		echo "#!/bin/sh" >exec.sh &&
> -		chmod +x exec.sh &&
> +		{
> +			test_have_prereq !POSIXPERM ||
> +			chmod +x exec.sh
> +		} &&
>  		svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null
>  	) &&
>  	rm -rf import &&
> diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh
> index a221915..49775a5 100755
> --- a/t/t9118-git-svn-funky-branch-names.sh
> +++ b/t/t9118-git-svn-funky-branch-names.sh
> @@ -23,8 +23,11 @@ test_expect_success 'setup svnrepo' '
>  	              "$svnrepo/pr ject/branches/$scary_uri" &&
>  	svn_cmd cp -m "leading dot" "$svnrepo/pr ject/trunk" \
>  			"$svnrepo/pr ject/branches/.leading_dot" &&
> -	svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
> -			"$svnrepo/pr ject/branches/trailing_dot." &&
> +	{
> +		test_have_prereq MINGW ||
> +		svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
> +			"$svnrepo/pr ject/branches/trailing_dot."
> +	} &&
>  	svn_cmd cp -m "trailing .lock" "$svnrepo/pr ject/trunk" \
>  			"$svnrepo/pr ject/branches/trailing_dotlock.lock" &&
>  	svn_cmd cp -m "reflog" "$svnrepo/pr ject/trunk" \
> @@ -45,7 +48,10 @@ test_expect_success 'test clone with funky branch names' '
>  		git rev-parse "refs/remotes/origin/more%20fun%20plugin!" &&
>  		git rev-parse "refs/remotes/origin/$scary_ref" &&
>  		git rev-parse "refs/remotes/origin/%2Eleading_dot" &&
> -		git rev-parse "refs/remotes/origin/trailing_dot%2E" &&
> +		{
> +			test_have_prereq MINGW ||
> +			git rev-parse "refs/remotes/origin/trailing_dot%2E"
> +		} &&
>  		git rev-parse "refs/remotes/origin/trailing_dotlock%2Elock" &&
>  		git rev-parse "refs/remotes/origin/$non_reflog"
>  	)
> diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh
> index aa841e1..c851121 100755
> --- a/t/t9124-git-svn-dcommit-auto-props.sh
> +++ b/t/t9124-git-svn-dcommit-auto-props.sh
> @@ -35,7 +35,10 @@ test_expect_success 'enable auto-props config' '
>  
>  test_expect_success 'add files matcihng auto-props' '
>  	echo "#!$SHELL_PATH" >exec1.sh &&
> -	chmod +x exec1.sh &&
> +	{
> +		test_have_prereq !POSIXPERM ||
> +		chmod +x exec1.sh
> +	} &&
>  	echo "hello" >hello.txt &&
>  	echo bar >bar &&
>  	git add exec1.sh hello.txt bar &&
> @@ -49,7 +52,10 @@ test_expect_success 'disable auto-props config' '
>  
>  test_expect_success 'add files matching disabled auto-props' '
>  	echo "#$SHELL_PATH" >exec2.sh &&
> -	chmod +x exec2.sh &&
> +	{
> +		test_have_prereq !POSIXPERM ||
> +		chmod +x exec2.sh
> +	} &&
>  	echo "world" >world.txt &&
>  	echo zot >zot &&
>  	git add exec2.sh world.txt zot &&
> @@ -65,7 +71,10 @@ test_expect_success 'check resulting svn repository' '
>  	cd svnrepo &&
>  
>  	# Check properties from first commit.
> -	test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*" &&
> +	{
> +		test_have_prereq !POSIXPERM ||
> +		test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*"
> +	} &&
>  	test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \
>  	     "xapplication/x-shellscript" &&
>  	test "x$(svn_cmd propget svn:mime-type hello.txt)" = "xtext/plain" &&
> @@ -73,7 +82,10 @@ test_expect_success 'check resulting svn repository' '
>  	test "x$(svn_cmd propget svn:mime-type bar)" = "x" &&
>  
>  	# Check properties from second commit.
> -	test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*" &&
> +	{
> +		test_have_prereq !POSIXPERM ||
> +		test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*"
> +	} &&
>  	test "x$(svn_cmd propget svn:mime-type exec2.sh)" = "x" &&
>  	test "x$(svn_cmd propget svn:mime-type world.txt)" = "x" &&
>  	test "x$(svn_cmd propget svn:eol-style world.txt)" = "x" &&

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 18/19] mingw: skip a couple of git-svn tests that cannot pass on Windows
  2016-01-24 15:45 ` [PATCH 18/19] mingw: skip a couple of git-svn tests that cannot pass on Windows Johannes Schindelin
@ 2016-01-25  2:16   ` Junio C Hamano
  2016-01-26  6:45     ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-25  2:16 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> Some of the tests expect that executable bits can be toggled, others
> expect that paths are POSIX paths (but when they come through git.exe,
> they are converted into Windows paths and necessarily differ), yet
> others expect symbolic links to be available.

These skip the tests that cannot possibly pass in their entirety by
protecting them with prerequisites, which feels the right thing to
do.  The "executable bits" ones would need to become !POSIXPERM, and
symlink ones !SYMLINKS, though.

Thanks.

> This lets t9100-git-svn-basic.sh and t9130-git-svn-authors-file.sh pass
> in Git for Windows' SDK.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  t/t9100-git-svn-basic.sh        | 15 +++++++--------
>  t/t9130-git-svn-authors-file.sh |  2 +-
>  2 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
> index bca7ec8..8c74ffa 100755
> --- a/t/t9100-git-svn-basic.sh
> +++ b/t/t9100-git-svn-basic.sh
> @@ -127,7 +127,7 @@ test_expect_success "$name" '
>  
>  
>  name='remove executable bit from a file'
> -test_expect_success "$name" '
> +test_expect_success !MINGW "$name" '
>  	rm -f "$GIT_DIR"/index &&
>  	git checkout -f -b mybranch5 ${remotes_git_svn} &&
>  	chmod -x exec.sh &&
> @@ -140,7 +140,7 @@ test_expect_success "$name" '
>  
>  
>  name='add executable bit back file'
> -test_expect_success "$name" '
> +test_expect_success !MINGW "$name" '
>  	chmod +x exec.sh &&
>  	git update-index exec.sh &&
>  	git commit -m "$name" &&
> @@ -151,7 +151,7 @@ test_expect_success "$name" '
>  
>  
>  name='executable file becomes a symlink to file'
> -test_expect_success "$name" '
> +test_expect_success !MINGW "$name" '
>  	rm exec.sh &&
>  	ln -s file exec.sh &&
>  	git update-index exec.sh &&
> @@ -163,8 +163,7 @@ test_expect_success "$name" '
>  
>  name='new symlink is added to a file that was also just made executable'
>  
> -test_expect_success "$name" '
> -	chmod +x file &&
> +test_expect_success !MINGW "$name" '
>  	ln -s file exec-2.sh &&
>  	git update-index --add file exec-2.sh &&
>  	git commit -m "$name" &&
> @@ -175,7 +174,7 @@ test_expect_success "$name" '
>  	test -h "$SVN_TREE"/exec-2.sh'
>  
>  name='modify a symlink to become a file'
> -test_expect_success "$name" '
> +test_expect_success !MINGW "$name" '
>  	echo git help >help &&
>  	rm exec-2.sh &&
>  	cp help exec-2.sh &&
> @@ -191,7 +190,7 @@ test_expect_success "$name" '
>  name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
>  LC_ALL="$GIT_SVN_LC_ALL"
>  export LC_ALL
> -test_expect_success UTF8 "$name" "
> +test_expect_success !MINGW,UTF8 "$name" "
>  	echo '# hello' >> exec-2.sh &&
>  	git update-index exec-2.sh &&
>  	git commit -m '???????' &&
> @@ -224,7 +223,7 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
>  tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4
>  EOF
>  
> -test_expect_success "$name" "test_cmp a expected"
> +test_expect_success !MINGW "$name" "test_cmp a expected"
>  
>  test_expect_success 'exit if remote refs are ambigious' "
>          git config --add svn-remote.svn.fetch \
> diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh
> index d306b77..4126481 100755
> --- a/t/t9130-git-svn-authors-file.sh
> +++ b/t/t9130-git-svn-authors-file.sh
> @@ -91,7 +91,7 @@ test_expect_success 'fetch continues after authors-file is fixed' '
>  	)
>  	'
>  
> -test_expect_success 'fresh clone with svn.authors-file in config' '
> +test_expect_success !MINGW 'fresh clone with svn.authors-file in config' '
>  	(
>  		rm -r "$GIT_DIR" &&
>  		test x = x"$(git config svn.authorsfile)" &&

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 13/19] mingw: outsmart MSYS2's path substitution in t1508
  2016-01-25  2:03   ` Junio C Hamano
@ 2016-01-25  6:22     ` Eric Sunshine
  2016-01-25 18:50       ` Junio C Hamano
  2016-01-25 16:30     ` Johannes Schindelin
  1 sibling, 1 reply; 113+ messages in thread
From: Eric Sunshine @ 2016-01-25  6:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, Thomas Braun, Git List

On Sun, Jan 24, 2016 at 9:03 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
>> A string of the form "@/abcd" is considered a file path
>> by the msys layer and therefore translated to a Windows path.
>>
>> Here the trick is to double the slashes.
>>
>> The MSYS2 patch translation can be studied by calling
>>
>>       test-path-utils print_path <path>
>
> This feels wrong.
>
> The point of this test is that you can ask to checkout a branch
> whose name is a strangely looking "@/at-test", and a ref whose name
> is "refs/heads/@/at-test" indeed is created.
>
> The current "checkout" may be lazy and not signal an error for a
> branch name with two consecutive slashes, but I wouldn't be
> surprised if we tighten that later, and more importantly, I do not
> think we ever promised users if you asked a branch "a//b" to be
> created, we would create "refs/heads/a/b".
>
> The new test hardcodes and promises such an incompatible behaviour,
> i.e. a request to create "@//b" results in "@/b" created, only to
> users on MINGW, fracturing the expectations of the Git userbase.

What the commit message doesn't explain is that the MSYS2 Bash shell
automatically translates command-line arguments which look like
absolute POSIX paths into Windows paths on behalf of the program being
invoked. For instance, given the command-line:

    myprog /fish

the shell will translate /fish to a Windows pathname, such as C:\fish
before invoking myprog.exe. While this is often the desired behavior,
sometimes the argument represents something other than a path, and the
translation is unwanted. MSYS provides a way to suppress the behavior
manually by doubling the slash, so:

    myprog //fish

will invoke myprog.exe with literal argument /fish (notice the single slash).

This commit message is trying to say that MSYS shell undesirably sees
@/fish as an absolute path, thus tries translating it to a Windows
path, such as @C:\fish. The only way to suppress this unwanted
translation is to manually double the slash, hence the patch makes the
test use @//fish which, when finally seen by the program, is just
@/fish, as was intended in the first place. So, doubling the slash on
MINGW is not promising incompatible behavior for MINGW users; it's
just working around unwanted path translation of the shell.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 06/19] mingw: try to delete target directory before renaming
  2016-01-24 17:42   ` Philip Oakley
@ 2016-01-25  6:59     ` Johannes Schindelin
  2016-01-25 18:55       ` Junio C Hamano
  0 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-25  6:59 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Junio C Hamano, git, nalla

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

Hi Philip,

On Sun, 24 Jan 2016, Philip Oakley wrote:

> From: "Johannes Schindelin" <johannes.schindelin@gmx.de>
> >From: 마누엘 <nalla@users.noreply.github.com>
> 
> Is this Nalla's preferred email, or just a carry over from cautions of the
> Github interface?

Neither. It is from the author field as recorded in the commit that I
merged originally: https://github.com/dscho/git/pull/8

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 09/19] mingw: accomodate t0060-path-utils for MSYS2
  2016-01-24 19:51   ` Johannes Sixt
@ 2016-01-25 15:39     ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-25 15:39 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, git

Hi Hannes,

On Sun, 24 Jan 2016, Johannes Sixt wrote:

> Am 24.01.2016 um 16:44 schrieb Johannes Schindelin:
> > On Windows, there are no POSIX paths, only Windows ones (an absolute
> > Windows path looks like "C:\Program Files\Git\ReleaseNotes.html", under
> > most circumstances, forward slashes are also allowed and synonymous to
> > backslashes).
> > 
> > So when a POSIX shell (such as MSYS2's Bash, which is used by Git for
> > Windows to execute all those shell scripts that are part of Git) passes
> > a POSIX path to test-path-utils.exe (which is not POSIX-aware), the path
> > is translated into a Windows path. For example, /etc/profile becomes
> > C:/Program Files/Git/etc/profile.
> > 
> > This path translation poses a problem when passing the root directory as
> > parameter to test-path-utils.exe, as it is not well defined whether the
> > translated root directory should end in a slash or not. MSys1 stripped
> > the trailing slash, but MSYS2 does not.
> > 
> > To work with both behaviors, we simply test what the current system does
> > in the beginning of t0060-path-utils.sh and then adjust the expected
> > longest ancestor length accordingly.
> > 
> > Originally, the Git for Windows project patched MSYS2's runtime to
> > accomodate Git's regression test, but we really should do it the other
> > way round.
> > 
> > Thanks to Ray Donnelly for his patient help with this issue.
> > 
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> >   t/t0060-path-utils.sh | 37 ++++++++++++++++++++++---------------
> >   1 file changed, 22 insertions(+), 15 deletions(-)
> > 
> > diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
> > index f0152a7..89d03e7 100755
> > --- a/t/t0060-path-utils.sh
> > +++ b/t/t0060-path-utils.sh
> > @@ -7,6 +7,13 @@ test_description='Test various path utilities'
> >   
> >   . ./test-lib.sh
> >   
> > +# On Windows, the root directory "/" is translated into a Windows directory.
> > +# As it is not well-defined whether that Windows directory should end in a
> > +# slash or not, let's test for that and adjust our expected longest ancestor
> > +# length accordingly.
> > +root_offset=0
> > +case "$(test-path-utils print_path /)" in ?*/) root_offset=-1;; esac
> > +
> >   norm_path() {
> >   	expected=$(test-path-utils print_path "$2")
> >   	test_expect_success $3 "normalize path: $1 => $2" \
> 
> In t0060-path-utils.sh, I currently find this:
> 
> # On Windows, we are using MSYS's bash, which mangles the paths.
> # Absolute paths are anchored at the MSYS installation directory,
> # which means that the path / accounts for this many characters:
> rootoff=$(test-path-utils normalize_path_copy / | wc -c)
> # Account for the trailing LF:
> if test $rootoff = 2; then
> 	rootoff=	# we are on Unix
> else
> 	rootoff=$(($rootoff-1))
> fi
> 
> ancestor() {
> 	# We do some math with the expected ancestor length.
> 	expected=$3
> 	if test -n "$rootoff" && test "x$expected" != x-1; then
> 		expected=$(($expected+$rootoff))
> 	fi
> 	test_expect_success "longest ancestor: $1 $2 => $expected" \
> 	"actual=\$(test-path-utils longest_ancestor_length '$1' '$2') &&
> 	 test \"\$actual\" = '$expected'"
> }
> 
> Furthermore, since you are modifying only cases where the expected
> value is not -1 and we already have a check for this case in the
> helper function, wouldn't it be simpler to merge the offset that your
> case needs with the one that we already have?

Good points. I reworked the patch here (will be part of v2):
https://github.com/dscho/git/commit/24767bd

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 00/19] Let Git's tests pass on Windows
  2016-01-25  1:34 ` [PATCH 00/19] Let Git's tests pass on Windows Junio C Hamano
@ 2016-01-25 15:45   ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-25 15:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Junio,

On Sun, 24 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> 
> > This is a big milestone. With these modifications, Git's source code
> > does not only build without warnings in Git for Windows' SDK, but
> > passes the entire regression test suite.
> 
> ;-)
> 
> It is somewhat surprising that with only these changes my tree is no
> longer behind the Git for Windows effort--all tests pass so everything
> should be working perfectly, right ;-)

Oh, don't you worry, there are plenty more patches in Git for Windows'
fork. Some of them will become irrelevant, others probably already did so.
The majority, though, I think will be of interest and I will submit them
over the next weeks/months (it will take a while not only because I do not
want to overload the list, but also because I have to do quite a bit of
spring cleaning).

> There were a few changes in the series that raised my eyebrows,
> which I'll respond separately, but overall it's a great
> achievement.

Thanks!
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/19] mingw: let's use gettext with MSYS2
  2016-01-25  1:42   ` Junio C Hamano
@ 2016-01-25 16:16     ` Johannes Schindelin
  2016-01-25 18:53       ` Junio C Hamano
  0 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-25 16:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Junio,

On Sun, 24 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> 
> > This solves two problems:
> >
> > - we now have proper localisation even on Windows
> >
> > - we sidestep the infamous "BUG: your vsnprintf is broken (returned -1)"
> >   message when running "git init" (which otherwise prevents the entire
> >   test suite from running)
> 
> It is unclear to me how gettext is related to use of vsnprintf().

Including libintl.h overrides vsnprintf() with the libintl_vsnprintf()
drop-in replacement that does return the expected value.

I updated the commit message (will be part of v2):

	https://github.com/dscho/git/commit/4473801e

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 13/19] mingw: outsmart MSYS2's path substitution in t1508
  2016-01-25  2:03   ` Junio C Hamano
  2016-01-25  6:22     ` Eric Sunshine
@ 2016-01-25 16:30     ` Johannes Schindelin
  2016-01-25 17:04       ` Johannes Schindelin
  1 sibling, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-25 16:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Braun, git

Hi Junio,

On Sun, 24 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> 
> > From: Thomas Braun <thomas.braun@byte-physics.de>
> >
> > A string of the form "@/abcd" is considered a file path
> > by the msys layer and therefore translated to a Windows path.
> >
> > Here the trick is to double the slashes.
> >
> > The MSYS2 patch translation can be studied by calling
> >
> > 	test-path-utils print_path <path>
> >
> > Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> 
> This feels wrong.
> 
> The point of this test is that you can ask to checkout a branch
> whose name is a strangely looking "@/at-test", and a ref whose name
> is "refs/heads/@/at-test" indeed is created.
> 
> The current "checkout" may be lazy and not signal an error for a
> branch name with two consecutive slashes, but I wouldn't be
> surprised if we tighten that later, and more importantly, I do not
> think we ever promised users if you asked a branch "a//b" to be
> created, we would create "refs/heads/a/b".
> 
> The new test hardcodes and promises such an incompatible behaviour,
> i.e. a request to create "@//b" results in "@/b" created, only to
> users on MINGW, fracturing the expectations of the Git userbase.
> 
> Wouldn't it be better to declare "On other people's Git, @/foo is
> just as normal a branch name as a/foo, but on MINGW @/foo cannot be
> used" by skipping some tests using prerequisites instead?

As Eric points out, this is not so much a behavior on Git as of the MSYS2
Bash. In fact, if you call `git.exe checkout -b @/at-test` from a cmd
window, it works just as advertised.

But your comment made me inspect the entire t9100 again, wondering why
things work when we copy the contents instead of symlinking them. And you
know what, even if I could have sworn that I verified for every patch in
this series that it is actually necessary to pass the test suite, it is
*not* necessary.

So I backed it out and it won't be part of v2 anymore.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 16/19] mingw: avoid absolute path in t0008
  2016-01-25  2:11   ` Junio C Hamano
@ 2016-01-25 16:48     ` Johannes Schindelin
  2016-01-25 19:31       ` Ray Donnelly
  2016-01-25 22:20       ` Junio C Hamano
  0 siblings, 2 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-25 16:48 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Pat Thoyts, git

Hi Junio,

On Sun, 24 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> 
> > From: Pat Thoyts <patthoyts@users.sourceforge.net>
> >
> > The test separator char is a colon which means any absolute paths on
> > Windows confuse the tests that use global_excludes.
> >
> > Suggested-by: Karsten Blees <karsten.blees@gmail.com>
> > Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> >  t/t0008-ignores.sh | 8 +++++++-
> 
> Is the fact that $global_excludes is specified using an absolute
> path significant to the correctness of this test script?

Apparently not. So I followed your suggestion and made this independent
of the OS:

	https://github.com/dscho/git/commit/0b9eb308

> A larger question is if it would make more sense for Git ported to
> Windows environment to use semicolon (that is the element separator
> for %PATH% in the Windows land, right?) instead where POSIXy port
> would use colon as the separator.  A variable that is a list of
> locations (e.g. $PATH) makes little sense when elements can only be
> relative paths in practice.

Oh my... I was not looking for more work ;-)

Seriously again, I do agree with the suggestion to use semicolons on
Windows as path lists' separators instead of colons.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 12/19] mingw: do not use symlinks with SVN in t9100
  2016-01-25  1:51   ` Junio C Hamano
@ 2016-01-25 16:53     ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-25 16:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Karsten Blees, git

Hi Junio,

On Sun, 24 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> 
> > From: Karsten Blees <blees@dcon.de>
> >
> > The SVN library does not seem to support symlinks, even if symlinks are
> > enabled in MSYS2 and Git. Use 'cp' instead of 'ln -s'.
> >
> > This partially fixes t/t9100-git-svn-basic.sh
> >
> > Signed-off-by: Karsten Blees <blees@dcon.de>
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> >  t/t9100-git-svn-basic.sh | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> For the purpose of SVN test, is it important that foo.link is a link
> to foo?  I am wondering what would be the fallout from making this
> change without "only on MINGW do this".

(I originally sent the following response as a reply to 13/19 by mistake.)

Your comment made me inspect the entire t9100 again, wondering why things
work when we copy the contents instead of symlinking them. And you know
what, even if I could have sworn that I verified for every patch in this
series that it is actually necessary to pass the test suite, it is *not*
necessary.

So I backed it out and it won't be part of v2 anymore.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 13/19] mingw: outsmart MSYS2's path substitution in t1508
  2016-01-25 16:30     ` Johannes Schindelin
@ 2016-01-25 17:04       ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-25 17:04 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Braun, git

Hi Junio,

On Mon, 25 Jan 2016, Johannes Schindelin wrote:

> On Sun, 24 Jan 2016, Junio C Hamano wrote:
> 
> > Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> > 
> > > From: Thomas Braun <thomas.braun@byte-physics.de>
> > >
> > > A string of the form "@/abcd" is considered a file path
> > > by the msys layer and therefore translated to a Windows path.
> > >
> > > Here the trick is to double the slashes.
> > >
> > > The MSYS2 patch translation can be studied by calling
> > >
> > > 	test-path-utils print_path <path>
> > >
> > > Signed-off-by: Thomas Braun <thomas.braun@byte-physics.de>
> > > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > > ---
> > 
> > This feels wrong.
> > 
> > The point of this test is that you can ask to checkout a branch
> > whose name is a strangely looking "@/at-test", and a ref whose name
> > is "refs/heads/@/at-test" indeed is created.
> > 
> > The current "checkout" may be lazy and not signal an error for a
> > branch name with two consecutive slashes, but I wouldn't be
> > surprised if we tighten that later, and more importantly, I do not
> > think we ever promised users if you asked a branch "a//b" to be
> > created, we would create "refs/heads/a/b".
> > 
> > The new test hardcodes and promises such an incompatible behaviour,
> > i.e. a request to create "@//b" results in "@/b" created, only to
> > users on MINGW, fracturing the expectations of the Git userbase.
> > 
> > Wouldn't it be better to declare "On other people's Git, @/foo is
> > just as normal a branch name as a/foo, but on MINGW @/foo cannot be
> > used" by skipping some tests using prerequisites instead?
> 
> As Eric points out, this is not so much a behavior on Git as of the MSYS2
> Bash. In fact, if you call `git.exe checkout -b @/at-test` from a cmd
> window, it works just as advertised.
> 
> But your comment made me inspect the entire t9100 again, wondering why
> things work when we copy the contents instead of symlinking them. And you
> know what, even if I could have sworn that I verified for every patch in
> this series that it is actually necessary to pass the test suite, it is
> *not* necessary.
> 
> So I backed it out and it won't be part of v2 anymore.

Whoops. This was meant to be a comment on your comment on 12/19. I'll
reply to the appropriate mail...

As to the patch 13/19 that we are discussing here, I agree that it is
better to simply skip the test with the offending argument. See

	https://github.com/dscho/git/commit/ca5edbe

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 13/19] mingw: outsmart MSYS2's path substitution in t1508
  2016-01-25  6:22     ` Eric Sunshine
@ 2016-01-25 18:50       ` Junio C Hamano
  2016-01-26  6:53         ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-25 18:50 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Johannes Schindelin, Thomas Braun, Git List

Eric Sunshine <sunshine@sunshineco.com> writes:

> On Sun, Jan 24, 2016 at 9:03 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> The new test hardcodes and promises such an incompatible behaviour,
>> i.e. a request to create "@//b" results in "@/b" created, only to
>> users on MINGW, fracturing the expectations of the Git userbase.
>
> What the commit message doesn't explain is that ...
> ...
> This commit message is trying to say that MSYS shell undesirably sees
> @/fish as an absolute path, thus tries translating it to a Windows
> path, such as @C:\fish. The only way to suppress this unwanted
> translation is to manually double the slash, hence the patch makes the
> test use @//fish which, when finally seen by the program, is just
> @/fish, as was intended in the first place. So, doubling the slash on
> MINGW is not promising incompatible behavior for MINGW users; it's
> just working around unwanted path translation of the shell.

Ah, OK, thanks for clarifying it.  Presumably you would then use
"checkout @//b" to switch to it, and "log @//b" to look at its
hsitory.  When you read "git branch" output and see "@/b" in it, you
would also not complain thinking "oh I thought I created "@//b", not
with a single branch!".

Then no issues on allowing "checkout -b @//b" to create a branch
"@/b" from me.

Thanks.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 01/19] mingw: let's use gettext with MSYS2
  2016-01-25 16:16     ` Johannes Schindelin
@ 2016-01-25 18:53       ` Junio C Hamano
  0 siblings, 0 replies; 113+ messages in thread
From: Junio C Hamano @ 2016-01-25 18:53 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> > - we sidestep the infamous "BUG: your vsnprintf is broken (returned -1)"
>> >   message when running "git init" (which otherwise prevents the entire
>> >   test suite from running)
>> 
>> It is unclear to me how gettext is related to use of vsnprintf().
>
> Including libintl.h overrides vsnprintf() with the libintl_vsnprintf()
> drop-in replacement that does return the expected value.

Ah, that makes sense.

>
> I updated the commit message (will be part of v2):
>
> 	https://github.com/dscho/git/commit/4473801e

Thanks.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 06/19] mingw: try to delete target directory before renaming
  2016-01-25  6:59     ` Johannes Schindelin
@ 2016-01-25 18:55       ` Junio C Hamano
  2016-01-26  8:14         ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-25 18:55 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Philip Oakley, git, nalla

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Hi Philip,
>
> On Sun, 24 Jan 2016, Philip Oakley wrote:
>
>> From: "Johannes Schindelin" <johannes.schindelin@gmx.de>
>> >From: 마누엘 <nalla@users.noreply.github.com>
>> 
>> Is this Nalla's preferred email, or just a carry over from cautions of the
>> Github interface?
>
> Neither. It is from the author field as recorded in the commit that I
> merged originally: https://github.com/dscho/git/pull/8

If it is not recorded under the name/email that is preferred by the
author, as I am not pulling from you but will be applying a patch,
we can fix it to match the author's desire, if we wanted to.

Your "Neither" hints that it is the case, but it is unclear to me
what address is the desired one (I can guess hamal.uberspace might
be), so...

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 16/19] mingw: avoid absolute path in t0008
  2016-01-25 16:48     ` Johannes Schindelin
@ 2016-01-25 19:31       ` Ray Donnelly
  2016-01-25 22:20       ` Junio C Hamano
  1 sibling, 0 replies; 113+ messages in thread
From: Ray Donnelly @ 2016-01-25 19:31 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, Pat Thoyts, git

On Mon, Jan 25, 2016 at 4:48 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi Junio,
>
> On Sun, 24 Jan 2016, Junio C Hamano wrote:
>
>> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
>>
>> > From: Pat Thoyts <patthoyts@users.sourceforge.net>
>> >
>> > The test separator char is a colon which means any absolute paths on
>> > Windows confuse the tests that use global_excludes.
>> >
>> > Suggested-by: Karsten Blees <karsten.blees@gmail.com>
>> > Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
>> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
>> > ---
>> >  t/t0008-ignores.sh | 8 +++++++-
>>
>> Is the fact that $global_excludes is specified using an absolute
>> path significant to the correctness of this test script?
>
> Apparently not. So I followed your suggestion and made this independent
> of the OS:
>
>         https://github.com/dscho/git/commit/0b9eb308
>
>> A larger question is if it would make more sense for Git ported to
>> Windows environment to use semicolon (that is the element separator
>> for %PATH% in the Windows land, right?) instead where POSIXy port
>> would use colon as the separator.  A variable that is a list of
>> locations (e.g. $PATH) makes little sense when elements can only be
>> relative paths in practice.
>
> Oh my... I was not looking for more work ;-)
>
> Seriously again, I do agree with the suggestion to use semicolons on
> Windows as path lists' separators instead of colons.

It definitely makes things easier from the MSYS2 path conversion
perspective. Anything that can be done to make this easier is hugely
appreciated.

>
> Ciao,
> Dscho
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 16/19] mingw: avoid absolute path in t0008
  2016-01-25 16:48     ` Johannes Schindelin
  2016-01-25 19:31       ` Ray Donnelly
@ 2016-01-25 22:20       ` Junio C Hamano
  2016-01-26  8:00         ` Johannes Schindelin
  1 sibling, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-25 22:20 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Pat Thoyts, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> Is the fact that $global_excludes is specified using an absolute
>> path significant to the correctness of this test script?
>
> Apparently not. So I followed your suggestion and made this independent
> of the OS:
>
> 	https://github.com/dscho/git/commit/0b9eb308

I see many "cd" in the script, some of which come before the global
exclude file is enabled, but others ("--stdin from subdirectory",
for example) do run from a subdirectory.  It turns out that this
file is used as the value of core.excludesfile.  By the time that
file is read in setup_standard_excludes(), presumably we have
already done setup_git_directory() and moved back to the root of the
working tree, so I guess such a change would be harmless.

It somehow makes me feel dirty, though.  But that is not a specific
problem to mingw port.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 17/19] mingw: fix git-svn tests that expect chmod to work
  2016-01-25  2:14   ` Junio C Hamano
@ 2016-01-26  6:31     ` Johannes Schindelin
  2016-01-26 17:42       ` Junio C Hamano
  0 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26  6:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

Hi Junio,

On Sun, 24 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> 
> > From: 마누엘 <nalla@users.noreply.github.com>
> >
> > Some git-svn tests expect that the executable bit of files can be
> > toggled. On Windows, this is not possible because Windows' Access
> > Control Lists are much more fine-grained than the POSIX permission
> > concept. Let's just not try to flip the executable bit.
> 
> Most of the changes are protected by !POSIXPERM but one of them
> seems to use MINGW, which looks inconsistent and I suspect was not a
> distinction made on purpose.  The above description sounds to me
> that the !POSIXPERM prerequisite is the right thing to use.

This is my fault: there are two MINGW prereqs, and they guard against
trying to work with file names ending in a dot (which is illegal on
Windows' file systems).

My original plan was to split the patch into two, but I actually reworked
the patch from scratch.

> I am not sure if it is a good idea to sprinkle test-have-prereq and
> make the test script test different things on different platforms,
> though.

I agree that this is not desirable, and I changed it where possible to
simply skip the entire test case. In some cases, however, the 'setup' test
case was affected, and of course we cannot skip that one, else everything
falls apart.

The result of my work consists of these three patches (which will be part
of v2):

	https://github.com/dscho/git/compare/ea813597~3...ea813597

Thanks,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 18/19] mingw: skip a couple of git-svn tests that cannot pass on Windows
  2016-01-25  2:16   ` Junio C Hamano
@ 2016-01-26  6:45     ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26  6:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Junio,

On Sun, 24 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> 
> > Some of the tests expect that executable bits can be toggled, others
> > expect that paths are POSIX paths (but when they come through git.exe,
> > they are converted into Windows paths and necessarily differ), yet
> > others expect symbolic links to be available.
> 
> These skip the tests that cannot possibly pass in their entirety by
> protecting them with prerequisites, which feels the right thing to
> do.  The "executable bits" ones would need to become !POSIXPERM, and
> symlink ones !SYMLINKS, though.

I reworked this in the same batch as the previous git-svn patch.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 13/19] mingw: outsmart MSYS2's path substitution in t1508
  2016-01-25 18:50       ` Junio C Hamano
@ 2016-01-26  6:53         ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26  6:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Eric Sunshine, Thomas Braun, Git List

Hi Junio,

On Mon, 25 Jan 2016, Junio C Hamano wrote:

> Eric Sunshine <sunshine@sunshineco.com> writes:
> 
> > On Sun, Jan 24, 2016 at 9:03 PM, Junio C Hamano <gitster@pobox.com> wrote:
> >> The new test hardcodes and promises such an incompatible behaviour,
> >> i.e. a request to create "@//b" results in "@/b" created, only to
> >> users on MINGW, fracturing the expectations of the Git userbase.
> >
> > What the commit message doesn't explain is that ...
> > ...
> > This commit message is trying to say that MSYS shell undesirably sees
> > @/fish as an absolute path, thus tries translating it to a Windows
> > path, such as @C:\fish. The only way to suppress this unwanted
> > translation is to manually double the slash, hence the patch makes the
> > test use @//fish which, when finally seen by the program, is just
> > @/fish, as was intended in the first place. So, doubling the slash on
> > MINGW is not promising incompatible behavior for MINGW users; it's
> > just working around unwanted path translation of the shell.
> 
> Ah, OK, thanks for clarifying it.  Presumably you would then use
> "checkout @//b" to switch to it, and "log @//b" to look at its
> hsitory.  When you read "git branch" output and see "@/b" in it, you
> would also not complain thinking "oh I thought I created "@//b", not
> with a single branch!".
> 
> Then no issues on allowing "checkout -b @//b" to create a branch
> "@/b" from me.

I actually disabled the test for MINGW instead, as I agree that we do not
want to test MSYS2 in our regression tests.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 16/19] mingw: avoid absolute path in t0008
  2016-01-25 22:20       ` Junio C Hamano
@ 2016-01-26  8:00         ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26  8:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Pat Thoyts, git

Hi Junio,

On Mon, 25 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> >> Is the fact that $global_excludes is specified using an absolute
> >> path significant to the correctness of this test script?
> >
> > Apparently not. So I followed your suggestion and made this independent
> > of the OS:
> >
> > 	https://github.com/dscho/git/commit/0b9eb308
> 
> I see many "cd" in the script, some of which come before the global
> exclude file is enabled, but others ("--stdin from subdirectory",
> for example) do run from a subdirectory.  It turns out that this
> file is used as the value of core.excludesfile.  By the time that
> file is read in setup_standard_excludes(), presumably we have
> already done setup_git_directory() and moved back to the root of the
> working tree, so I guess such a change would be harmless.

Yeah, it appears that after the entire test ran, there is only one
global-excludes file, and none of the `rm` commands removes any
global-excludes file.

> It somehow makes me feel dirty, though.  But that is not a specific
> problem to mingw port.

Well, I found the entire file a little hard to read ;-) But yeah, I do not
think that is specific to the Windows port.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 06/19] mingw: try to delete target directory before renaming
  2016-01-25 18:55       ` Junio C Hamano
@ 2016-01-26  8:14         ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26  8:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Philip Oakley, git, nalla

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

Hi Junio,

On Mon, 25 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > On Sun, 24 Jan 2016, Philip Oakley wrote:
> >
> >> From: "Johannes Schindelin" <johannes.schindelin@gmx.de>
> >> >From: 마누엘 <nalla@users.noreply.github.com>
> >> 
> >> Is this Nalla's preferred email, or just a carry over from cautions
> >> of the Github interface?
> >
> > Neither. It is from the author field as recorded in the commit that I
> > merged originally: https://github.com/dscho/git/pull/8
> 
> If it is not recorded under the name/email that is preferred by the
> author, as I am not pulling from you but will be applying a patch,
> we can fix it to match the author's desire, if we wanted to.
> 
> Your "Neither" hints that it is the case, but it is unclear to me
> what address is the desired one (I can guess hamal.uberspace might
> be), so...

The author clarified to me that the noreply "address" was used only in the
early patches, but the uberspace one is the preferred one.

I fixed it in my branch; v2 will have the fix.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH 05/19] mingw: prepare the TMPDIR environment variable for shell scripts
  2016-01-25  2:11   ` Eric Sunshine
@ 2016-01-26  8:38     ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26  8:38 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Junio C Hamano, Git List

Hi Eric,

On Sun, 24 Jan 2016, Eric Sunshine wrote:

> On Sun, Jan 24, 2016 at 10:43 AM, Johannes Schindelin
> <johannes.schindelin@gmx.de> wrote:
> > When shell scripts access a $TMPDIR variable containing backslashes,
> > they will be mistaken for escape characters. Let's not let that happen
> > by converting them to forward slashes.
> >
> > This partially fixes t7800 with MSYS2.
> >
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> > diff --git a/compat/mingw.c b/compat/mingw.c
> > @@ -2042,13 +2042,28 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
> >  static void setup_windows_environment()
> >  {
> > +       char *tmp = getenv("TMPDIR");
> > +
> >         /* on Windows it is TMP and TEMP */
> > -       if (!getenv("TMPDIR")) {
> > -               const char *tmp = getenv("TMP");
> > -               if (!tmp)
> > +       if (tmp) {
> > +               if (!(tmp = getenv("TMP")))
> >                         tmp = getenv("TEMP");
> > -               if (tmp)
> > +               if (tmp) {
> >                         setenv("TMPDIR", tmp, 1);
> > +                       tmp = getenv("TMPDIR");
> > +               }
> > +       }
> 
> Let me see if I understand this...
> 
> In the original code, if TMPDIR was *not* set, it would assign the
> value of TMP or TEMP to TEMPDIR.
> 
> The new code, however, checks TMP and TEMP only if TMPDIR is *already*
> set. Am I reading this correctly? Is this revised behavior correct?

Gaaah! When copy-pasting, I culled the exclamation point... Will be fixed
in v2 (see https://github.com/dscho/git/commit/909b0a413)

> > +       if (tmp) {
> > +               /*
> > +                * Convert all dir separators to forward slashes,
> > +                * to help shell commands called from the Git
> > +                * executable (by not mistaking the dir separators
> > +                * for escape characters).
> > +                */
> > +               for (; *tmp; tmp++)
> > +                       if (*tmp == '\\')
> > +                               *tmp = '/';
> 
> This transformation is performed on whatever memory was returned by
> getenv(). It is also performed after setenv(), so presumably setenv()
> isn't making a copy of the incoming string.

Actually, I made sure to re-getenv() after setenv():

	https://github.com/dscho/git/blob/909b0a413/compat/mingw.c#L2053

Thanks!
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH v2 00/19] Let Git's tests pass on Windows
  2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
                   ` (19 preceding siblings ...)
  2016-01-25  1:34 ` [PATCH 00/19] Let Git's tests pass on Windows Junio C Hamano
@ 2016-01-26 14:34 ` Johannes Schindelin
  2016-01-26 14:34   ` [PATCH v2 01/19] mingw: let's use gettext with MSYS2 Johannes Schindelin
                     ` (20 more replies)
  20 siblings, 21 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

This is a big milestone. With these modifications, Git's source code
does not only build without warnings in Git for Windows' SDK, but
passes the entire regression test suite.

The patch series contains three different types of patches. First,
there are a couple of real fixes that were triggered by failures in
the regression tests. Then there are a couple of fixes to the
regression tests themselves. And finally, we have to disable a couple
of tests because we simply cannot make them work on Windows.


Johannes Schindelin (16):
  mingw: let's use gettext with MSYS2
  mingw: do not trust MSYS2's MinGW gettext.sh
  Git.pm: stop assuming that absolute paths start with a slash
  mingw: prepare the TMPDIR environment variable for shell scripts
  mingw: let lstat() fail with errno == ENOTDIR when appropriate
  mingw: fix t5601-clone.sh
  mingw: accomodate t0060-path-utils for MSYS2
  mingw: disable mkfifo-based tests
  tests: turn off git-daemon tests if FIFOs are not available
  mingw: skip test in t1508 that fails due to path conversion
  mingw: fix t9700's assumption about directory separators
  mingw: work around pwd issues in the tests
  mingw: mark t9100's test cases with appropriate prereqs
  mingw: avoid illegal filename in t9118
  mingw: handle the missing POSIXPERM prereq in t9124
  mingw: do not bother to test funny file names

Karsten Blees (1):
  mingw: factor out Windows specific environment setup

Pat Thoyts (1):
  Avoid absolute path in t0008

마누엘 (1):
  mingw: try to delete target directory before renaming

 Makefile                              |  1 +
 compat/mingw.c                        | 91 +++++++++++++++++++++++++++++------
 config.mak.uname                      |  3 +-
 perl/Git.pm                           |  3 +-
 t/lib-git-daemon.sh                   |  5 ++
 t/t0008-ignores.sh                    |  2 +-
 t/t0060-path-utils.sh                 |  9 ++++
 t/t1508-at-combinations.sh            |  6 ++-
 t/t3300-funny-names.sh                |  1 +
 t/t3600-rm.sh                         |  3 +-
 t/t3703-add-magic-pathspec.sh         |  2 +-
 t/t3902-quoted.sh                     |  1 +
 t/t4016-diff-quote.sh                 |  1 +
 t/t4135-apply-weird-filenames.sh      |  3 +-
 t/t5601-clone.sh                      | 18 +++----
 t/t7800-difftool.sh                   | 14 +++---
 t/t9100-git-svn-basic.sh              | 18 +++----
 t/t9118-git-svn-funky-branch-names.sh | 12 +++--
 t/t9124-git-svn-dcommit-auto-props.sh | 16 +++---
 t/t9200-git-cvsexportcommit.sh        |  2 +-
 t/t9400-git-cvsserver-server.sh       |  6 +--
 t/t9401-git-cvsserver-crlf.sh         |  6 +--
 t/t9402-git-cvsserver-refs.sh         |  6 +--
 t/t9700/test.pl                       |  2 +-
 t/t9903-bash-prompt.sh                |  2 +-
 t/test-lib.sh                         |  2 +-
 test-fake-ssh.c                       | 30 ++++++++++++
 27 files changed, 196 insertions(+), 69 deletions(-)
 create mode 100644 test-fake-ssh.c

Interdiff vs v1:

 diff --git a/compat/mingw.c b/compat/mingw.c
 index 9e60335..f7acb7f 100644
 --- a/compat/mingw.c
 +++ b/compat/mingw.c
 @@ -2089,7 +2089,7 @@ static void setup_windows_environment()
  	char *tmp = getenv("TMPDIR");
  
  	/* on Windows it is TMP and TEMP */
 -	if (tmp) {
 +	if (!tmp) {
  		if (!(tmp = getenv("TMP")))
  			tmp = getenv("TEMP");
  		if (tmp) {
 diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
 index 68749f5..89544dd 100755
 --- a/t/t0008-ignores.sh
 +++ b/t/t0008-ignores.sh
 @@ -5,13 +5,7 @@ test_description=check-ignore
  . ./test-lib.sh
  
  init_vars () {
 -	# On Windows, avoid using "C:" in the global-excludes paths.
 -	if test_have_prereq MINGW
 -	then
 -		global_excludes="global-excludes"
 -	else
 -		global_excludes="$(pwd)/global-excludes"
 -	fi
 +	global_excludes="global-excludes"
  }
  
  enable_global_excludes () {
 diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
 index 89d03e7..8532a02 100755
 --- a/t/t0060-path-utils.sh
 +++ b/t/t0060-path-utils.sh
 @@ -7,13 +7,6 @@ test_description='Test various path utilities'
  
  . ./test-lib.sh
  
 -# On Windows, the root directory "/" is translated into a Windows directory.
 -# As it is not well-defined whether that Windows directory should end in a
 -# slash or not, let's test for that and adjust our expected longest ancestor
 -# length accordingly.
 -root_offset=0
 -case "$(test-path-utils print_path /)" in ?*/) root_offset=-1;; esac
 -
  norm_path() {
  	expected=$(test-path-utils print_path "$2")
  	test_expect_success $3 "normalize path: $1 => $2" \
 @@ -43,12 +36,21 @@ if test $rootoff = 2; then
  	rootoff=	# we are on Unix
  else
  	rootoff=$(($rootoff-1))
 +	# In MSYS2, the root directory "/" is translated into a Windows
 +	# directory *with* trailing slash. Let's test for that and adjust
 +	# our expected longest ancestor length accordingly.
 +	case "$(test-path-utils print_path /)" in
 +	*/) rootslash=1;;
 +	*) rootslash=0;;
 +	esac
  fi
  
  ancestor() {
  	# We do some math with the expected ancestor length.
  	expected=$3
  	if test -n "$rootoff" && test "x$expected" != x-1; then
 +		expected=$(($expected-$rootslash))
 +		test $expected -lt 0 ||
  		expected=$(($expected+$rootoff))
  	fi
  	test_expect_success "longest ancestor: $1 $2 => $expected" \
 @@ -119,30 +121,30 @@ norm_path /d1/.../d2 /d1/.../d2
  norm_path /d1/..././../d2 /d1/d2
  
  ancestor / / -1
 -ancestor /foo / $root_offset
 +ancestor /foo / 0
  ancestor /foo /fo -1
  ancestor /foo /foo -1
  ancestor /foo /bar -1
  ancestor /foo /foo/bar -1
  ancestor /foo /foo:/bar -1
 -ancestor /foo /:/foo:/bar $root_offset
 -ancestor /foo /foo:/:/bar $root_offset
 -ancestor /foo /:/bar:/foo $root_offset
 -ancestor /foo/bar / $root_offset
 +ancestor /foo /:/foo:/bar 0
 +ancestor /foo /foo:/:/bar 0
 +ancestor /foo /:/bar:/foo 0
 +ancestor /foo/bar / 0
  ancestor /foo/bar /fo -1
 -ancestor /foo/bar /foo $((4+$root_offset))
 +ancestor /foo/bar /foo 4
  ancestor /foo/bar /foo/ba -1
 -ancestor /foo/bar /:/fo $root_offset
 -ancestor /foo/bar /foo:/foo/ba $((4+$root_offset))
 +ancestor /foo/bar /:/fo 0
 +ancestor /foo/bar /foo:/foo/ba 4
  ancestor /foo/bar /bar -1
  ancestor /foo/bar /fo -1
 -ancestor /foo/bar /foo:/bar $((4+$root_offset))
 -ancestor /foo/bar /:/foo:/bar $((4+$root_offset))
 -ancestor /foo/bar /foo:/:/bar $((4+$root_offset))
 -ancestor /foo/bar /:/bar:/fo $root_offset
 -ancestor /foo/bar /:/bar $root_offset
 -ancestor /foo/bar /foo $((4+$root_offset))
 -ancestor /foo/bar /foo:/bar $((4+$root_offset))
 +ancestor /foo/bar /foo:/bar 4
 +ancestor /foo/bar /:/foo:/bar 4
 +ancestor /foo/bar /foo:/:/bar 4
 +ancestor /foo/bar /:/bar:/fo 0
 +ancestor /foo/bar /:/bar 0
 +ancestor /foo/bar /foo 4
 +ancestor /foo/bar /foo:/bar 4
  ancestor /foo/bar /bar -1
  
  test_expect_success 'strip_path_suffix' '
 diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
 index 1d9fd7b..c59d554 100755
 --- a/t/t1508-at-combinations.sh
 +++ b/t/t1508-at-combinations.sh
 @@ -29,22 +29,16 @@ fail() {
  	"$@" failure
  }
  
 -if test_have_prereq MINGW
 -then
 -	# MSYS2 interprets `@/abc` to be a file list, and wants to substitute
 -	# the Unix-y path with a Windows one (e.g. @C:\msys64\abc)
 -	AT_SLASH=@//at-test
 -else
 -	AT_SLASH=@/at-test
 -fi
 -
  test_expect_success 'setup' '
  	test_commit master-one &&
  	test_commit master-two &&
  	git checkout -b upstream-branch &&
  	test_commit upstream-one &&
  	test_commit upstream-two &&
 -	git checkout -b $AT_SLASH &&
 +	if ! test_have_prereq MINGW
 +	then
 +		git checkout -b @/at-slash
 +	fi &&
  	git checkout -b @@/at-test &&
  	git checkout -b @at-test &&
  	git checkout -b old-branch &&
 @@ -73,7 +67,8 @@ check "@{-1}@{u}@{1}" commit master-one
  check "@" commit new-two
  check "@@{u}" ref refs/heads/upstream-branch
  check "@@/at-test" ref refs/heads/@@/at-test
 -check "$AT_SLASH" ref refs/heads/@/at-test
 +test_have_prereq MINGW ||
 +check "@/at-test" ref refs/heads/@/at-test
  check "@at-test" ref refs/heads/@at-test
  nonsense "@{u}@{-1}"
  nonsense "@{0}@{0}"
 diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
 index 8c74ffa..5b32a3b 100755
 --- a/t/t9100-git-svn-basic.sh
 +++ b/t/t9100-git-svn-basic.sh
 @@ -25,23 +25,12 @@ test_expect_success \
  	(
  		cd import &&
  		echo foo >foo &&
 -		if test_have_prereq !MINGW
 -		then
 -			ln -s foo foo.link
 -		else
 -			# MSYS libsvn does not support symlinks, so always use cp, even if
 -			# ln -s actually works
 -			cp foo foo.link
 -		fi
 +		ln -s foo foo.link
  		mkdir -p dir/a/b/c/d/e &&
  		echo "deep dir" >dir/a/b/c/d/e/file &&
  		mkdir bar &&
  		echo "zzz" >bar/zzz &&
 -		echo "#!/bin/sh" >exec.sh &&
 -		{
 -			test_have_prereq !POSIXPERM ||
 -			chmod +x exec.sh
 -		} &&
 +		printf "" | write_script exec.sh &&
  		svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null
  	) &&
  	rm -rf import &&
 @@ -127,7 +116,7 @@ test_expect_success "$name" '
  
  
  name='remove executable bit from a file'
 -test_expect_success !MINGW "$name" '
 +test_expect_success POSIXPERM "$name" '
  	rm -f "$GIT_DIR"/index &&
  	git checkout -f -b mybranch5 ${remotes_git_svn} &&
  	chmod -x exec.sh &&
 @@ -140,7 +129,7 @@ test_expect_success !MINGW "$name" '
  
  
  name='add executable bit back file'
 -test_expect_success !MINGW "$name" '
 +test_expect_success POSIXPERM "$name" '
  	chmod +x exec.sh &&
  	git update-index exec.sh &&
  	git commit -m "$name" &&
 @@ -151,7 +140,7 @@ test_expect_success !MINGW "$name" '
  
  
  name='executable file becomes a symlink to file'
 -test_expect_success !MINGW "$name" '
 +test_expect_success SYMLINKS "$name" '
  	rm exec.sh &&
  	ln -s file exec.sh &&
  	git update-index exec.sh &&
 @@ -163,7 +152,8 @@ test_expect_success !MINGW "$name" '
  
  name='new symlink is added to a file that was also just made executable'
  
 -test_expect_success !MINGW "$name" '
 +test_expect_success POSIXPERM,SYMLINKS "$name" '
 +	chmod +x file &&
  	ln -s file exec-2.sh &&
  	git update-index --add file exec-2.sh &&
  	git commit -m "$name" &&
 @@ -174,7 +164,7 @@ test_expect_success !MINGW "$name" '
  	test -h "$SVN_TREE"/exec-2.sh'
  
  name='modify a symlink to become a file'
 -test_expect_success !MINGW "$name" '
 +test_expect_success POSIXPERM,SYMLINKS "$name" '
  	echo git help >help &&
  	rm exec-2.sh &&
  	cp help exec-2.sh &&
 @@ -190,7 +180,8 @@ test_expect_success !MINGW "$name" '
  name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
  LC_ALL="$GIT_SVN_LC_ALL"
  export LC_ALL
 -test_expect_success !MINGW,UTF8 "$name" "
 +# This test relies on the previous test, hence requires POSIXPERM,SYMLINKS
 +test_expect_success UTF8,POSIXPERM,SYMLINKS "$name" "
  	echo '# hello' >> exec-2.sh &&
  	git update-index exec-2.sh &&
  	git commit -m 'éï∏' &&
 @@ -223,7 +214,7 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
  tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4
  EOF
  
 -test_expect_success !MINGW "$name" "test_cmp a expected"
 +test_expect_success POSIXPERM,SYMLINKS "$name" "test_cmp a expected"
  
  test_expect_success 'exit if remote refs are ambigious' "
          git config --add svn-remote.svn.fetch \
 diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh
 index 49775a5..ecb1fed 100755
 --- a/t/t9118-git-svn-funky-branch-names.sh
 +++ b/t/t9118-git-svn-funky-branch-names.sh
 @@ -23,11 +23,11 @@ test_expect_success 'setup svnrepo' '
  	              "$svnrepo/pr ject/branches/$scary_uri" &&
  	svn_cmd cp -m "leading dot" "$svnrepo/pr ject/trunk" \
  			"$svnrepo/pr ject/branches/.leading_dot" &&
 -	{
 -		test_have_prereq MINGW ||
 +	if test_have_prereq !MINGW
 +	then
  		svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
  			"$svnrepo/pr ject/branches/trailing_dot."
 -	} &&
 +	fi &&
  	svn_cmd cp -m "trailing .lock" "$svnrepo/pr ject/trunk" \
  			"$svnrepo/pr ject/branches/trailing_dotlock.lock" &&
  	svn_cmd cp -m "reflog" "$svnrepo/pr ject/trunk" \
 @@ -48,10 +48,10 @@ test_expect_success 'test clone with funky branch names' '
  		git rev-parse "refs/remotes/origin/more%20fun%20plugin!" &&
  		git rev-parse "refs/remotes/origin/$scary_ref" &&
  		git rev-parse "refs/remotes/origin/%2Eleading_dot" &&
 -		{
 -			test_have_prereq MINGW ||
 +		if test_have_prereq !MINGW
 +		then
  			git rev-parse "refs/remotes/origin/trailing_dot%2E"
 -		} &&
 +		fi &&
  		git rev-parse "refs/remotes/origin/trailing_dotlock%2Elock" &&
  		git rev-parse "refs/remotes/origin/$non_reflog"
  	)
 diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh
 index c851121..2be0805 100755
 --- a/t/t9124-git-svn-dcommit-auto-props.sh
 +++ b/t/t9124-git-svn-dcommit-auto-props.sh
 @@ -34,11 +34,7 @@ test_expect_success 'enable auto-props config' '
  '
  
  test_expect_success 'add files matching auto-props' '
 -	echo "#!$SHELL_PATH" >exec1.sh &&
 -	{
 -		test_have_prereq !POSIXPERM ||
 -		chmod +x exec1.sh
 -	} &&
 +	printf "" | write_script exec1.sh &&
  	echo "hello" >hello.txt &&
  	echo bar >bar &&
  	git add exec1.sh hello.txt bar &&
 @@ -51,11 +47,7 @@ test_expect_success 'disable auto-props config' '
  '
  
  test_expect_success 'add files matching disabled auto-props' '
 -	echo "#$SHELL_PATH" >exec2.sh &&
 -	{
 -		test_have_prereq !POSIXPERM ||
 -		chmod +x exec2.sh
 -	} &&
 +	printf "" | write_script exec2.sh &&
  	echo "world" >world.txt &&
  	echo zot >zot &&
  	git add exec2.sh world.txt zot &&
 @@ -71,10 +63,10 @@ test_expect_success 'check resulting svn repository' '
  	cd svnrepo &&
  
  	# Check properties from first commit.
 -	{
 -		test_have_prereq !POSIXPERM ||
 -		test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*"
 -	} &&
 +	if test_have_prereq POSIXPERM
 +	then
 +		test -z "$(svn_cmd propget svn:executable exec1.sh)"
 +	fi &&
  	test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \
  	     "xapplication/x-shellscript" &&
  	test "x$(svn_cmd propget svn:mime-type hello.txt)" = "xtext/plain" &&
 @@ -82,10 +74,10 @@ test_expect_success 'check resulting svn repository' '
  	test "x$(svn_cmd propget svn:mime-type bar)" = "x" &&
  
  	# Check properties from second commit.
 -	{
 -		test_have_prereq !POSIXPERM ||
 -		test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*"
 -	} &&
 +	if test_have_prereq POSIXPERM
 +	then
 +		test -z "$(svn_cmd propget svn:executable exec2.sh)"
 +	fi &&
  	test "x$(svn_cmd propget svn:mime-type exec2.sh)" = "x" &&
  	test "x$(svn_cmd propget svn:mime-type world.txt)" = "x" &&
  	test "x$(svn_cmd propget svn:eol-style world.txt)" = "x" &&
 diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh
 index 4126481..d306b77 100755
 --- a/t/t9130-git-svn-authors-file.sh
 +++ b/t/t9130-git-svn-authors-file.sh
 @@ -91,7 +91,7 @@ test_expect_success 'fetch continues after authors-file is fixed' '
  	)
  	'
  
 -test_expect_success !MINGW 'fresh clone with svn.authors-file in config' '
 +test_expect_success 'fresh clone with svn.authors-file in config' '
  	(
  		rm -r "$GIT_DIR" &&
  		test x = x"$(git config svn.authorsfile)" &&

-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH v2 01/19] mingw: let's use gettext with MSYS2
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
@ 2016-01-26 14:34   ` Johannes Schindelin
  2016-01-26 14:34   ` [PATCH v2 02/19] mingw: do not trust MSYS2's MinGW gettext.sh Johannes Schindelin
                     ` (19 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This solves two problems:

- we now have proper localisation even on Windows

- we sidestep the infamous "BUG: your vsnprintf is broken (returned -1)"
  message when running "git init" (which otherwise prevents the entire
  test suite from running) because libintl.h overrides vsnprintf() with
  libintl_vsnprintf() [*1*]

The latter issue is rather crucial, as *no* test passes in Git for
Windows without this fix.

Footnote *1*: gettext_git=http://git.savannah.gnu.org/cgit/gettext.git
$gettext_git/tree/gettext-runtime/intl/libgnuintl.in.h#n380

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mak.uname b/config.mak.uname
index 4b2e1b8..6b25661 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -560,7 +560,7 @@ else
 		NO_R_TO_GCC_LINKER = YesPlease
 		INTERNAL_QSORT = YesPlease
 		HAVE_LIBCHARSET_H = YesPlease
-		NO_GETTEXT = YesPlease
+		NO_GETTEXT =
 		USE_LIBPCRE= YesPlease
 		NO_CURL =
 		USE_NED_ALLOCATOR = YesPlease
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 02/19] mingw: do not trust MSYS2's MinGW gettext.sh
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
  2016-01-26 14:34   ` [PATCH v2 01/19] mingw: let's use gettext with MSYS2 Johannes Schindelin
@ 2016-01-26 14:34   ` Johannes Schindelin
  2016-01-26 14:34   ` [PATCH v2 03/19] Git.pm: stop assuming that absolute paths start with a slash Johannes Schindelin
                     ` (18 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

It does not quite work because it produces DOS line endings which the
shell does not like at all.

This lets t0200-gettext-basic.sh, t0204-gettext-reencode-sanity.sh,
t3406-rebase-message.sh, t3903-stash.sh, t7400-submodule-basic.sh,
t7401-submodule-summary.sh, t7406-submodule-update.sh and
t7407-submodule-foreach.sh pass in Git for Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname | 1 +
 1 file changed, 1 insertion(+)

diff --git a/config.mak.uname b/config.mak.uname
index 6b25661..d6f7980 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -561,6 +561,7 @@ else
 		INTERNAL_QSORT = YesPlease
 		HAVE_LIBCHARSET_H = YesPlease
 		NO_GETTEXT =
+		USE_GETTEXT_SCHEME = fallthrough
 		USE_LIBPCRE= YesPlease
 		NO_CURL =
 		USE_NED_ALLOCATOR = YesPlease
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 03/19] Git.pm: stop assuming that absolute paths start with a slash
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
  2016-01-26 14:34   ` [PATCH v2 01/19] mingw: let's use gettext with MSYS2 Johannes Schindelin
  2016-01-26 14:34   ` [PATCH v2 02/19] mingw: do not trust MSYS2's MinGW gettext.sh Johannes Schindelin
@ 2016-01-26 14:34   ` Johannes Schindelin
  2016-01-26 14:34   ` [PATCH v2 04/19] mingw: factor out Windows specific environment setup Johannes Schindelin
                     ` (17 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Windows, absolute paths never start with a slash, unless a POSIX
emulation layer is used. The latter is the case for MSYS2's Perl that
Git for Windows leverages. However, in the tests we also go through
plain `git.exe`, which does *not* leverage the POSIX emulation layer,
and therefore the paths we pass to Perl may actually be DOS-style paths
such as C:/Program Files/Git.

So let's just use Perl's own way to test whether a given path is
absolute or not instead of home-brewing our own.

This patch partially fixes t7800 and t9700 when running in Git for
Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 perl/Git.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/perl/Git.pm b/perl/Git.pm
index 19ef081..49eb88a 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -188,7 +188,8 @@ sub repository {
 		};
 
 		if ($dir) {
-			$dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir;
+			_verify_require();
+			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.
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 04/19] mingw: factor out Windows specific environment setup
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (2 preceding siblings ...)
  2016-01-26 14:34   ` [PATCH v2 03/19] Git.pm: stop assuming that absolute paths start with a slash Johannes Schindelin
@ 2016-01-26 14:34   ` Johannes Schindelin
  2016-01-26 14:34   ` [PATCH v2 05/19] mingw: prepare the TMPDIR environment variable for shell scripts Johannes Schindelin
                     ` (16 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Karsten Blees, git

From: Karsten Blees <blees@dcon.de>

We will add more environment-related code to that new function
in the next patch.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 8437c9a..a12197e 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2040,6 +2040,22 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
 	return -1;
 }
 
+static void setup_windows_environment()
+{
+	/* on Windows it is TMP and TEMP */
+	if (!getenv("TMPDIR")) {
+		const char *tmp = getenv("TMP");
+		if (!tmp)
+			tmp = getenv("TEMP");
+		if (tmp)
+			setenv("TMPDIR", tmp, 1);
+	}
+
+	/* simulate TERM to enable auto-color (see color.c) */
+	if (!getenv("TERM"))
+		setenv("TERM", "cygwin", 1);
+}
+
 /*
  * Disable MSVCRT command line wildcard expansion (__getmainargs called from
  * mingw startup code, see init.c in mingw runtime).
@@ -2118,19 +2134,7 @@ void mingw_startup()
 	qsort(environ, i, sizeof(char*), compareenv);
 
 	/* fix Windows specific environment settings */
-
-	/* on Windows it is TMP and TEMP */
-	if (!mingw_getenv("TMPDIR")) {
-		const char *tmp = mingw_getenv("TMP");
-		if (!tmp)
-			tmp = mingw_getenv("TEMP");
-		if (tmp)
-			setenv("TMPDIR", tmp, 1);
-	}
-
-	/* simulate TERM to enable auto-color (see color.c) */
-	if (!getenv("TERM"))
-		setenv("TERM", "cygwin", 1);
+	setup_windows_environment();
 
 	/* initialize critical section for waitpid pinfo_t list */
 	InitializeCriticalSection(&pinfo_cs);
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 05/19] mingw: prepare the TMPDIR environment variable for shell scripts
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (3 preceding siblings ...)
  2016-01-26 14:34   ` [PATCH v2 04/19] mingw: factor out Windows specific environment setup Johannes Schindelin
@ 2016-01-26 14:34   ` Johannes Schindelin
  2016-01-26 14:34   ` [PATCH v2 06/19] mingw: try to delete target directory before renaming Johannes Schindelin
                     ` (15 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

When shell scripts access a $TMPDIR variable containing backslashes,
they will be mistaken for escape characters. Let's not let that happen
by converting them to forward slashes.

This partially fixes t7800 with MSYS2.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index a12197e..ba6bdb5 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2042,13 +2042,28 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
 
 static void setup_windows_environment()
 {
+	char *tmp = getenv("TMPDIR");
+
 	/* on Windows it is TMP and TEMP */
-	if (!getenv("TMPDIR")) {
-		const char *tmp = getenv("TMP");
-		if (!tmp)
+	if (!tmp) {
+		if (!(tmp = getenv("TMP")))
 			tmp = getenv("TEMP");
-		if (tmp)
+		if (tmp) {
 			setenv("TMPDIR", tmp, 1);
+			tmp = getenv("TMPDIR");
+		}
+	}
+
+	if (tmp) {
+		/*
+		 * Convert all dir separators to forward slashes,
+		 * to help shell commands called from the Git
+		 * executable (by not mistaking the dir separators
+		 * for escape characters).
+		 */
+		for (; *tmp; tmp++)
+			if (*tmp == '\\')
+				*tmp = '/';
 	}
 
 	/* simulate TERM to enable auto-color (see color.c) */
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 06/19] mingw: try to delete target directory before renaming
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (4 preceding siblings ...)
  2016-01-26 14:34   ` [PATCH v2 05/19] mingw: prepare the TMPDIR environment variable for shell scripts Johannes Schindelin
@ 2016-01-26 14:34   ` Johannes Schindelin
  2016-01-26 14:34   ` [PATCH v2 07/19] mingw: let lstat() fail with errno == ENOTDIR when appropriate Johannes Schindelin
                     ` (14 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: 마누엘, git

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

From: =?UTF-8?q?=EB=A7=88=EB=88=84=EC=97=98?= <nalla@hamal.uberspace.de>

When the rename() function tries to move a directory it fails if the
target directory exists. It should check if it can delete the (possibly
empty) target directory and then try again to move the directory.

This partially fixes t9100-git-svn-basic.sh.

Signed-off-by: 마누엘 <nalla@hamal.uberspace.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index ba6bdb5..11b905d 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1603,7 +1603,12 @@ repeat:
 	if (gle == ERROR_ACCESS_DENIED &&
 	    (attrs = GetFileAttributesW(wpnew)) != INVALID_FILE_ATTRIBUTES) {
 		if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
-			errno = EISDIR;
+			DWORD attrsold = GetFileAttributesW(wpold);
+			if (attrsold == INVALID_FILE_ATTRIBUTES ||
+			    !(attrsold & FILE_ATTRIBUTE_DIRECTORY))
+				errno = EISDIR;
+			else if (!_wrmdir(wpnew))
+				goto repeat;
 			return -1;
 		}
 		if ((attrs & FILE_ATTRIBUTE_READONLY) &&
-- 
2.7.0.windows.1.7.g55a05c8


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 07/19] mingw: let lstat() fail with errno == ENOTDIR when appropriate
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (5 preceding siblings ...)
  2016-01-26 14:34   ` [PATCH v2 06/19] mingw: try to delete target directory before renaming Johannes Schindelin
@ 2016-01-26 14:34   ` Johannes Schindelin
  2016-01-26 14:34   ` [PATCH v2 08/19] mingw: fix t5601-clone.sh Johannes Schindelin
                     ` (13 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

POSIX semantics requires lstat() to fail with ENOTDIR when "[a]
component of the path prefix names an existing file that is neither a
directory nor a symbolic link to a directory".

See http://pubs.opengroup.org/onlinepubs/9699919799/functions/lstat.html

This behavior is expected by t1404-update-ref-df-conflicts now.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/compat/mingw.c b/compat/mingw.c
index 11b905d..f7acb7f 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -454,6 +454,39 @@ static inline time_t filetime_to_time_t(const FILETIME *ft)
 	return (time_t)(filetime_to_hnsec(ft) / 10000000);
 }
 
+/**
+ * Verifies that safe_create_leading_directories() would succeed.
+ */
+static int has_valid_directory_prefix(wchar_t *wfilename)
+{
+	int n = wcslen(wfilename);
+
+	while (n > 0) {
+		wchar_t c = wfilename[--n];
+		DWORD attributes;
+
+		if (!is_dir_sep(c))
+			continue;
+
+		wfilename[n] = L'\0';
+		attributes = GetFileAttributesW(wfilename);
+		wfilename[n] = c;
+		if (attributes == FILE_ATTRIBUTE_DIRECTORY ||
+				attributes == FILE_ATTRIBUTE_DEVICE)
+			return 1;
+		if (attributes == INVALID_FILE_ATTRIBUTES)
+			switch (GetLastError()) {
+			case ERROR_PATH_NOT_FOUND:
+				continue;
+			case ERROR_FILE_NOT_FOUND:
+				/* This implies parent directory exists. */
+				return 1;
+			}
+		return 0;
+	}
+	return 1;
+}
+
 /* We keep the do_lstat code in a separate function to avoid recursion.
  * When a path ends with a slash, the stat will fail with ENOENT. In
  * this case, we strip the trailing slashes and stat again.
@@ -514,6 +547,12 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
 	case ERROR_NOT_ENOUGH_MEMORY:
 		errno = ENOMEM;
 		break;
+	case ERROR_PATH_NOT_FOUND:
+		if (!has_valid_directory_prefix(wfilename)) {
+			errno = ENOTDIR;
+			break;
+		}
+		/* fallthru */
 	default:
 		errno = ENOENT;
 		break;
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 08/19] mingw: fix t5601-clone.sh
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (6 preceding siblings ...)
  2016-01-26 14:34   ` [PATCH v2 07/19] mingw: let lstat() fail with errno == ENOTDIR when appropriate Johannes Schindelin
@ 2016-01-26 14:34   ` Johannes Schindelin
  2016-01-26 14:35   ` [PATCH v2 09/19] mingw: accomodate t0060-path-utils for MSYS2 Johannes Schindelin
                     ` (12 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:34 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Since baaf233 (connect: improve check for plink to reduce false
positives, 2015-04-26), t5601 writes out a `plink.exe` for testing that
is actually a shell script. So the assumption that the `.exe` extension
implies that the file is *not* a shell script is now wrong.

Since there was no love for the idea of allowing `.exe` files to be
shell scripts on Windows, let's go the other way round: *make*
`plink.exe` a real `.exe`.

This fixes t5601-clone.sh in Git for Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile         |  1 +
 t/t5601-clone.sh | 18 ++++++++----------
 test-fake-ssh.c  | 30 ++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 10 deletions(-)
 create mode 100644 test-fake-ssh.c

diff --git a/Makefile b/Makefile
index fc2f1ab..10566d6 100644
--- a/Makefile
+++ b/Makefile
@@ -583,6 +583,7 @@ TEST_PROGRAMS_NEED_X += test-delta
 TEST_PROGRAMS_NEED_X += test-dump-cache-tree
 TEST_PROGRAMS_NEED_X += test-dump-split-index
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
+TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-genrandom
 TEST_PROGRAMS_NEED_X += test-hashmap
 TEST_PROGRAMS_NEED_X += test-index-version
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 669ec9b..2f4272a 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -4,6 +4,9 @@ test_description=clone
 
 . ./test-lib.sh
 
+X=
+! test_have_prereq MINGW || X=.exe
+
 test_expect_success setup '
 
 	rm -fr .git &&
@@ -305,14 +308,9 @@ test_expect_success 'clone checking out a tag' '
 
 setup_ssh_wrapper () {
 	test_expect_success 'setup ssh wrapper' '
-		write_script "$TRASH_DIRECTORY/ssh-wrapper" <<-\EOF &&
-		echo >>"$TRASH_DIRECTORY/ssh-output" "ssh: $*" &&
-		# throw away all but the last argument, which should be the
-		# command
-		while test $# -gt 1; do shift; done
-		eval "$1"
-		EOF
-		GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
+		cp "$GIT_BUILD_DIR/test-fake-ssh$X" \
+			"$TRASH_DIRECTORY/ssh-wrapper$X" &&
+		GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper$X" &&
 		export GIT_SSH &&
 		export TRASH_DIRECTORY &&
 		>"$TRASH_DIRECTORY"/ssh-output
@@ -320,8 +318,8 @@ setup_ssh_wrapper () {
 }
 
 copy_ssh_wrapper_as () {
-	cp "$TRASH_DIRECTORY/ssh-wrapper" "$1" &&
-	GIT_SSH="$1" &&
+	cp "$TRASH_DIRECTORY/ssh-wrapper$X" "${1%$X}$X" &&
+	GIT_SSH="${1%$X}$X" &&
 	export GIT_SSH
 }
 
diff --git a/test-fake-ssh.c b/test-fake-ssh.c
new file mode 100644
index 0000000..980de21
--- /dev/null
+++ b/test-fake-ssh.c
@@ -0,0 +1,30 @@
+#include "git-compat-util.h"
+#include "run-command.h"
+#include "strbuf.h"
+
+int main(int argc, char **argv)
+{
+	const char *trash_directory = getenv("TRASH_DIRECTORY");
+	struct strbuf buf = STRBUF_INIT;
+	FILE *f;
+	int i;
+	const char *child_argv[] = { NULL, NULL };
+
+	/* First, print all parameters into $TRASH_DIRECTORY/ssh-output */
+	if (!trash_directory)
+		die("Need a TRASH_DIRECTORY!");
+	strbuf_addf(&buf, "%s/ssh-output", trash_directory);
+	f = fopen(buf.buf, "w");
+	if (!f)
+		die("Could not write to %s", buf.buf);
+	for (i = 0; i < argc; i++)
+		fprintf(f, "%s%s", i > 0 ? " " : "", i > 0 ? argv[i] : "ssh:");
+	fprintf(f, "\n");
+	fclose(f);
+
+	/* Now, evaluate the *last* parameter */
+	if (argc < 2)
+		return 0;
+	child_argv[0] = argv[argc - 1];
+	return run_command_v_opt(child_argv, RUN_USING_SHELL);
+}
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 09/19] mingw: accomodate t0060-path-utils for MSYS2
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (7 preceding siblings ...)
  2016-01-26 14:34   ` [PATCH v2 08/19] mingw: fix t5601-clone.sh Johannes Schindelin
@ 2016-01-26 14:35   ` Johannes Schindelin
  2016-01-26 14:35   ` [PATCH v2 10/19] mingw: disable mkfifo-based tests Johannes Schindelin
                     ` (11 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Windows, there are no POSIX paths, only Windows ones (an absolute
Windows path looks like "C:\Program Files\Git\ReleaseNotes.html", under
most circumstances, forward slashes are also allowed and synonymous to
backslashes).

So when a POSIX shell (such as MSYS2's Bash, which is used by Git for
Windows to execute all those shell scripts that are part of Git) passes
a POSIX path to test-path-utils.exe (which is not POSIX-aware), the path
is translated into a Windows path. For example, /etc/profile becomes
C:/Program Files/Git/etc/profile.

This path translation poses a problem when passing the root directory as
parameter to test-path-utils.exe, as it is not well defined whether the
translated root directory should end in a slash or not. MSys1 stripped
the trailing slash, but MSYS2 does not.

Originally, the Git for Windows project patched MSYS2's runtime to
accomodate Git's regression test, but we really should do it the other
way round.

To work with both of MSys1's and MSYS2's behaviors, we simply test what
the current system does in the beginning of t0060-path-utils.sh and then
adjust the expected longest ancestor length accordingly.

It looks quite a bit tricky what we actually do in this patch: first, we
adjust the expected length for the trailing slash we did not originally
expect (subtracting one). So far, so good.

But now comes the part where things work in a surprising way: when the
expected length was 0, the prefix to match is the root directory. If the
root directory is converted into a path with a trailing slash, however,
we know that the logic in longest_ancestor_length() cannot match: to
avoid partial matches of the last directory component, it verifies that
the character after the matching prefix is a slash (but because the
slash was part of the matching prefix, the next character cannot be a
slash). So the return value is -1. Alas, this is exactly what the
expected length is after subtracting the value of $rootslash! So we skip
adding the $rootoff value in that case (and only in that case).

Directories other than the root directory are handled fine (as they are
specified without a trailing slash, something not possible for the root
directory, and MSYS2 converts them into Windows paths that also lack
trailing slashes), therefore we do not need any more special handling.

Thanks to Ray Donnelly for his patient help with this issue.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t0060-path-utils.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index f0152a7..8532a02 100755
--- a/t/t0060-path-utils.sh
+++ b/t/t0060-path-utils.sh
@@ -36,12 +36,21 @@ if test $rootoff = 2; then
 	rootoff=	# we are on Unix
 else
 	rootoff=$(($rootoff-1))
+	# In MSYS2, the root directory "/" is translated into a Windows
+	# directory *with* trailing slash. Let's test for that and adjust
+	# our expected longest ancestor length accordingly.
+	case "$(test-path-utils print_path /)" in
+	*/) rootslash=1;;
+	*) rootslash=0;;
+	esac
 fi
 
 ancestor() {
 	# We do some math with the expected ancestor length.
 	expected=$3
 	if test -n "$rootoff" && test "x$expected" != x-1; then
+		expected=$(($expected-$rootslash))
+		test $expected -lt 0 ||
 		expected=$(($expected+$rootoff))
 	fi
 	test_expect_success "longest ancestor: $1 $2 => $expected" \
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 10/19] mingw: disable mkfifo-based tests
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (8 preceding siblings ...)
  2016-01-26 14:35   ` [PATCH v2 09/19] mingw: accomodate t0060-path-utils for MSYS2 Johannes Schindelin
@ 2016-01-26 14:35   ` Johannes Schindelin
  2016-01-26 14:35   ` [PATCH v2 11/19] tests: turn off git-daemon tests if FIFOs are not available Johannes Schindelin
                     ` (10 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

MSYS2 (the POSIX emulation layer used by Git for Windows' Bash) actually
has a working mkfifo. The only problem is that it is only emulating
named pipes through the MSYS2 runtime; The Win32 API has no idea about
named pipes, hence the Git executable cannot access those pipes either.

The symptom is that Git fails with a '<name>: No such file or directory'
because MSYS2 emulates named pipes through special-crafted '.lnk' files.

The solution is to tell the test suite explicitly that we cannot use
named pipes when we want to test on Windows.

This lets t4056-diff-order.sh, t9010-svn-fe.sh and t9300-fast-import.sh
pass.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/test-lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index bd4b02e..1470c8d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -998,7 +998,7 @@ test_i18ngrep () {
 test_lazy_prereq PIPE '
 	# test whether the filesystem supports FIFOs
 	case $(uname -s) in
-	CYGWIN*)
+	CYGWIN*|MINGW*)
 		false
 		;;
 	*)
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 11/19] tests: turn off git-daemon tests if FIFOs are not available
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (9 preceding siblings ...)
  2016-01-26 14:35   ` [PATCH v2 10/19] mingw: disable mkfifo-based tests Johannes Schindelin
@ 2016-01-26 14:35   ` Johannes Schindelin
  2016-01-26 14:35   ` [PATCH v2 12/19] mingw: skip test in t1508 that fails due to path conversion Johannes Schindelin
                     ` (9 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

The Git daemon tests create a FIFO first thing and will hang if said
FIFO is not available.

This is a problem with Git for Windows, where `mkfifo` is an MSYS2
program that leverages MSYS2's POSIX emulation layer, but
`git-daemon.exe` is a MINGW program that has not the first clue about
that POSIX emulation layer and therefore blinks twice when it sees
MSYS2's emulated FIFOs and then just stares into space.

This lets t5570-git-daemon.sh and t5811-proto-disable-git.sh pass.

Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/lib-git-daemon.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh
index bc4b341..9b1271c 100644
--- a/t/lib-git-daemon.sh
+++ b/t/lib-git-daemon.sh
@@ -23,6 +23,11 @@ then
 	test_done
 fi
 
+if ! test_have_prereq PIPE
+then
+	test_skip_or_die $GIT_TEST_GIT_DAEMON "file system does not support FIFOs"
+fi
+
 LIB_GIT_DAEMON_PORT=${LIB_GIT_DAEMON_PORT-${this_test#t}}
 
 GIT_DAEMON_PID=
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 12/19] mingw: skip test in t1508 that fails due to path conversion
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (10 preceding siblings ...)
  2016-01-26 14:35   ` [PATCH v2 11/19] tests: turn off git-daemon tests if FIFOs are not available Johannes Schindelin
@ 2016-01-26 14:35   ` Johannes Schindelin
  2016-01-26 22:02     ` Junio C Hamano
  2016-01-26 14:35   ` [PATCH v2 13/19] mingw: fix t9700's assumption about directory separators Johannes Schindelin
                     ` (8 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

In Git for Windows, the MSYS2 POSIX emulation layer used by the Bash
converts command-line arguments that looks like they refer to a POSIX
path containing a file list (i.e. @<absolute-path>) into a Windows path
equivalent when calling non-MSYS2 executables, such as git.exe.

Let's just skip the test that uses the parameter `@/at-test` that
confuses the MSYS2 runtime.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t1508-at-combinations.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
index 078e119..c59d554 100755
--- a/t/t1508-at-combinations.sh
+++ b/t/t1508-at-combinations.sh
@@ -35,7 +35,10 @@ test_expect_success 'setup' '
 	git checkout -b upstream-branch &&
 	test_commit upstream-one &&
 	test_commit upstream-two &&
-	git checkout -b @/at-test &&
+	if ! test_have_prereq MINGW
+	then
+		git checkout -b @/at-slash
+	fi &&
 	git checkout -b @@/at-test &&
 	git checkout -b @at-test &&
 	git checkout -b old-branch &&
@@ -64,6 +67,7 @@ check "@{-1}@{u}@{1}" commit master-one
 check "@" commit new-two
 check "@@{u}" ref refs/heads/upstream-branch
 check "@@/at-test" ref refs/heads/@@/at-test
+test_have_prereq MINGW ||
 check "@/at-test" ref refs/heads/@/at-test
 check "@at-test" ref refs/heads/@at-test
 nonsense "@{u}@{-1}"
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 13/19] mingw: fix t9700's assumption about directory separators
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (11 preceding siblings ...)
  2016-01-26 14:35   ` [PATCH v2 12/19] mingw: skip test in t1508 that fails due to path conversion Johannes Schindelin
@ 2016-01-26 14:35   ` Johannes Schindelin
  2016-01-26 14:35   ` [PATCH v2 14/19] mingw: work around pwd issues in the tests Johannes Schindelin
                     ` (7 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This test assumed that there is only one directory separator (the
forward slash), not two equivalent directory separators.
However, on Windows, the back slash and the forward slash *are*
equivalent.

Let's paper over this issue by converting the backward slashes to
forward ones in the test that fails with MSYS2 otherwise.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9700/test.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index 1140767..7e8c40b 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -33,7 +33,7 @@ is($r->config_int("test.int"), 2048, "config_int: integer");
 is($r->config_int("test.nonexistent"), undef, "config_int: nonexistent");
 ok($r->config_bool("test.booltrue"), "config_bool: true");
 ok(!$r->config_bool("test.boolfalse"), "config_bool: false");
-is($r->config_path("test.path"), $r->config("test.pathexpanded"),
+is($r->config_path("test.path") =~ s/\\/\//gr, $r->config("test.pathexpanded"),
    "config_path: ~/foo expansion");
 is_deeply([$r->config_path("test.pathmulti")], ["foo", "bar"],
    "config_path: multiple values");
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 14/19] mingw: work around pwd issues in the tests
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (12 preceding siblings ...)
  2016-01-26 14:35   ` [PATCH v2 13/19] mingw: fix t9700's assumption about directory separators Johannes Schindelin
@ 2016-01-26 14:35   ` Johannes Schindelin
  2016-01-26 14:35   ` [PATCH v2 15/19] Avoid absolute path in t0008 Johannes Schindelin
                     ` (6 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

In Git for Windows' SDK, the tests are run using a Bash that relies on
the POSIX emulation layer MSYS2 (itself a friendly fork of Cygwin). As
such, paths in tests can be POSIX paths. As soon as those paths are
passed to git.exe (which does *not* use the POSIX emulation layer),
those paths are converted into Windows paths, though. This happens
for command-line parameters, but not when reading, say, config variables.

To help with that, the `pwd` command is overridden to return the Windows
path of the current working directory when testing Git on Windows.

However, when talking to anything using the POSIX emulation layer, it is
really much better to use POSIX paths because Windows paths contain a
colon after the drive letter that will easily be mistaken for the common
separator in path lists.

So let's just use the $PWD variable when the POSIX path is needed.

This lets t7800-difftool.sh, t9400-git-cvsserver-server.sh,
t9402-git-cvsserver-refs.sh and t9401-git-cvsserver-crlf.sh pass in Git
for Windows' SDK.

Note: the cvsserver tests require not only the `cvs` package (install
it into Git for Windows' SDK via `pacman -S cvs`) but also the Perl
SQLite bindings (install them into Git for Windows' SDK via
`cpan DBD::SQLite`).

This patch is based on earlier work by 마누엘 and Karsten Blees.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t7800-difftool.sh             | 14 +++++++-------
 t/t9400-git-cvsserver-server.sh |  6 +++---
 t/t9401-git-cvsserver-crlf.sh   |  6 +++---
 t/t9402-git-cvsserver-refs.sh   |  6 +++---
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index ec8bc8c..4e713f7 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -430,11 +430,11 @@ EOF
 test_expect_success PERL,SYMLINKS 'difftool --dir-diff --symlink without unstaged changes' '
 	cat >expect <<-EOF &&
 	file
-	$(pwd)/file
+	$PWD/file
 	file2
-	$(pwd)/file2
+	$PWD/file2
 	sub/sub
-	$(pwd)/sub/sub
+	$PWD/sub/sub
 	EOF
 	git difftool --dir-diff --symlink \
 		--extcmd "./.git/CHECK_SYMLINKS" branch HEAD &&
@@ -448,14 +448,14 @@ EOF
 run_dir_diff_test 'difftool --dir-diff syncs worktree with unstaged change' '
 	test_when_finished git reset --hard &&
 	echo "orig content" >file &&
-	git difftool -d $symlinks --extcmd "$(pwd)/modify-right-file" branch &&
+	git difftool -d $symlinks --extcmd "$PWD/modify-right-file" branch &&
 	echo "new content" >expect &&
 	test_cmp expect file
 '
 
 run_dir_diff_test 'difftool --dir-diff syncs worktree without unstaged change' '
 	test_when_finished git reset --hard &&
-	git difftool -d $symlinks --extcmd "$(pwd)/modify-right-file" branch &&
+	git difftool -d $symlinks --extcmd "$PWD/modify-right-file" branch &&
 	echo "new content" >expect &&
 	test_cmp expect file
 '
@@ -466,7 +466,7 @@ EOF
 
 test_expect_success PERL 'difftool --no-symlinks does not overwrite working tree file ' '
 	echo "orig content" >file &&
-	git difftool --dir-diff --no-symlinks --extcmd "$(pwd)/modify-file" branch &&
+	git difftool --dir-diff --no-symlinks --extcmd "$PWD/modify-file" branch &&
 	echo "new content" >expect &&
 	test_cmp expect file
 '
@@ -482,7 +482,7 @@ test_expect_success PERL 'difftool --no-symlinks detects conflict ' '
 		TMPDIR=$TRASH_DIRECTORY &&
 		export TMPDIR &&
 		echo "orig content" >file &&
-		test_must_fail git difftool --dir-diff --no-symlinks --extcmd "$(pwd)/modify-both-files" branch &&
+		test_must_fail git difftool --dir-diff --no-symlinks --extcmd "$PWD/modify-both-files" branch &&
 		echo "wt content" >expect &&
 		test_cmp expect file &&
 		echo "tmp content" >expect &&
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 6146c3f..d708cbf 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -25,11 +25,11 @@ perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
     test_done
 }
 
-WORKDIR=$(pwd)
-SERVERDIR=$(pwd)/gitcvs.git
+WORKDIR=$PWD
+SERVERDIR=$PWD/gitcvs.git
 git_config="$SERVERDIR/config"
 CVSROOT=":fork:$SERVERDIR"
-CVSWORK="$(pwd)/cvswork"
+CVSWORK="$PWD/cvswork"
 CVS_SERVER=git-cvsserver
 export CVSROOT CVS_SERVER
 
diff --git a/t/t9401-git-cvsserver-crlf.sh b/t/t9401-git-cvsserver-crlf.sh
index 5a4ed28..f324b9f 100755
--- a/t/t9401-git-cvsserver-crlf.sh
+++ b/t/t9401-git-cvsserver-crlf.sh
@@ -74,11 +74,11 @@ perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
 }
 
 unset GIT_DIR GIT_CONFIG
-WORKDIR=$(pwd)
-SERVERDIR=$(pwd)/gitcvs.git
+WORKDIR=$PWD
+SERVERDIR=$PWD/gitcvs.git
 git_config="$SERVERDIR/config"
 CVSROOT=":fork:$SERVERDIR"
-CVSWORK="$(pwd)/cvswork"
+CVSWORK="$PWD/cvswork"
 CVS_SERVER=git-cvsserver
 export CVSROOT CVS_SERVER
 
diff --git a/t/t9402-git-cvsserver-refs.sh b/t/t9402-git-cvsserver-refs.sh
index d00df08..6d2d3c8 100755
--- a/t/t9402-git-cvsserver-refs.sh
+++ b/t/t9402-git-cvsserver-refs.sh
@@ -82,11 +82,11 @@ perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
 }
 
 unset GIT_DIR GIT_CONFIG
-WORKDIR=$(pwd)
-SERVERDIR=$(pwd)/gitcvs.git
+WORKDIR=$PWD
+SERVERDIR=$PWD/gitcvs.git
 git_config="$SERVERDIR/config"
 CVSROOT=":fork:$SERVERDIR"
-CVSWORK="$(pwd)/cvswork"
+CVSWORK="$PWD/cvswork"
 CVS_SERVER=git-cvsserver
 export CVSROOT CVS_SERVER
 
-- 
2.7.0.windows.1.7.g55a05c8


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 15/19] Avoid absolute path in t0008
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (13 preceding siblings ...)
  2016-01-26 14:35   ` [PATCH v2 14/19] mingw: work around pwd issues in the tests Johannes Schindelin
@ 2016-01-26 14:35   ` Johannes Schindelin
  2016-01-26 14:35   ` [PATCH v2 16/19] mingw: mark t9100's test cases with appropriate prereqs Johannes Schindelin
                     ` (5 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Pat Thoyts, git

From: Pat Thoyts <patthoyts@users.sourceforge.net>

The colon is used by check-ignore to separate paths from other output
values. If we use an absolute path, however, on Windows it will be
converted into a Windows path that very much contains a colon.

It is actually not at all necessary to make the path of the global
excludes absolute, so let's just not even do that.

Based on suggestions by Karsten Blees and Junio Hamano.

Suggested-by: Karsten Blees <karsten.blees@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t0008-ignores.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
index 4ef5ed4..89544dd 100755
--- a/t/t0008-ignores.sh
+++ b/t/t0008-ignores.sh
@@ -5,7 +5,7 @@ test_description=check-ignore
 . ./test-lib.sh
 
 init_vars () {
-	global_excludes="$(pwd)/global-excludes"
+	global_excludes="global-excludes"
 }
 
 enable_global_excludes () {
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 16/19] mingw: mark t9100's test cases with appropriate prereqs
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (14 preceding siblings ...)
  2016-01-26 14:35   ` [PATCH v2 15/19] Avoid absolute path in t0008 Johannes Schindelin
@ 2016-01-26 14:35   ` Johannes Schindelin
  2016-01-26 21:50     ` Junio C Hamano
  2016-01-26 14:35   ` [PATCH v2 17/19] mingw: avoid illegal filename in t9118 Johannes Schindelin
                     ` (4 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=X-UNKNOWN, Size: 2942 bytes --]

Many a test requires either POSIXPERM (to change the executable bit) or
SYMLINKS, and neither are available on Windows.

This lets t9100-git-svn-basic.sh pass in Git for Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9100-git-svn-basic.sh | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 258d9b8..5b32a3b 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -30,8 +30,7 @@ test_expect_success \
 		echo "deep dir" >dir/a/b/c/d/e/file &&
 		mkdir bar &&
 		echo "zzz" >bar/zzz &&
-		echo "#!/bin/sh" >exec.sh &&
-		chmod +x exec.sh &&
+		printf "" | write_script exec.sh &&
 		svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null
 	) &&
 	rm -rf import &&
@@ -117,7 +116,7 @@ test_expect_success "$name" '
 
 
 name='remove executable bit from a file'
-test_expect_success "$name" '
+test_expect_success POSIXPERM "$name" '
 	rm -f "$GIT_DIR"/index &&
 	git checkout -f -b mybranch5 ${remotes_git_svn} &&
 	chmod -x exec.sh &&
@@ -130,7 +129,7 @@ test_expect_success "$name" '
 
 
 name='add executable bit back file'
-test_expect_success "$name" '
+test_expect_success POSIXPERM "$name" '
 	chmod +x exec.sh &&
 	git update-index exec.sh &&
 	git commit -m "$name" &&
@@ -141,7 +140,7 @@ test_expect_success "$name" '
 
 
 name='executable file becomes a symlink to file'
-test_expect_success "$name" '
+test_expect_success SYMLINKS "$name" '
 	rm exec.sh &&
 	ln -s file exec.sh &&
 	git update-index exec.sh &&
@@ -153,7 +152,7 @@ test_expect_success "$name" '
 
 name='new symlink is added to a file that was also just made executable'
 
-test_expect_success "$name" '
+test_expect_success POSIXPERM,SYMLINKS "$name" '
 	chmod +x file &&
 	ln -s file exec-2.sh &&
 	git update-index --add file exec-2.sh &&
@@ -165,7 +164,7 @@ test_expect_success "$name" '
 	test -h "$SVN_TREE"/exec-2.sh'
 
 name='modify a symlink to become a file'
-test_expect_success "$name" '
+test_expect_success POSIXPERM,SYMLINKS "$name" '
 	echo git help >help &&
 	rm exec-2.sh &&
 	cp help exec-2.sh &&
@@ -181,7 +180,8 @@ test_expect_success "$name" '
 name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
 LC_ALL="$GIT_SVN_LC_ALL"
 export LC_ALL
-test_expect_success UTF8 "$name" "
+# This test relies on the previous test, hence requires POSIXPERM,SYMLINKS
+test_expect_success UTF8,POSIXPERM,SYMLINKS "$name" "
 	echo '# hello' >> exec-2.sh &&
 	git update-index exec-2.sh &&
 	git commit -m '???????' &&
@@ -214,7 +214,7 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
 tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4
 EOF
 
-test_expect_success "$name" "test_cmp a expected"
+test_expect_success POSIXPERM,SYMLINKS "$name" "test_cmp a expected"
 
 test_expect_success 'exit if remote refs are ambigious' "
         git config --add svn-remote.svn.fetch \
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 17/19] mingw: avoid illegal filename in t9118
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (15 preceding siblings ...)
  2016-01-26 14:35   ` [PATCH v2 16/19] mingw: mark t9100's test cases with appropriate prereqs Johannes Schindelin
@ 2016-01-26 14:35   ` Johannes Schindelin
  2016-01-26 14:35   ` [PATCH v2 18/19] mingw: handle the missing POSIXPERM prereq in t9124 Johannes Schindelin
                     ` (3 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Windows' file systems, file names with trailing dots are forbidden.
The POSIX emulation layer used by Git for Windows' Subversion emulates
those file names, therefore the test adding the file would actually
succeed, but when we would ask git.exe (which does not leverage the
POSIX emulation layer) to check out the tree, it would fail.

Let's just guard the test using a filename that is illegal on Windows
by the MINGW prereq.

This lets t9118-git-svn-funky-branch-names.sh pass in Git for Windows'
SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9118-git-svn-funky-branch-names.sh | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh
index a221915..ecb1fed 100755
--- a/t/t9118-git-svn-funky-branch-names.sh
+++ b/t/t9118-git-svn-funky-branch-names.sh
@@ -23,8 +23,11 @@ test_expect_success 'setup svnrepo' '
 	              "$svnrepo/pr ject/branches/$scary_uri" &&
 	svn_cmd cp -m "leading dot" "$svnrepo/pr ject/trunk" \
 			"$svnrepo/pr ject/branches/.leading_dot" &&
-	svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
-			"$svnrepo/pr ject/branches/trailing_dot." &&
+	if test_have_prereq !MINGW
+	then
+		svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
+			"$svnrepo/pr ject/branches/trailing_dot."
+	fi &&
 	svn_cmd cp -m "trailing .lock" "$svnrepo/pr ject/trunk" \
 			"$svnrepo/pr ject/branches/trailing_dotlock.lock" &&
 	svn_cmd cp -m "reflog" "$svnrepo/pr ject/trunk" \
@@ -45,7 +48,10 @@ test_expect_success 'test clone with funky branch names' '
 		git rev-parse "refs/remotes/origin/more%20fun%20plugin!" &&
 		git rev-parse "refs/remotes/origin/$scary_ref" &&
 		git rev-parse "refs/remotes/origin/%2Eleading_dot" &&
-		git rev-parse "refs/remotes/origin/trailing_dot%2E" &&
+		if test_have_prereq !MINGW
+		then
+			git rev-parse "refs/remotes/origin/trailing_dot%2E"
+		fi &&
 		git rev-parse "refs/remotes/origin/trailing_dotlock%2Elock" &&
 		git rev-parse "refs/remotes/origin/$non_reflog"
 	)
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 18/19] mingw: handle the missing POSIXPERM prereq in t9124
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (16 preceding siblings ...)
  2016-01-26 14:35   ` [PATCH v2 17/19] mingw: avoid illegal filename in t9118 Johannes Schindelin
@ 2016-01-26 14:35   ` Johannes Schindelin
  2016-01-26 22:05     ` Junio C Hamano
  2016-01-26 14:35   ` [PATCH v2 19/19] mingw: do not bother to test funny file names Johannes Schindelin
                     ` (2 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Windows, the permission system works completely differently than
expected by some of the tests. So let's make sure that we do not test
POSIX functionality on Windows.

This lets t9124-git-svn-dcommit-auto-props.sh pass in Git for Windows'
SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9124-git-svn-dcommit-auto-props.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh
index aa841e1..2be0805 100755
--- a/t/t9124-git-svn-dcommit-auto-props.sh
+++ b/t/t9124-git-svn-dcommit-auto-props.sh
@@ -34,8 +34,7 @@ test_expect_success 'enable auto-props config' '
 '
 
 test_expect_success 'add files matching auto-props' '
-	echo "#!$SHELL_PATH" >exec1.sh &&
-	chmod +x exec1.sh &&
+	printf "" | write_script exec1.sh &&
 	echo "hello" >hello.txt &&
 	echo bar >bar &&
 	git add exec1.sh hello.txt bar &&
@@ -48,8 +47,7 @@ test_expect_success 'disable auto-props config' '
 '
 
 test_expect_success 'add files matching disabled auto-props' '
-	echo "#$SHELL_PATH" >exec2.sh &&
-	chmod +x exec2.sh &&
+	printf "" | write_script exec2.sh &&
 	echo "world" >world.txt &&
 	echo zot >zot &&
 	git add exec2.sh world.txt zot &&
@@ -65,7 +63,10 @@ test_expect_success 'check resulting svn repository' '
 	cd svnrepo &&
 
 	# Check properties from first commit.
-	test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*" &&
+	if test_have_prereq POSIXPERM
+	then
+		test -z "$(svn_cmd propget svn:executable exec1.sh)"
+	fi &&
 	test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \
 	     "xapplication/x-shellscript" &&
 	test "x$(svn_cmd propget svn:mime-type hello.txt)" = "xtext/plain" &&
@@ -73,7 +74,10 @@ test_expect_success 'check resulting svn repository' '
 	test "x$(svn_cmd propget svn:mime-type bar)" = "x" &&
 
 	# Check properties from second commit.
-	test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*" &&
+	if test_have_prereq POSIXPERM
+	then
+		test -z "$(svn_cmd propget svn:executable exec2.sh)"
+	fi &&
 	test "x$(svn_cmd propget svn:mime-type exec2.sh)" = "x" &&
 	test "x$(svn_cmd propget svn:mime-type world.txt)" = "x" &&
 	test "x$(svn_cmd propget svn:eol-style world.txt)" = "x" &&
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v2 19/19] mingw: do not bother to test funny file names
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (17 preceding siblings ...)
  2016-01-26 14:35   ` [PATCH v2 18/19] mingw: handle the missing POSIXPERM prereq in t9124 Johannes Schindelin
@ 2016-01-26 14:35   ` Johannes Schindelin
  2016-01-26 20:03     ` Eric Sunshine
  2016-01-26 22:12   ` [PATCH v2 00/19] Let Git's tests pass on Windows Junio C Hamano
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-26 14:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=X-UNKNOWN, Size: 4398 bytes --]

MSYS2 actually allows to create files or directories whose names contain
tabs, newlines or colors, even if plain Win32 API cannot access them.
As we are using an MSYS2 bash to run the tests, such files or
directories are created successfully, but Git itself has no chance to
work with them because it is a regular Windows program, hence limited by
the Win32 API.

With this change, on Windows otherwise failing tests in
t3300-funny-names.sh, t3600-rm.sh, t3703-add-magic-pathspec.sh,
t3902-quoted.sh, t4016-diff-quote.sh, t4135-apply-weird-filenames.sh,
t9200-git-cvsexportcommit.sh, and t9903-bash-prompt.sh are skipped.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t3300-funny-names.sh           | 1 +
 t/t3600-rm.sh                    | 3 ++-
 t/t3703-add-magic-pathspec.sh    | 2 +-
 t/t3902-quoted.sh                | 1 +
 t/t4016-diff-quote.sh            | 1 +
 t/t4135-apply-weird-filenames.sh | 3 ++-
 t/t9200-git-cvsexportcommit.sh   | 2 +-
 t/t9903-bash-prompt.sh           | 2 +-
 8 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh
index 9a146f1..04de03c 100755
--- a/t/t3300-funny-names.sh
+++ b/t/t3300-funny-names.sh
@@ -13,6 +13,7 @@ tree, index, and tree objects.
 
 HT='	'
 
+test_have_prereq MINGW ||
 echo 2>/dev/null > "Name with an${HT}HT"
 if ! test -f "Name with an${HT}HT"
 then
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 2e47a2b..5232ee9 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -14,7 +14,8 @@ test_expect_success \
      git add -- foo bar baz 'space embedded' -q &&
      git commit -m 'add normal files'"
 
-if touch -- 'tab	embedded' 'newline
+
+if ! test_have_prereq MINGW && touch -- 'tab	embedded' 'newline
 embedded' 2>/dev/null
 then
 	test_set_prereq FUNNYNAMES
diff --git a/t/t3703-add-magic-pathspec.sh b/t/t3703-add-magic-pathspec.sh
index 5115de7..aaff784 100755
--- a/t/t3703-add-magic-pathspec.sh
+++ b/t/t3703-add-magic-pathspec.sh
@@ -38,7 +38,7 @@ cat >expected <<EOF
 add 'sub/foo'
 EOF
 
-if mkdir ":" 2>/dev/null
+if ! test_have_prereq MINGW && mkdir ":" 2>/dev/null
 then
 	test_set_prereq COLON_DIR
 fi
diff --git a/t/t3902-quoted.sh b/t/t3902-quoted.sh
index 892f567..f528008 100755
--- a/t/t3902-quoted.sh
+++ b/t/t3902-quoted.sh
@@ -12,6 +12,7 @@ GN='???'
 HT='	'
 DQ='"'
 
+test_have_prereq MINGW ||
 echo foo 2>/dev/null > "Name and an${HT}HT"
 if ! test -f "Name and an${HT}HT"
 then
diff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh
index cd543ec..9c48e5c 100755
--- a/t/t4016-diff-quote.sh
+++ b/t/t4016-diff-quote.sh
@@ -13,6 +13,7 @@ P1='pathname	with HT'
 P2='pathname with SP'
 P3='pathname
 with LF'
+test_have_prereq !MINGW &&
 echo 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" || {
 	skip_all='Your filesystem does not allow tabs in filenames'
 	test_done
diff --git a/t/t4135-apply-weird-filenames.sh b/t/t4135-apply-weird-filenames.sh
index bf5dc57..6d6b96d 100755
--- a/t/t4135-apply-weird-filenames.sh
+++ b/t/t4135-apply-weird-filenames.sh
@@ -19,7 +19,8 @@ test_expect_success 'setup' '
 
 	test_when_finished "rm -f \"tab	embedded.txt\"" &&
 	test_when_finished "rm -f '\''\"quoteembedded\".txt'\''" &&
-	if touch -- "tab	embedded.txt" '\''"quoteembedded".txt'\''
+	if ! test_have_prereq MINGW &&
+		touch -- "tab	embedded.txt" '\''"quoteembedded".txt'\''
 	then
 		test_set_prereq FUNNYNAMES
 	fi
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index 812c9cd..5cfb9cf 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -197,7 +197,7 @@ if p="??/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/??/??/??" &&
 then
 
 # This test contains UTF-8 characters
-test_expect_success \
+test_expect_success !MINGW \
      'File with non-ascii file name' \
      'mkdir -p ??/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/??/??/?? &&
       echo Foo >??/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/??/??/??/g??rdets??g??rdet.txt &&
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index af82049..2ee6564 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -67,7 +67,7 @@ repo_with_newline='repo
 with
 newline'
 
-if mkdir "$repo_with_newline" 2>/dev/null
+if ! test_have_prereq MINGW && mkdir "$repo_with_newline" 2>/dev/null
 then
 	test_set_prereq FUNNYNAMES
 else
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* Re: [PATCH 17/19] mingw: fix git-svn tests that expect chmod to work
  2016-01-26  6:31     ` Johannes Schindelin
@ 2016-01-26 17:42       ` Junio C Hamano
  0 siblings, 0 replies; 113+ messages in thread
From: Junio C Hamano @ 2016-01-26 17:42 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> This is my fault: there are two MINGW prereqs, and they guard against
> trying to work with file names ending in a dot (which is illegal on
> Windows' file systems).

Ahh, I failed to notice that MINGW was protecting against the "dot"
thing.  So I was wrong; that one cannot be !POSIXPERM.

Thanks for clarifying.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 19/19] mingw: do not bother to test funny file names
  2016-01-26 14:35   ` [PATCH v2 19/19] mingw: do not bother to test funny file names Johannes Schindelin
@ 2016-01-26 20:03     ` Eric Sunshine
  2016-01-26 20:24       ` Junio C Hamano
  2016-01-27  8:33       ` Johannes Schindelin
  0 siblings, 2 replies; 113+ messages in thread
From: Eric Sunshine @ 2016-01-26 20:03 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, Git List

On Tue, Jan 26, 2016 at 9:35 AM, Johannes Schindelin
<johannes.schindelin@gmx.de> wrote:
> MSYS2 actually allows to create files or directories whose names contain
> tabs, newlines or colors, even if plain Win32 API cannot access them.
> As we are using an MSYS2 bash to run the tests, such files or
> directories are created successfully, but Git itself has no chance to
> work with them because it is a regular Windows program, hence limited by
> the Win32 API.
> [...]
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
> @@ -14,7 +14,8 @@ test_expect_success \
> -if touch -- 'tab       embedded' 'newline
> +

Is this new blank line intentional?

> +if ! test_have_prereq MINGW && touch -- 'tab   embedded' 'newline
> [...]
> +test_have_prereq !MINGW &&

Where negation is concerned, is there a non-obvious reason that this
patch sometimes says:

    ! test_have_prereq MINGW

and sometimes:

    test_have_prereq !MINGW

? Is one form preferred over the other?

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 19/19] mingw: do not bother to test funny file names
  2016-01-26 20:03     ` Eric Sunshine
@ 2016-01-26 20:24       ` Junio C Hamano
  2016-01-27  8:33       ` Johannes Schindelin
  1 sibling, 0 replies; 113+ messages in thread
From: Junio C Hamano @ 2016-01-26 20:24 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Johannes Schindelin, Git List

Eric Sunshine <sunshine@sunshineco.com> writes:

>> +if ! test_have_prereq MINGW && touch -- 'tab   embedded' 'newline
>> [...]
>> +test_have_prereq !MINGW &&
>
> Where negation is concerned, is there a non-obvious reason that this
> patch sometimes says:
>
>     ! test_have_prereq MINGW
>
> and sometimes:
>
>     test_have_prereq !MINGW
>
> ? Is one form preferred over the other?

The latter may be preferrable as it can be extended more easily,
e.g.

	test_have_prereq !MINGW,SANITY

without having to cascade "&& test_have_prereq ANOTHER_PREREQ" in a
verbose way.

It is a minor thing that is not worth bothering to "fix" from one to
the other style once it is committed to my tree, but it may be worth
sticking to one style in new code.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 16/19] mingw: mark t9100's test cases with appropriate prereqs
  2016-01-26 14:35   ` [PATCH v2 16/19] mingw: mark t9100's test cases with appropriate prereqs Johannes Schindelin
@ 2016-01-26 21:50     ` Junio C Hamano
  2016-01-27 16:02       ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-26 21:50 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> @@ -181,7 +180,8 @@ test_expect_success "$name" '
>  name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
>  LC_ALL="$GIT_SVN_LC_ALL"
>  export LC_ALL
> -test_expect_success UTF8 "$name" "
> +# This test relies on the previous test, hence requires POSIXPERM,SYMLINKS
> +test_expect_success UTF8,POSIXPERM,SYMLINKS "$name" "
>  	echo '# hello' >> exec-2.sh &&
>  	git update-index exec-2.sh &&
>  	git commit -m '???????' &&

Hmph.  "Content-Type: text/plain; charset=X-UNKNOWN" in the header
gives a hint to me, too.

I'll try to wiggle them in (19/19 has the same X-UNKNOWN), so no
need to re-send to fix only this.

Thanks.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 12/19] mingw: skip test in t1508 that fails due to path conversion
  2016-01-26 14:35   ` [PATCH v2 12/19] mingw: skip test in t1508 that fails due to path conversion Johannes Schindelin
@ 2016-01-26 22:02     ` Junio C Hamano
  2016-01-27  8:50       ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-26 22:02 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> In Git for Windows, the MSYS2 POSIX emulation layer used by the Bash
> converts command-line arguments that looks like they refer to a POSIX
> path containing a file list (i.e. @<absolute-path>) into a Windows path
> equivalent when calling non-MSYS2 executables, such as git.exe.
>
> Let's just skip the test that uses the parameter `@/at-test` that
> confuses the MSYS2 runtime.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  t/t1508-at-combinations.sh | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
> index 078e119..c59d554 100755
> --- a/t/t1508-at-combinations.sh
> +++ b/t/t1508-at-combinations.sh
> @@ -35,7 +35,10 @@ test_expect_success 'setup' '
>  	git checkout -b upstream-branch &&
>  	test_commit upstream-one &&
>  	test_commit upstream-two &&
> -	git checkout -b @/at-test &&
> +	if ! test_have_prereq MINGW
> +	then
> +		git checkout -b @/at-slash

I presume that this is meant to be "@/at-test", not "@/at-slash".

> +	fi &&
>  	git checkout -b @@/at-test &&
>  	git checkout -b @at-test &&
>  	git checkout -b old-branch &&
> @@ -64,6 +67,7 @@ check "@{-1}@{u}@{1}" commit master-one
>  check "@" commit new-two
>  check "@@{u}" ref refs/heads/upstream-branch
>  check "@@/at-test" ref refs/heads/@@/at-test
> +test_have_prereq MINGW ||
>  check "@/at-test" ref refs/heads/@/at-test
>  check "@at-test" ref refs/heads/@at-test
>  nonsense "@{u}@{-1}"

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 18/19] mingw: handle the missing POSIXPERM prereq in t9124
  2016-01-26 14:35   ` [PATCH v2 18/19] mingw: handle the missing POSIXPERM prereq in t9124 Johannes Schindelin
@ 2016-01-26 22:05     ` Junio C Hamano
  2016-01-27  9:20       ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-26 22:05 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> On Windows, the permission system works completely differently than
> expected by some of the tests. So let's make sure that we do not test
> POSIX functionality on Windows.
>
> This lets t9124-git-svn-dcommit-auto-props.sh pass in Git for Windows'
> SDK.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  t/t9124-git-svn-dcommit-auto-props.sh | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh
> index aa841e1..2be0805 100755
> --- a/t/t9124-git-svn-dcommit-auto-props.sh
> +++ b/t/t9124-git-svn-dcommit-auto-props.sh
> @@ -34,8 +34,7 @@ test_expect_success 'enable auto-props config' '
>  '
>  
>  test_expect_success 'add files matching auto-props' '
> -	echo "#!$SHELL_PATH" >exec1.sh &&
> -	chmod +x exec1.sh &&
> +	printf "" | write_script exec1.sh &&

That looks like a useless use of printf.  Why not

	write_script exec1.sh </dev/null &&

>  	echo "hello" >hello.txt &&
>  	echo bar >bar &&
>  	git add exec1.sh hello.txt bar &&
> @@ -48,8 +47,7 @@ test_expect_success 'disable auto-props config' '
>  '
>  
>  test_expect_success 'add files matching disabled auto-props' '
> -	echo "#$SHELL_PATH" >exec2.sh &&
> -	chmod +x exec2.sh &&
> +	printf "" | write_script exec2.sh &&
>  	echo "world" >world.txt &&
>  	echo zot >zot &&
>  	git add exec2.sh world.txt zot &&
> @@ -65,7 +63,10 @@ test_expect_success 'check resulting svn repository' '
>  	cd svnrepo &&
>  
>  	# Check properties from first commit.
> -	test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*" &&
> +	if test_have_prereq POSIXPERM
> +	then
> +		test -z "$(svn_cmd propget svn:executable exec1.sh)"

Why this change?

		test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*" &&

means "propget command gives a literal string that consists of a
single asterisk".

> +	fi &&
>  	test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \
>  	     "xapplication/x-shellscript" &&
>  	test "x$(svn_cmd propget svn:mime-type hello.txt)" = "xtext/plain" &&
> @@ -73,7 +74,10 @@ test_expect_success 'check resulting svn repository' '
>  	test "x$(svn_cmd propget svn:mime-type bar)" = "x" &&
>  
>  	# Check properties from second commit.
> -	test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*" &&
> +	if test_have_prereq POSIXPERM
> +	then
> +		test -z "$(svn_cmd propget svn:executable exec2.sh)"

Likewise.

Please do not change things without understanding what they are doing.

> +	fi &&
>  	test "x$(svn_cmd propget svn:mime-type exec2.sh)" = "x" &&
>  	test "x$(svn_cmd propget svn:mime-type world.txt)" = "x" &&
>  	test "x$(svn_cmd propget svn:eol-style world.txt)" = "x" &&

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 00/19] Let Git's tests pass on Windows
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (18 preceding siblings ...)
  2016-01-26 14:35   ` [PATCH v2 19/19] mingw: do not bother to test funny file names Johannes Schindelin
@ 2016-01-26 22:12   ` Junio C Hamano
  2016-01-27  8:38     ` Johannes Schindelin
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
  20 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-26 22:12 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> This is a big milestone. With these modifications, Git's source code
> does not only build without warnings in Git for Windows' SDK, but
> passes the entire regression test suite.

Thanks.

Without a few fixups, the result of applying these patches made
tests fail for me (so presumably for everybody !MINGW), which I
think I fixed all, but I may have broken things on MINGW while doing
so.  Please re-fetch from my tree when I pushed the integration
result out with this merged somewhere on the 'pu' branch, retest,
and if I broke something please re-fix them ;-)

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 19/19] mingw: do not bother to test funny file names
  2016-01-26 20:03     ` Eric Sunshine
  2016-01-26 20:24       ` Junio C Hamano
@ 2016-01-27  8:33       ` Johannes Schindelin
  1 sibling, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27  8:33 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Junio C Hamano, Git List

Hi Eric,

On Tue, 26 Jan 2016, Eric Sunshine wrote:

> On Tue, Jan 26, 2016 at 9:35 AM, Johannes Schindelin
> <johannes.schindelin@gmx.de> wrote:
> > MSYS2 actually allows to create files or directories whose names contain
> > tabs, newlines or colors, even if plain Win32 API cannot access them.
> > As we are using an MSYS2 bash to run the tests, such files or
> > directories are created successfully, but Git itself has no chance to
> > work with them because it is a regular Windows program, hence limited by
> > the Win32 API.
> > [...]
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> > diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
> > @@ -14,7 +14,8 @@ test_expect_success \
> > -if touch -- 'tab       embedded' 'newline
> > +
> 
> Is this new blank line intentional?

Absolutely not! ;-) Fixed.

> > +if ! test_have_prereq MINGW && touch -- 'tab   embedded' 'newline
> > [...]
> > +test_have_prereq !MINGW &&
> 
> Where negation is concerned, is there a non-obvious reason that this
> patch sometimes says:
> 
>     ! test_have_prereq MINGW
> 
> and sometimes:
> 
>     test_have_prereq !MINGW
> 
> ? Is one form preferred over the other?

Hysterical raisins. I changed all of them to the latter form, as suggested
by Junio.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 00/19] Let Git's tests pass on Windows
  2016-01-26 22:12   ` [PATCH v2 00/19] Let Git's tests pass on Windows Junio C Hamano
@ 2016-01-27  8:38     ` Johannes Schindelin
  2016-01-27 20:24       ` Junio C Hamano
  0 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27  8:38 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Junio,

On Tue, 26 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> 
> > This is a big milestone. With these modifications, Git's source code
> > does not only build without warnings in Git for Windows' SDK, but
> > passes the entire regression test suite.
> 
> Thanks.
> 
> Without a few fixups, the result of applying these patches made
> tests fail for me (so presumably for everybody !MINGW)

Drats! I got lazy and did not re-test everything on Linux after a while
(it really sloooowed me down and for a good while the tests all succeeded,
so those regressions were incurred from working on this very patch
series...)

> which I think I fixed all, but I may have broken things on MINGW while
> doing so.  Please re-fetch from my tree when I pushed the integration
> result out with this merged somewhere on the 'pu' branch, retest, and if
> I broke something please re-fix them ;-)

I made a couple of other adjustments anyway, so expect a new iteration
shortly. This time cross-checked on Linux.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 12/19] mingw: skip test in t1508 that fails due to path conversion
  2016-01-26 22:02     ` Junio C Hamano
@ 2016-01-27  8:50       ` Johannes Schindelin
  2016-01-27 20:23         ` Junio C Hamano
  0 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27  8:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Junio,

On Tue, 26 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> 
> > @@ -35,7 +35,10 @@ test_expect_success 'setup' '
> >  	git checkout -b upstream-branch &&
> >  	test_commit upstream-one &&
> >  	test_commit upstream-two &&
> > -	git checkout -b @/at-test &&
> > +	if ! test_have_prereq MINGW
> > +	then
> > +		git checkout -b @/at-slash
> 
> I presume that this is meant to be "@/at-test", not "@/at-slash".

Oh my. That's what you get for redoing patches from scratch. Sorry about
that!

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 18/19] mingw: handle the missing POSIXPERM prereq in t9124
  2016-01-26 22:05     ` Junio C Hamano
@ 2016-01-27  9:20       ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27  9:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Junio,

On Tue, 26 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> 
> > On Windows, the permission system works completely differently than
> > expected by some of the tests. So let's make sure that we do not test
> > POSIX functionality on Windows.
> >
> > This lets t9124-git-svn-dcommit-auto-props.sh pass in Git for Windows'
> > SDK.
> >
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> >  t/t9124-git-svn-dcommit-auto-props.sh | 16 ++++++++++------
> >  1 file changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh
> > index aa841e1..2be0805 100755
> > --- a/t/t9124-git-svn-dcommit-auto-props.sh
> > +++ b/t/t9124-git-svn-dcommit-auto-props.sh
> > @@ -34,8 +34,7 @@ test_expect_success 'enable auto-props config' '
> >  '
> >  
> >  test_expect_success 'add files matching auto-props' '
> > -	echo "#!$SHELL_PATH" >exec1.sh &&
> > -	chmod +x exec1.sh &&
> > +	printf "" | write_script exec1.sh &&
> 
> That looks like a useless use of printf.  Why not
> 
> 	write_script exec1.sh </dev/null &&

Good point! I changed it, also in t9100.

> >  	echo "hello" >hello.txt &&
> >  	echo bar >bar &&
> >  	git add exec1.sh hello.txt bar &&
> > @@ -48,8 +47,7 @@ test_expect_success 'disable auto-props config' '
> >  '
> >  
> >  test_expect_success 'add files matching disabled auto-props' '
> > -	echo "#$SHELL_PATH" >exec2.sh &&
> > -	chmod +x exec2.sh &&
> > +	printf "" | write_script exec2.sh &&
> >  	echo "world" >world.txt &&
> >  	echo zot >zot &&
> >  	git add exec2.sh world.txt zot &&
> > @@ -65,7 +63,10 @@ test_expect_success 'check resulting svn repository' '
> >  	cd svnrepo &&
> >  
> >  	# Check properties from first commit.
> > -	test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*" &&
> > +	if test_have_prereq POSIXPERM
> > +	then
> > +		test -z "$(svn_cmd propget svn:executable exec1.sh)"
> 
> Why this change?
> 
> 		test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*" &&
> 
> means "propget command gives a literal string that consists of a
> single asterisk".

Oh wow... I blame it on lack of sleep. Would you believe that I totally
overlooked the asterisk, in both cases? Wow.

Sorry for the mess, cleaned it up locally and will resubmit as soon as the
tests passed on both Windows & Linux, and as soon as I figure out how to
change my charset to something else than unknown.

My apologies,
Dscho

P.S.: Would you believe that the reason the tests passed on Linux was that
I forgot to install Subversion? ;-)

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 16/19] mingw: mark t9100's test cases with appropriate prereqs
  2016-01-26 21:50     ` Junio C Hamano
@ 2016-01-27 16:02       ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Junio,

On Tue, 26 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> 
> > @@ -181,7 +180,8 @@ test_expect_success "$name" '
> >  name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
> >  LC_ALL="$GIT_SVN_LC_ALL"
> >  export LC_ALL
> > -test_expect_success UTF8 "$name" "
> > +# This test relies on the previous test, hence requires POSIXPERM,SYMLINKS
> > +test_expect_success UTF8,POSIXPERM,SYMLINKS "$name" "
> >  	echo '# hello' >> exec-2.sh &&
> >  	git update-index exec-2.sh &&
> >  	git commit -m '???????' &&
> 
> Hmph.  "Content-Type: text/plain; charset=X-UNKNOWN" in the header
> gives a hint to me, too.

Bah. I recently upgraded to a newer Alpine and must have overlooked the
unknown charset option. Sorry for that, I think I fixed it now (let me
know if not).

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH v3 00/20] Let Git's tests pass on Windows
  2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
                     ` (19 preceding siblings ...)
  2016-01-26 22:12   ` [PATCH v2 00/19] Let Git's tests pass on Windows Junio C Hamano
@ 2016-01-27 16:19   ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 01/20] mingw: let's use gettext with MSYS2 Johannes Schindelin
                       ` (20 more replies)
  20 siblings, 21 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

This is a big milestone. With these modifications, Git's source code
does not only build without warnings in Git for Windows' SDK, but
passes the entire regression test suite.

The patch series contains three different types of patches. First,
there are a couple of real fixes that were triggered by failures in
the regression tests. Then there are a couple of fixes to the
regression tests themselves. And finally, we have to disable a couple
of tests because we simply cannot make them work on Windows.

Relative to v2, this fixes stupid typos that made the tests fail on
Linux, a stupid copy-paste error pointed out by Eric Sunshine,
unnecessary 'printf ""' calls pointed out by Junio Hamano, and I now
use `test_have_prereq !MINGW` consistently, as pointed out by both Eric
and Junio. This time, I also send the patch series with the character
set set (sic!) to UTF-8. Oh, and this time, I also made sure that the
regression tests pass on Windows & Linux alike. Oh, and I also managed not
to forget the fix for t9130 this time.


Johannes Schindelin (17):
  mingw: let's use gettext with MSYS2
  mingw: do not trust MSYS2's MinGW gettext.sh
  Git.pm: stop assuming that absolute paths start with a slash
  mingw: prepare the TMPDIR environment variable for shell scripts
  mingw: let lstat() fail with errno == ENOTDIR when appropriate
  mingw: fix t5601-clone.sh
  mingw: accomodate t0060-path-utils for MSYS2
  mingw: disable mkfifo-based tests
  tests: turn off git-daemon tests if FIFOs are not available
  mingw: skip test in t1508 that fails due to path conversion
  mingw: fix t9700's assumption about directory separators
  mingw: work around pwd issues in the tests
  mingw: mark t9100's test cases with appropriate prereqs
  mingw: avoid illegal filename in t9118
  mingw: handle the missing POSIXPERM prereq in t9124
  mingw: skip a test in t9130 that cannot pass on Windows
  mingw: do not bother to test funny file names

Karsten Blees (1):
  mingw: factor out Windows specific environment setup

Pat Thoyts (1):
  Avoid absolute path in t0008

마누엘 (1):
  mingw: try to delete target directory before renaming

 Makefile                              |  1 +
 compat/mingw.c                        | 91 +++++++++++++++++++++++++++++------
 config.mak.uname                      |  3 +-
 perl/Git.pm                           |  3 +-
 t/lib-git-daemon.sh                   |  5 ++
 t/t0008-ignores.sh                    |  2 +-
 t/t0060-path-utils.sh                 |  9 ++++
 t/t1508-at-combinations.sh            |  6 ++-
 t/t3300-funny-names.sh                |  1 +
 t/t3600-rm.sh                         |  2 +-
 t/t3703-add-magic-pathspec.sh         |  2 +-
 t/t3902-quoted.sh                     |  1 +
 t/t4016-diff-quote.sh                 |  1 +
 t/t4135-apply-weird-filenames.sh      |  3 +-
 t/t5601-clone.sh                      | 18 +++----
 t/t7800-difftool.sh                   | 14 +++---
 t/t9100-git-svn-basic.sh              | 18 +++----
 t/t9118-git-svn-funky-branch-names.sh | 12 +++--
 t/t9124-git-svn-dcommit-auto-props.sh | 16 +++---
 t/t9130-git-svn-authors-file.sh       |  2 +-
 t/t9200-git-cvsexportcommit.sh        |  2 +-
 t/t9400-git-cvsserver-server.sh       |  6 +--
 t/t9401-git-cvsserver-crlf.sh         |  6 +--
 t/t9402-git-cvsserver-refs.sh         |  6 +--
 t/t9700/test.pl                       |  2 +-
 t/t9903-bash-prompt.sh                |  2 +-
 t/test-lib.sh                         |  2 +-
 test-fake-ssh.c                       | 30 ++++++++++++
 28 files changed, 196 insertions(+), 70 deletions(-)
 create mode 100644 test-fake-ssh.c

Interdiff vs v2:

 diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
 index c59d554..4a9964e 100755
 --- a/t/t1508-at-combinations.sh
 +++ b/t/t1508-at-combinations.sh
 @@ -35,9 +35,9 @@ test_expect_success 'setup' '
  	git checkout -b upstream-branch &&
  	test_commit upstream-one &&
  	test_commit upstream-two &&
 -	if ! test_have_prereq MINGW
 +	if test_have_prereq !MINGW
  	then
 -		git checkout -b @/at-slash
 +		git checkout -b @/at-test
  	fi &&
  	git checkout -b @@/at-test &&
  	git checkout -b @at-test &&
 diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
 index 5232ee9..d046d98 100755
 --- a/t/t3600-rm.sh
 +++ b/t/t3600-rm.sh
 @@ -14,8 +14,7 @@ test_expect_success \
       git add -- foo bar baz 'space embedded' -q &&
       git commit -m 'add normal files'"
  
 -
 -if ! test_have_prereq MINGW && touch -- 'tab	embedded' 'newline
 +if test_have_prereq !MINGW && touch -- 'tab	embedded' 'newline
  embedded' 2>/dev/null
  then
  	test_set_prereq FUNNYNAMES
 diff --git a/t/t3703-add-magic-pathspec.sh b/t/t3703-add-magic-pathspec.sh
 index aaff784..3ef525a 100755
 --- a/t/t3703-add-magic-pathspec.sh
 +++ b/t/t3703-add-magic-pathspec.sh
 @@ -38,7 +38,7 @@ cat >expected <<EOF
  add 'sub/foo'
  EOF
  
 -if ! test_have_prereq MINGW && mkdir ":" 2>/dev/null
 +if test_have_prereq !MINGW && mkdir ":" 2>/dev/null
  then
  	test_set_prereq COLON_DIR
  fi
 diff --git a/t/t4135-apply-weird-filenames.sh b/t/t4135-apply-weird-filenames.sh
 index 6d6b96d..27cb000 100755
 --- a/t/t4135-apply-weird-filenames.sh
 +++ b/t/t4135-apply-weird-filenames.sh
 @@ -19,7 +19,7 @@ test_expect_success 'setup' '
  
  	test_when_finished "rm -f \"tab	embedded.txt\"" &&
  	test_when_finished "rm -f '\''\"quoteembedded\".txt'\''" &&
 -	if ! test_have_prereq MINGW &&
 +	if test_have_prereq !MINGW &&
  		touch -- "tab	embedded.txt" '\''"quoteembedded".txt'\''
  	then
  		test_set_prereq FUNNYNAMES
 diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
 index 2f4272a..c1efb8e 100755
 --- a/t/t5601-clone.sh
 +++ b/t/t5601-clone.sh
 @@ -5,7 +5,7 @@ test_description=clone
  . ./test-lib.sh
  
  X=
 -! test_have_prereq MINGW || X=.exe
 +test_have_prereq !MINGW || X=.exe
  
  test_expect_success setup '
  
 diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
 index 5b32a3b..56acc1e 100755
 --- a/t/t9100-git-svn-basic.sh
 +++ b/t/t9100-git-svn-basic.sh
 @@ -30,7 +30,7 @@ test_expect_success \
  		echo "deep dir" >dir/a/b/c/d/e/file &&
  		mkdir bar &&
  		echo "zzz" >bar/zzz &&
 -		printf "" | write_script exec.sh &&
 +		write_script exec.sh </dev/null &&
  		svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null
  	) &&
  	rm -rf import &&
 diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh
 index 2be0805..9f7231d 100755
 --- a/t/t9124-git-svn-dcommit-auto-props.sh
 +++ b/t/t9124-git-svn-dcommit-auto-props.sh
 @@ -34,7 +34,7 @@ test_expect_success 'enable auto-props config' '
  '
  
  test_expect_success 'add files matching auto-props' '
 -	printf "" | write_script exec1.sh &&
 +	write_script exec1.sh </dev/null &&
  	echo "hello" >hello.txt &&
  	echo bar >bar &&
  	git add exec1.sh hello.txt bar &&
 @@ -47,7 +47,7 @@ test_expect_success 'disable auto-props config' '
  '
  
  test_expect_success 'add files matching disabled auto-props' '
 -	printf "" | write_script exec2.sh &&
 +	write_script exec2.sh </dev/null &&
  	echo "world" >world.txt &&
  	echo zot >zot &&
  	git add exec2.sh world.txt zot &&
 @@ -65,7 +65,7 @@ test_expect_success 'check resulting svn repository' '
  	# Check properties from first commit.
  	if test_have_prereq POSIXPERM
  	then
 -		test -z "$(svn_cmd propget svn:executable exec1.sh)"
 +		test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*"
  	fi &&
  	test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \
  	     "xapplication/x-shellscript" &&
 @@ -76,7 +76,7 @@ test_expect_success 'check resulting svn repository' '
  	# Check properties from second commit.
  	if test_have_prereq POSIXPERM
  	then
 -		test -z "$(svn_cmd propget svn:executable exec2.sh)"
 +		test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*"
  	fi &&
  	test "x$(svn_cmd propget svn:mime-type exec2.sh)" = "x" &&
  	test "x$(svn_cmd propget svn:mime-type world.txt)" = "x" &&
 diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh
 index d306b77..4126481 100755
 --- a/t/t9130-git-svn-authors-file.sh
 +++ b/t/t9130-git-svn-authors-file.sh
 @@ -91,7 +91,7 @@ test_expect_success 'fetch continues after authors-file is fixed' '
  	)
  	'
  
 -test_expect_success 'fresh clone with svn.authors-file in config' '
 +test_expect_success !MINGW 'fresh clone with svn.authors-file in config' '
  	(
  		rm -r "$GIT_DIR" &&
  		test x = x"$(git config svn.authorsfile)" &&
 diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
 index 2ee6564..ffbfa0e 100755
 --- a/t/t9903-bash-prompt.sh
 +++ b/t/t9903-bash-prompt.sh
 @@ -67,7 +67,7 @@ repo_with_newline='repo
  with
  newline'
  
 -if ! test_have_prereq MINGW && mkdir "$repo_with_newline" 2>/dev/null
 +if test_have_prereq !MINGW && mkdir "$repo_with_newline" 2>/dev/null
  then
  	test_set_prereq FUNNYNAMES
  else

-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply	[flat|nested] 113+ messages in thread

* [PATCH v3 01/20] mingw: let's use gettext with MSYS2
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 02/20] mingw: do not trust MSYS2's MinGW gettext.sh Johannes Schindelin
                       ` (19 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This solves two problems:

- we now have proper localisation even on Windows

- we sidestep the infamous "BUG: your vsnprintf is broken (returned -1)"
  message when running "git init" (which otherwise prevents the entire
  test suite from running) because libintl.h overrides vsnprintf() with
  libintl_vsnprintf() [*1*]

The latter issue is rather crucial, as *no* test passes in Git for
Windows without this fix.

Footnote *1*: gettext_git=http://git.savannah.gnu.org/cgit/gettext.git
$gettext_git/tree/gettext-runtime/intl/libgnuintl.in.h#n380

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config.mak.uname b/config.mak.uname
index 4b2e1b8..6b25661 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -560,7 +560,7 @@ else
 		NO_R_TO_GCC_LINKER = YesPlease
 		INTERNAL_QSORT = YesPlease
 		HAVE_LIBCHARSET_H = YesPlease
-		NO_GETTEXT = YesPlease
+		NO_GETTEXT =
 		USE_LIBPCRE= YesPlease
 		NO_CURL =
 		USE_NED_ALLOCATOR = YesPlease
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 02/20] mingw: do not trust MSYS2's MinGW gettext.sh
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 01/20] mingw: let's use gettext with MSYS2 Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 03/20] Git.pm: stop assuming that absolute paths start with a slash Johannes Schindelin
                       ` (18 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

It does not quite work because it produces DOS line endings which the
shell does not like at all.

This lets t0200-gettext-basic.sh, t0204-gettext-reencode-sanity.sh,
t3406-rebase-message.sh, t3903-stash.sh, t7400-submodule-basic.sh,
t7401-submodule-summary.sh, t7406-submodule-update.sh and
t7407-submodule-foreach.sh pass in Git for Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.mak.uname | 1 +
 1 file changed, 1 insertion(+)

diff --git a/config.mak.uname b/config.mak.uname
index 6b25661..d6f7980 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -561,6 +561,7 @@ else
 		INTERNAL_QSORT = YesPlease
 		HAVE_LIBCHARSET_H = YesPlease
 		NO_GETTEXT =
+		USE_GETTEXT_SCHEME = fallthrough
 		USE_LIBPCRE= YesPlease
 		NO_CURL =
 		USE_NED_ALLOCATOR = YesPlease
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 03/20] Git.pm: stop assuming that absolute paths start with a slash
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 01/20] mingw: let's use gettext with MSYS2 Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 02/20] mingw: do not trust MSYS2's MinGW gettext.sh Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 04/20] mingw: factor out Windows specific environment setup Johannes Schindelin
                       ` (17 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Windows, absolute paths never start with a slash, unless a POSIX
emulation layer is used. The latter is the case for MSYS2's Perl that
Git for Windows leverages. However, in the tests we also go through
plain `git.exe`, which does *not* leverage the POSIX emulation layer,
and therefore the paths we pass to Perl may actually be DOS-style paths
such as C:/Program Files/Git.

So let's just use Perl's own way to test whether a given path is
absolute or not instead of home-brewing our own.

This patch partially fixes t7800 and t9700 when running in Git for
Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 perl/Git.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/perl/Git.pm b/perl/Git.pm
index 19ef081..49eb88a 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -188,7 +188,8 @@ sub repository {
 		};
 
 		if ($dir) {
-			$dir =~ m#^/# or $dir = $opts{Directory} . '/' . $dir;
+			_verify_require();
+			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.
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 04/20] mingw: factor out Windows specific environment setup
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (2 preceding siblings ...)
  2016-01-27 16:19     ` [PATCH v3 03/20] Git.pm: stop assuming that absolute paths start with a slash Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 05/20] mingw: prepare the TMPDIR environment variable for shell scripts Johannes Schindelin
                       ` (16 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Karsten Blees, git

From: Karsten Blees <blees@dcon.de>

We will add more environment-related code to that new function
in the next patch.

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 77a51d3..8d52c73 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2047,6 +2047,22 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
 	return -1;
 }
 
+static void setup_windows_environment()
+{
+	/* on Windows it is TMP and TEMP */
+	if (!getenv("TMPDIR")) {
+		const char *tmp = getenv("TMP");
+		if (!tmp)
+			tmp = getenv("TEMP");
+		if (tmp)
+			setenv("TMPDIR", tmp, 1);
+	}
+
+	/* simulate TERM to enable auto-color (see color.c) */
+	if (!getenv("TERM"))
+		setenv("TERM", "cygwin", 1);
+}
+
 /*
  * Disable MSVCRT command line wildcard expansion (__getmainargs called from
  * mingw startup code, see init.c in mingw runtime).
@@ -2125,19 +2141,7 @@ void mingw_startup()
 	qsort(environ, i, sizeof(char*), compareenv);
 
 	/* fix Windows specific environment settings */
-
-	/* on Windows it is TMP and TEMP */
-	if (!mingw_getenv("TMPDIR")) {
-		const char *tmp = mingw_getenv("TMP");
-		if (!tmp)
-			tmp = mingw_getenv("TEMP");
-		if (tmp)
-			setenv("TMPDIR", tmp, 1);
-	}
-
-	/* simulate TERM to enable auto-color (see color.c) */
-	if (!getenv("TERM"))
-		setenv("TERM", "cygwin", 1);
+	setup_windows_environment();
 
 	/* initialize critical section for waitpid pinfo_t list */
 	InitializeCriticalSection(&pinfo_cs);
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 05/20] mingw: prepare the TMPDIR environment variable for shell scripts
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (3 preceding siblings ...)
  2016-01-27 16:19     ` [PATCH v3 04/20] mingw: factor out Windows specific environment setup Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 06/20] mingw: try to delete target directory before renaming Johannes Schindelin
                       ` (15 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

When shell scripts access a $TMPDIR variable containing backslashes,
they will be mistaken for escape characters. Let's not let that happen
by converting them to forward slashes.

This partially fixes t7800 with MSYS2.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 8d52c73..ba5cb1c 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2049,13 +2049,28 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
 
 static void setup_windows_environment()
 {
+	char *tmp = getenv("TMPDIR");
+
 	/* on Windows it is TMP and TEMP */
-	if (!getenv("TMPDIR")) {
-		const char *tmp = getenv("TMP");
-		if (!tmp)
+	if (!tmp) {
+		if (!(tmp = getenv("TMP")))
 			tmp = getenv("TEMP");
-		if (tmp)
+		if (tmp) {
 			setenv("TMPDIR", tmp, 1);
+			tmp = getenv("TMPDIR");
+		}
+	}
+
+	if (tmp) {
+		/*
+		 * Convert all dir separators to forward slashes,
+		 * to help shell commands called from the Git
+		 * executable (by not mistaking the dir separators
+		 * for escape characters).
+		 */
+		for (; *tmp; tmp++)
+			if (*tmp == '\\')
+				*tmp = '/';
 	}
 
 	/* simulate TERM to enable auto-color (see color.c) */
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 06/20] mingw: try to delete target directory before renaming
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (4 preceding siblings ...)
  2016-01-27 16:19     ` [PATCH v3 05/20] mingw: prepare the TMPDIR environment variable for shell scripts Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 07/20] mingw: let lstat() fail with errno == ENOTDIR when appropriate Johannes Schindelin
                       ` (14 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: 마누엘, git

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

From: =?UTF-8?q?=EB=A7=88=EB=88=84=EC=97=98?= <nalla@hamal.uberspace.de>

When the rename() function tries to move a directory it fails if the
target directory exists. It should check if it can delete the (possibly
empty) target directory and then try again to move the directory.

This partially fixes t9100-git-svn-basic.sh.

Signed-off-by: 마누엘 <nalla@hamal.uberspace.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index ba5cb1c..f37f8d5 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1603,7 +1603,12 @@ repeat:
 	if (gle == ERROR_ACCESS_DENIED &&
 	    (attrs = GetFileAttributesW(wpnew)) != INVALID_FILE_ATTRIBUTES) {
 		if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
-			errno = EISDIR;
+			DWORD attrsold = GetFileAttributesW(wpold);
+			if (attrsold == INVALID_FILE_ATTRIBUTES ||
+			    !(attrsold & FILE_ATTRIBUTE_DIRECTORY))
+				errno = EISDIR;
+			else if (!_wrmdir(wpnew))
+				goto repeat;
 			return -1;
 		}
 		if ((attrs & FILE_ATTRIBUTE_READONLY) &&
-- 
2.7.0.windows.1.7.g55a05c8


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 07/20] mingw: let lstat() fail with errno == ENOTDIR when appropriate
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (5 preceding siblings ...)
  2016-01-27 16:19     ` [PATCH v3 06/20] mingw: try to delete target directory before renaming Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 08/20] mingw: fix t5601-clone.sh Johannes Schindelin
                       ` (13 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

POSIX semantics requires lstat() to fail with ENOTDIR when "[a]
component of the path prefix names an existing file that is neither a
directory nor a symbolic link to a directory".

See http://pubs.opengroup.org/onlinepubs/9699919799/functions/lstat.html

This behavior is expected by t1404-update-ref-df-conflicts now.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 compat/mingw.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/compat/mingw.c b/compat/mingw.c
index f37f8d5..fbe69b8 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -454,6 +454,39 @@ static inline time_t filetime_to_time_t(const FILETIME *ft)
 	return (time_t)(filetime_to_hnsec(ft) / 10000000);
 }
 
+/**
+ * Verifies that safe_create_leading_directories() would succeed.
+ */
+static int has_valid_directory_prefix(wchar_t *wfilename)
+{
+	int n = wcslen(wfilename);
+
+	while (n > 0) {
+		wchar_t c = wfilename[--n];
+		DWORD attributes;
+
+		if (!is_dir_sep(c))
+			continue;
+
+		wfilename[n] = L'\0';
+		attributes = GetFileAttributesW(wfilename);
+		wfilename[n] = c;
+		if (attributes == FILE_ATTRIBUTE_DIRECTORY ||
+				attributes == FILE_ATTRIBUTE_DEVICE)
+			return 1;
+		if (attributes == INVALID_FILE_ATTRIBUTES)
+			switch (GetLastError()) {
+			case ERROR_PATH_NOT_FOUND:
+				continue;
+			case ERROR_FILE_NOT_FOUND:
+				/* This implies parent directory exists. */
+				return 1;
+			}
+		return 0;
+	}
+	return 1;
+}
+
 /* We keep the do_lstat code in a separate function to avoid recursion.
  * When a path ends with a slash, the stat will fail with ENOENT. In
  * this case, we strip the trailing slashes and stat again.
@@ -514,6 +547,12 @@ static int do_lstat(int follow, const char *file_name, struct stat *buf)
 	case ERROR_NOT_ENOUGH_MEMORY:
 		errno = ENOMEM;
 		break;
+	case ERROR_PATH_NOT_FOUND:
+		if (!has_valid_directory_prefix(wfilename)) {
+			errno = ENOTDIR;
+			break;
+		}
+		/* fallthru */
 	default:
 		errno = ENOENT;
 		break;
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 08/20] mingw: fix t5601-clone.sh
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (6 preceding siblings ...)
  2016-01-27 16:19     ` [PATCH v3 07/20] mingw: let lstat() fail with errno == ENOTDIR when appropriate Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 09/20] mingw: accomodate t0060-path-utils for MSYS2 Johannes Schindelin
                       ` (12 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Since baaf233 (connect: improve check for plink to reduce false
positives, 2015-04-26), t5601 writes out a `plink.exe` for testing that
is actually a shell script. So the assumption that the `.exe` extension
implies that the file is *not* a shell script is now wrong.

Since there was no love for the idea of allowing `.exe` files to be
shell scripts on Windows, let's go the other way round: *make*
`plink.exe` a real `.exe`.

This fixes t5601-clone.sh in Git for Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile         |  1 +
 t/t5601-clone.sh | 18 ++++++++----------
 test-fake-ssh.c  | 30 ++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 10 deletions(-)
 create mode 100644 test-fake-ssh.c

diff --git a/Makefile b/Makefile
index fc2f1ab..10566d6 100644
--- a/Makefile
+++ b/Makefile
@@ -583,6 +583,7 @@ TEST_PROGRAMS_NEED_X += test-delta
 TEST_PROGRAMS_NEED_X += test-dump-cache-tree
 TEST_PROGRAMS_NEED_X += test-dump-split-index
 TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
+TEST_PROGRAMS_NEED_X += test-fake-ssh
 TEST_PROGRAMS_NEED_X += test-genrandom
 TEST_PROGRAMS_NEED_X += test-hashmap
 TEST_PROGRAMS_NEED_X += test-index-version
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 669ec9b..c1efb8e 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -4,6 +4,9 @@ test_description=clone
 
 . ./test-lib.sh
 
+X=
+test_have_prereq !MINGW || X=.exe
+
 test_expect_success setup '
 
 	rm -fr .git &&
@@ -305,14 +308,9 @@ test_expect_success 'clone checking out a tag' '
 
 setup_ssh_wrapper () {
 	test_expect_success 'setup ssh wrapper' '
-		write_script "$TRASH_DIRECTORY/ssh-wrapper" <<-\EOF &&
-		echo >>"$TRASH_DIRECTORY/ssh-output" "ssh: $*" &&
-		# throw away all but the last argument, which should be the
-		# command
-		while test $# -gt 1; do shift; done
-		eval "$1"
-		EOF
-		GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
+		cp "$GIT_BUILD_DIR/test-fake-ssh$X" \
+			"$TRASH_DIRECTORY/ssh-wrapper$X" &&
+		GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper$X" &&
 		export GIT_SSH &&
 		export TRASH_DIRECTORY &&
 		>"$TRASH_DIRECTORY"/ssh-output
@@ -320,8 +318,8 @@ setup_ssh_wrapper () {
 }
 
 copy_ssh_wrapper_as () {
-	cp "$TRASH_DIRECTORY/ssh-wrapper" "$1" &&
-	GIT_SSH="$1" &&
+	cp "$TRASH_DIRECTORY/ssh-wrapper$X" "${1%$X}$X" &&
+	GIT_SSH="${1%$X}$X" &&
 	export GIT_SSH
 }
 
diff --git a/test-fake-ssh.c b/test-fake-ssh.c
new file mode 100644
index 0000000..980de21
--- /dev/null
+++ b/test-fake-ssh.c
@@ -0,0 +1,30 @@
+#include "git-compat-util.h"
+#include "run-command.h"
+#include "strbuf.h"
+
+int main(int argc, char **argv)
+{
+	const char *trash_directory = getenv("TRASH_DIRECTORY");
+	struct strbuf buf = STRBUF_INIT;
+	FILE *f;
+	int i;
+	const char *child_argv[] = { NULL, NULL };
+
+	/* First, print all parameters into $TRASH_DIRECTORY/ssh-output */
+	if (!trash_directory)
+		die("Need a TRASH_DIRECTORY!");
+	strbuf_addf(&buf, "%s/ssh-output", trash_directory);
+	f = fopen(buf.buf, "w");
+	if (!f)
+		die("Could not write to %s", buf.buf);
+	for (i = 0; i < argc; i++)
+		fprintf(f, "%s%s", i > 0 ? " " : "", i > 0 ? argv[i] : "ssh:");
+	fprintf(f, "\n");
+	fclose(f);
+
+	/* Now, evaluate the *last* parameter */
+	if (argc < 2)
+		return 0;
+	child_argv[0] = argv[argc - 1];
+	return run_command_v_opt(child_argv, RUN_USING_SHELL);
+}
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 09/20] mingw: accomodate t0060-path-utils for MSYS2
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (7 preceding siblings ...)
  2016-01-27 16:19     ` [PATCH v3 08/20] mingw: fix t5601-clone.sh Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 10/20] mingw: disable mkfifo-based tests Johannes Schindelin
                       ` (11 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Windows, there are no POSIX paths, only Windows ones (an absolute
Windows path looks like "C:\Program Files\Git\ReleaseNotes.html", under
most circumstances, forward slashes are also allowed and synonymous to
backslashes).

So when a POSIX shell (such as MSYS2's Bash, which is used by Git for
Windows to execute all those shell scripts that are part of Git) passes
a POSIX path to test-path-utils.exe (which is not POSIX-aware), the path
is translated into a Windows path. For example, /etc/profile becomes
C:/Program Files/Git/etc/profile.

This path translation poses a problem when passing the root directory as
parameter to test-path-utils.exe, as it is not well defined whether the
translated root directory should end in a slash or not. MSys1 stripped
the trailing slash, but MSYS2 does not.

Originally, the Git for Windows project patched MSYS2's runtime to
accomodate Git's regression test, but we really should do it the other
way round.

To work with both of MSys1's and MSYS2's behaviors, we simply test what
the current system does in the beginning of t0060-path-utils.sh and then
adjust the expected longest ancestor length accordingly.

It looks quite a bit tricky what we actually do in this patch: first, we
adjust the expected length for the trailing slash we did not originally
expect (subtracting one). So far, so good.

But now comes the part where things work in a surprising way: when the
expected length was 0, the prefix to match is the root directory. If the
root directory is converted into a path with a trailing slash, however,
we know that the logic in longest_ancestor_length() cannot match: to
avoid partial matches of the last directory component, it verifies that
the character after the matching prefix is a slash (but because the
slash was part of the matching prefix, the next character cannot be a
slash). So the return value is -1. Alas, this is exactly what the
expected length is after subtracting the value of $rootslash! So we skip
adding the $rootoff value in that case (and only in that case).

Directories other than the root directory are handled fine (as they are
specified without a trailing slash, something not possible for the root
directory, and MSYS2 converts them into Windows paths that also lack
trailing slashes), therefore we do not need any more special handling.

Thanks to Ray Donnelly for his patient help with this issue.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t0060-path-utils.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index f0152a7..8532a02 100755
--- a/t/t0060-path-utils.sh
+++ b/t/t0060-path-utils.sh
@@ -36,12 +36,21 @@ if test $rootoff = 2; then
 	rootoff=	# we are on Unix
 else
 	rootoff=$(($rootoff-1))
+	# In MSYS2, the root directory "/" is translated into a Windows
+	# directory *with* trailing slash. Let's test for that and adjust
+	# our expected longest ancestor length accordingly.
+	case "$(test-path-utils print_path /)" in
+	*/) rootslash=1;;
+	*) rootslash=0;;
+	esac
 fi
 
 ancestor() {
 	# We do some math with the expected ancestor length.
 	expected=$3
 	if test -n "$rootoff" && test "x$expected" != x-1; then
+		expected=$(($expected-$rootslash))
+		test $expected -lt 0 ||
 		expected=$(($expected+$rootoff))
 	fi
 	test_expect_success "longest ancestor: $1 $2 => $expected" \
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 10/20] mingw: disable mkfifo-based tests
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (8 preceding siblings ...)
  2016-01-27 16:19     ` [PATCH v3 09/20] mingw: accomodate t0060-path-utils for MSYS2 Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 11/20] tests: turn off git-daemon tests if FIFOs are not available Johannes Schindelin
                       ` (10 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

MSYS2 (the POSIX emulation layer used by Git for Windows' Bash) actually
has a working mkfifo. The only problem is that it is only emulating
named pipes through the MSYS2 runtime; The Win32 API has no idea about
named pipes, hence the Git executable cannot access those pipes either.

The symptom is that Git fails with a '<name>: No such file or directory'
because MSYS2 emulates named pipes through special-crafted '.lnk' files.

The solution is to tell the test suite explicitly that we cannot use
named pipes when we want to test on Windows.

This lets t4056-diff-order.sh, t9010-svn-fe.sh and t9300-fast-import.sh
pass.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/test-lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index bd4b02e..1470c8d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -998,7 +998,7 @@ test_i18ngrep () {
 test_lazy_prereq PIPE '
 	# test whether the filesystem supports FIFOs
 	case $(uname -s) in
-	CYGWIN*)
+	CYGWIN*|MINGW*)
 		false
 		;;
 	*)
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 11/20] tests: turn off git-daemon tests if FIFOs are not available
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (9 preceding siblings ...)
  2016-01-27 16:19     ` [PATCH v3 10/20] mingw: disable mkfifo-based tests Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-28  8:21       ` Eric Sunshine
  2016-01-27 16:19     ` [PATCH v3 12/20] mingw: skip test in t1508 that fails due to path conversion Johannes Schindelin
                       ` (9 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

The Git daemon tests create a FIFO first thing and will hang if said
FIFO is not available.

This is a problem with Git for Windows, where `mkfifo` is an MSYS2
program that leverages MSYS2's POSIX emulation layer, but
`git-daemon.exe` is a MINGW program that has not the first clue about
that POSIX emulation layer and therefore blinks twice when it sees
MSYS2's emulated FIFOs and then just stares into space.

This lets t5570-git-daemon.sh and t5811-proto-disable-git.sh pass.

Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/lib-git-daemon.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh
index bc4b341..9b1271c 100644
--- a/t/lib-git-daemon.sh
+++ b/t/lib-git-daemon.sh
@@ -23,6 +23,11 @@ then
 	test_done
 fi
 
+if ! test_have_prereq PIPE
+then
+	test_skip_or_die $GIT_TEST_GIT_DAEMON "file system does not support FIFOs"
+fi
+
 LIB_GIT_DAEMON_PORT=${LIB_GIT_DAEMON_PORT-${this_test#t}}
 
 GIT_DAEMON_PID=
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 12/20] mingw: skip test in t1508 that fails due to path conversion
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (10 preceding siblings ...)
  2016-01-27 16:19     ` [PATCH v3 11/20] tests: turn off git-daemon tests if FIFOs are not available Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 13/20] mingw: fix t9700's assumption about directory separators Johannes Schindelin
                       ` (8 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

In Git for Windows, the MSYS2 POSIX emulation layer used by the Bash
converts command-line arguments that looks like they refer to a POSIX
path containing a file list (i.e. @<absolute-path>) into a Windows path
equivalent when calling non-MSYS2 executables, such as git.exe.

Let's just skip the test that uses the parameter `@/at-test` that
confuses the MSYS2 runtime.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t1508-at-combinations.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
index 078e119..4a9964e 100755
--- a/t/t1508-at-combinations.sh
+++ b/t/t1508-at-combinations.sh
@@ -35,7 +35,10 @@ test_expect_success 'setup' '
 	git checkout -b upstream-branch &&
 	test_commit upstream-one &&
 	test_commit upstream-two &&
-	git checkout -b @/at-test &&
+	if test_have_prereq !MINGW
+	then
+		git checkout -b @/at-test
+	fi &&
 	git checkout -b @@/at-test &&
 	git checkout -b @at-test &&
 	git checkout -b old-branch &&
@@ -64,6 +67,7 @@ check "@{-1}@{u}@{1}" commit master-one
 check "@" commit new-two
 check "@@{u}" ref refs/heads/upstream-branch
 check "@@/at-test" ref refs/heads/@@/at-test
+test_have_prereq MINGW ||
 check "@/at-test" ref refs/heads/@/at-test
 check "@at-test" ref refs/heads/@at-test
 nonsense "@{u}@{-1}"
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 13/20] mingw: fix t9700's assumption about directory separators
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (11 preceding siblings ...)
  2016-01-27 16:19     ` [PATCH v3 12/20] mingw: skip test in t1508 that fails due to path conversion Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:19     ` [PATCH v3 14/20] mingw: work around pwd issues in the tests Johannes Schindelin
                       ` (7 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This test assumed that there is only one directory separator (the
forward slash), not two equivalent directory separators.
However, on Windows, the back slash and the forward slash *are*
equivalent.

Let's paper over this issue by converting the backward slashes to
forward ones in the test that fails with MSYS2 otherwise.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9700/test.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index 1140767..7e8c40b 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -33,7 +33,7 @@ is($r->config_int("test.int"), 2048, "config_int: integer");
 is($r->config_int("test.nonexistent"), undef, "config_int: nonexistent");
 ok($r->config_bool("test.booltrue"), "config_bool: true");
 ok(!$r->config_bool("test.boolfalse"), "config_bool: false");
-is($r->config_path("test.path"), $r->config("test.pathexpanded"),
+is($r->config_path("test.path") =~ s/\\/\//gr, $r->config("test.pathexpanded"),
    "config_path: ~/foo expansion");
 is_deeply([$r->config_path("test.pathmulti")], ["foo", "bar"],
    "config_path: multiple values");
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 14/20] mingw: work around pwd issues in the tests
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (12 preceding siblings ...)
  2016-01-27 16:19     ` [PATCH v3 13/20] mingw: fix t9700's assumption about directory separators Johannes Schindelin
@ 2016-01-27 16:19     ` Johannes Schindelin
  2016-01-27 16:20     ` [PATCH v3 15/20] Avoid absolute path in t0008 Johannes Schindelin
                       ` (6 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

In Git for Windows' SDK, the tests are run using a Bash that relies on
the POSIX emulation layer MSYS2 (itself a friendly fork of Cygwin). As
such, paths in tests can be POSIX paths. As soon as those paths are
passed to git.exe (which does *not* use the POSIX emulation layer),
those paths are converted into Windows paths, though. This happens
for command-line parameters, but not when reading, say, config variables.

To help with that, the `pwd` command is overridden to return the Windows
path of the current working directory when testing Git on Windows.

However, when talking to anything using the POSIX emulation layer, it is
really much better to use POSIX paths because Windows paths contain a
colon after the drive letter that will easily be mistaken for the common
separator in path lists.

So let's just use the $PWD variable when the POSIX path is needed.

This lets t7800-difftool.sh, t9400-git-cvsserver-server.sh,
t9402-git-cvsserver-refs.sh and t9401-git-cvsserver-crlf.sh pass in Git
for Windows' SDK.

Note: the cvsserver tests require not only the `cvs` package (install
it into Git for Windows' SDK via `pacman -S cvs`) but also the Perl
SQLite bindings (install them into Git for Windows' SDK via
`cpan DBD::SQLite`).

This patch is based on earlier work by 마누엘 and Karsten Blees.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t7800-difftool.sh             | 14 +++++++-------
 t/t9400-git-cvsserver-server.sh |  6 +++---
 t/t9401-git-cvsserver-crlf.sh   |  6 +++---
 t/t9402-git-cvsserver-refs.sh   |  6 +++---
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
index ec8bc8c..4e713f7 100755
--- a/t/t7800-difftool.sh
+++ b/t/t7800-difftool.sh
@@ -430,11 +430,11 @@ EOF
 test_expect_success PERL,SYMLINKS 'difftool --dir-diff --symlink without unstaged changes' '
 	cat >expect <<-EOF &&
 	file
-	$(pwd)/file
+	$PWD/file
 	file2
-	$(pwd)/file2
+	$PWD/file2
 	sub/sub
-	$(pwd)/sub/sub
+	$PWD/sub/sub
 	EOF
 	git difftool --dir-diff --symlink \
 		--extcmd "./.git/CHECK_SYMLINKS" branch HEAD &&
@@ -448,14 +448,14 @@ EOF
 run_dir_diff_test 'difftool --dir-diff syncs worktree with unstaged change' '
 	test_when_finished git reset --hard &&
 	echo "orig content" >file &&
-	git difftool -d $symlinks --extcmd "$(pwd)/modify-right-file" branch &&
+	git difftool -d $symlinks --extcmd "$PWD/modify-right-file" branch &&
 	echo "new content" >expect &&
 	test_cmp expect file
 '
 
 run_dir_diff_test 'difftool --dir-diff syncs worktree without unstaged change' '
 	test_when_finished git reset --hard &&
-	git difftool -d $symlinks --extcmd "$(pwd)/modify-right-file" branch &&
+	git difftool -d $symlinks --extcmd "$PWD/modify-right-file" branch &&
 	echo "new content" >expect &&
 	test_cmp expect file
 '
@@ -466,7 +466,7 @@ EOF
 
 test_expect_success PERL 'difftool --no-symlinks does not overwrite working tree file ' '
 	echo "orig content" >file &&
-	git difftool --dir-diff --no-symlinks --extcmd "$(pwd)/modify-file" branch &&
+	git difftool --dir-diff --no-symlinks --extcmd "$PWD/modify-file" branch &&
 	echo "new content" >expect &&
 	test_cmp expect file
 '
@@ -482,7 +482,7 @@ test_expect_success PERL 'difftool --no-symlinks detects conflict ' '
 		TMPDIR=$TRASH_DIRECTORY &&
 		export TMPDIR &&
 		echo "orig content" >file &&
-		test_must_fail git difftool --dir-diff --no-symlinks --extcmd "$(pwd)/modify-both-files" branch &&
+		test_must_fail git difftool --dir-diff --no-symlinks --extcmd "$PWD/modify-both-files" branch &&
 		echo "wt content" >expect &&
 		test_cmp expect file &&
 		echo "tmp content" >expect &&
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 6146c3f..d708cbf 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -25,11 +25,11 @@ perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
     test_done
 }
 
-WORKDIR=$(pwd)
-SERVERDIR=$(pwd)/gitcvs.git
+WORKDIR=$PWD
+SERVERDIR=$PWD/gitcvs.git
 git_config="$SERVERDIR/config"
 CVSROOT=":fork:$SERVERDIR"
-CVSWORK="$(pwd)/cvswork"
+CVSWORK="$PWD/cvswork"
 CVS_SERVER=git-cvsserver
 export CVSROOT CVS_SERVER
 
diff --git a/t/t9401-git-cvsserver-crlf.sh b/t/t9401-git-cvsserver-crlf.sh
index 5a4ed28..f324b9f 100755
--- a/t/t9401-git-cvsserver-crlf.sh
+++ b/t/t9401-git-cvsserver-crlf.sh
@@ -74,11 +74,11 @@ perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
 }
 
 unset GIT_DIR GIT_CONFIG
-WORKDIR=$(pwd)
-SERVERDIR=$(pwd)/gitcvs.git
+WORKDIR=$PWD
+SERVERDIR=$PWD/gitcvs.git
 git_config="$SERVERDIR/config"
 CVSROOT=":fork:$SERVERDIR"
-CVSWORK="$(pwd)/cvswork"
+CVSWORK="$PWD/cvswork"
 CVS_SERVER=git-cvsserver
 export CVSROOT CVS_SERVER
 
diff --git a/t/t9402-git-cvsserver-refs.sh b/t/t9402-git-cvsserver-refs.sh
index d00df08..6d2d3c8 100755
--- a/t/t9402-git-cvsserver-refs.sh
+++ b/t/t9402-git-cvsserver-refs.sh
@@ -82,11 +82,11 @@ perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
 }
 
 unset GIT_DIR GIT_CONFIG
-WORKDIR=$(pwd)
-SERVERDIR=$(pwd)/gitcvs.git
+WORKDIR=$PWD
+SERVERDIR=$PWD/gitcvs.git
 git_config="$SERVERDIR/config"
 CVSROOT=":fork:$SERVERDIR"
-CVSWORK="$(pwd)/cvswork"
+CVSWORK="$PWD/cvswork"
 CVS_SERVER=git-cvsserver
 export CVSROOT CVS_SERVER
 
-- 
2.7.0.windows.1.7.g55a05c8


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 15/20] Avoid absolute path in t0008
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (13 preceding siblings ...)
  2016-01-27 16:19     ` [PATCH v3 14/20] mingw: work around pwd issues in the tests Johannes Schindelin
@ 2016-01-27 16:20     ` Johannes Schindelin
  2016-01-27 16:20     ` [PATCH v3 16/20] mingw: mark t9100's test cases with appropriate prereqs Johannes Schindelin
                       ` (5 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Pat Thoyts, git

From: Pat Thoyts <patthoyts@users.sourceforge.net>

The colon is used by check-ignore to separate paths from other output
values. If we use an absolute path, however, on Windows it will be
converted into a Windows path that very much contains a colon.

It is actually not at all necessary to make the path of the global
excludes absolute, so let's just not even do that.

Based on suggestions by Karsten Blees and Junio Hamano.

Suggested-by: Karsten Blees <karsten.blees@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t0008-ignores.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
index 4ef5ed4..89544dd 100755
--- a/t/t0008-ignores.sh
+++ b/t/t0008-ignores.sh
@@ -5,7 +5,7 @@ test_description=check-ignore
 . ./test-lib.sh
 
 init_vars () {
-	global_excludes="$(pwd)/global-excludes"
+	global_excludes="global-excludes"
 }
 
 enable_global_excludes () {
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 16/20] mingw: mark t9100's test cases with appropriate prereqs
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (14 preceding siblings ...)
  2016-01-27 16:20     ` [PATCH v3 15/20] Avoid absolute path in t0008 Johannes Schindelin
@ 2016-01-27 16:20     ` Johannes Schindelin
  2016-01-27 16:33       ` Johannes Schindelin
  2016-01-27 16:20     ` [PATCH v3 17/20] mingw: avoid illegal filename in t9118 Johannes Schindelin
                       ` (4 subsequent siblings)
  20 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=X-UNKNOWN, Size: 3033 bytes --]

Many a test requires either POSIXPERM (to change the executable bit) or
SYMLINKS, and neither are available on Windows.

This lets t9100-git-svn-basic.sh pass in Git for Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9100-git-svn-basic.sh | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 258d9b8..56acc1e 100755
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
@@ -30,8 +30,7 @@ test_expect_success \
 		echo "deep dir" >dir/a/b/c/d/e/file &&
 		mkdir bar &&
 		echo "zzz" >bar/zzz &&
-		echo "#!/bin/sh" >exec.sh &&
-		chmod +x exec.sh &&
+		write_script exec.sh </dev/null &&
 		svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null
 	) &&
 	rm -rf import &&
@@ -117,7 +116,7 @@ test_expect_success "$name" '
 
 
 name='remove executable bit from a file'
-test_expect_success "$name" '
+test_expect_success POSIXPERM "$name" '
 	rm -f "$GIT_DIR"/index &&
 	git checkout -f -b mybranch5 ${remotes_git_svn} &&
 	chmod -x exec.sh &&
@@ -130,7 +129,7 @@ test_expect_success "$name" '
 
 
 name='add executable bit back file'
-test_expect_success "$name" '
+test_expect_success POSIXPERM "$name" '
 	chmod +x exec.sh &&
 	git update-index exec.sh &&
 	git commit -m "$name" &&
@@ -141,7 +140,7 @@ test_expect_success "$name" '
 
 
 name='executable file becomes a symlink to file'
-test_expect_success "$name" '
+test_expect_success SYMLINKS "$name" '
 	rm exec.sh &&
 	ln -s file exec.sh &&
 	git update-index exec.sh &&
@@ -153,7 +152,7 @@ test_expect_success "$name" '
 
 name='new symlink is added to a file that was also just made executable'
 
-test_expect_success "$name" '
+test_expect_success POSIXPERM,SYMLINKS "$name" '
 	chmod +x file &&
 	ln -s file exec-2.sh &&
 	git update-index --add file exec-2.sh &&
@@ -165,7 +164,7 @@ test_expect_success "$name" '
 	test -h "$SVN_TREE"/exec-2.sh'
 
 name='modify a symlink to become a file'
-test_expect_success "$name" '
+test_expect_success POSIXPERM,SYMLINKS "$name" '
 	echo git help >help &&
 	rm exec-2.sh &&
 	cp help exec-2.sh &&
@@ -181,7 +180,8 @@ test_expect_success "$name" '
 name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
 LC_ALL="$GIT_SVN_LC_ALL"
 export LC_ALL
-test_expect_success UTF8 "$name" "
+# This test relies on the previous test, hence requires POSIXPERM,SYMLINKS
+test_expect_success UTF8,POSIXPERM,SYMLINKS "$name" "
 	echo '# hello' >> exec-2.sh &&
 	git update-index exec-2.sh &&
 	git commit -m 'éï∏' &&
@@ -214,7 +214,7 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
 tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4
 EOF
 
-test_expect_success "$name" "test_cmp a expected"
+test_expect_success POSIXPERM,SYMLINKS "$name" "test_cmp a expected"
 
 test_expect_success 'exit if remote refs are ambigious' "
         git config --add svn-remote.svn.fetch \
-- 
2.7.0.windows.1.7.g55a05c8


^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 17/20] mingw: avoid illegal filename in t9118
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (15 preceding siblings ...)
  2016-01-27 16:20     ` [PATCH v3 16/20] mingw: mark t9100's test cases with appropriate prereqs Johannes Schindelin
@ 2016-01-27 16:20     ` Johannes Schindelin
  2016-01-27 16:20     ` [PATCH v3 18/20] mingw: handle the missing POSIXPERM prereq in t9124 Johannes Schindelin
                       ` (3 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Windows' file systems, file names with trailing dots are forbidden.
The POSIX emulation layer used by Git for Windows' Subversion emulates
those file names, therefore the test adding the file would actually
succeed, but when we would ask git.exe (which does not leverage the
POSIX emulation layer) to check out the tree, it would fail.

Let's just guard the test using a filename that is illegal on Windows
by the MINGW prereq.

This lets t9118-git-svn-funky-branch-names.sh pass in Git for Windows'
SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9118-git-svn-funky-branch-names.sh | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh
index a221915..ecb1fed 100755
--- a/t/t9118-git-svn-funky-branch-names.sh
+++ b/t/t9118-git-svn-funky-branch-names.sh
@@ -23,8 +23,11 @@ test_expect_success 'setup svnrepo' '
 	              "$svnrepo/pr ject/branches/$scary_uri" &&
 	svn_cmd cp -m "leading dot" "$svnrepo/pr ject/trunk" \
 			"$svnrepo/pr ject/branches/.leading_dot" &&
-	svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
-			"$svnrepo/pr ject/branches/trailing_dot." &&
+	if test_have_prereq !MINGW
+	then
+		svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
+			"$svnrepo/pr ject/branches/trailing_dot."
+	fi &&
 	svn_cmd cp -m "trailing .lock" "$svnrepo/pr ject/trunk" \
 			"$svnrepo/pr ject/branches/trailing_dotlock.lock" &&
 	svn_cmd cp -m "reflog" "$svnrepo/pr ject/trunk" \
@@ -45,7 +48,10 @@ test_expect_success 'test clone with funky branch names' '
 		git rev-parse "refs/remotes/origin/more%20fun%20plugin!" &&
 		git rev-parse "refs/remotes/origin/$scary_ref" &&
 		git rev-parse "refs/remotes/origin/%2Eleading_dot" &&
-		git rev-parse "refs/remotes/origin/trailing_dot%2E" &&
+		if test_have_prereq !MINGW
+		then
+			git rev-parse "refs/remotes/origin/trailing_dot%2E"
+		fi &&
 		git rev-parse "refs/remotes/origin/trailing_dotlock%2Elock" &&
 		git rev-parse "refs/remotes/origin/$non_reflog"
 	)
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 18/20] mingw: handle the missing POSIXPERM prereq in t9124
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (16 preceding siblings ...)
  2016-01-27 16:20     ` [PATCH v3 17/20] mingw: avoid illegal filename in t9118 Johannes Schindelin
@ 2016-01-27 16:20     ` Johannes Schindelin
  2016-01-27 16:20     ` [PATCH v3 19/20] mingw: skip a test in t9130 that cannot pass on Windows Johannes Schindelin
                       ` (2 subsequent siblings)
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Windows, the permission system works completely differently than
expected by some of the tests. So let's make sure that we do not test
POSIX functionality on Windows.

This lets t9124-git-svn-dcommit-auto-props.sh pass in Git for Windows'
SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9124-git-svn-dcommit-auto-props.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh
index aa841e1..9f7231d 100755
--- a/t/t9124-git-svn-dcommit-auto-props.sh
+++ b/t/t9124-git-svn-dcommit-auto-props.sh
@@ -34,8 +34,7 @@ test_expect_success 'enable auto-props config' '
 '
 
 test_expect_success 'add files matching auto-props' '
-	echo "#!$SHELL_PATH" >exec1.sh &&
-	chmod +x exec1.sh &&
+	write_script exec1.sh </dev/null &&
 	echo "hello" >hello.txt &&
 	echo bar >bar &&
 	git add exec1.sh hello.txt bar &&
@@ -48,8 +47,7 @@ test_expect_success 'disable auto-props config' '
 '
 
 test_expect_success 'add files matching disabled auto-props' '
-	echo "#$SHELL_PATH" >exec2.sh &&
-	chmod +x exec2.sh &&
+	write_script exec2.sh </dev/null &&
 	echo "world" >world.txt &&
 	echo zot >zot &&
 	git add exec2.sh world.txt zot &&
@@ -65,7 +63,10 @@ test_expect_success 'check resulting svn repository' '
 	cd svnrepo &&
 
 	# Check properties from first commit.
-	test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*" &&
+	if test_have_prereq POSIXPERM
+	then
+		test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*"
+	fi &&
 	test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \
 	     "xapplication/x-shellscript" &&
 	test "x$(svn_cmd propget svn:mime-type hello.txt)" = "xtext/plain" &&
@@ -73,7 +74,10 @@ test_expect_success 'check resulting svn repository' '
 	test "x$(svn_cmd propget svn:mime-type bar)" = "x" &&
 
 	# Check properties from second commit.
-	test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*" &&
+	if test_have_prereq POSIXPERM
+	then
+		test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*"
+	fi &&
 	test "x$(svn_cmd propget svn:mime-type exec2.sh)" = "x" &&
 	test "x$(svn_cmd propget svn:mime-type world.txt)" = "x" &&
 	test "x$(svn_cmd propget svn:eol-style world.txt)" = "x" &&
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 19/20] mingw: skip a test in t9130 that cannot pass on Windows
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (17 preceding siblings ...)
  2016-01-27 16:20     ` [PATCH v3 18/20] mingw: handle the missing POSIXPERM prereq in t9124 Johannes Schindelin
@ 2016-01-27 16:20     ` Johannes Schindelin
  2016-01-27 16:20     ` [PATCH v3 20/20] mingw: do not bother to test funny file names Johannes Schindelin
  2016-01-28  8:42     ` [PATCH v3 00/20] Let Git's tests pass on Windows Eric Sunshine
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Windows, Git itself has no clue about POSIX paths, but its shell
scripts do. In this instance, we get mixed paths as a result, and when
comparing the path of the author file, we get a mismatch that is
entirely due to the POSIX path vs Windows path clash.

Let's just skip this test so that t9130-git-svn-authors-file.sh passes
in Git for Windows' SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t9130-git-svn-authors-file.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh
index d306b77..4126481 100755
--- a/t/t9130-git-svn-authors-file.sh
+++ b/t/t9130-git-svn-authors-file.sh
@@ -91,7 +91,7 @@ test_expect_success 'fetch continues after authors-file is fixed' '
 	)
 	'
 
-test_expect_success 'fresh clone with svn.authors-file in config' '
+test_expect_success !MINGW 'fresh clone with svn.authors-file in config' '
 	(
 		rm -r "$GIT_DIR" &&
 		test x = x"$(git config svn.authorsfile)" &&
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* [PATCH v3 20/20] mingw: do not bother to test funny file names
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (18 preceding siblings ...)
  2016-01-27 16:20     ` [PATCH v3 19/20] mingw: skip a test in t9130 that cannot pass on Windows Johannes Schindelin
@ 2016-01-27 16:20     ` Johannes Schindelin
  2016-01-28  8:42     ` [PATCH v3 00/20] Let Git's tests pass on Windows Eric Sunshine
  20 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=X-UNKNOWN, Size: 4516 bytes --]

MSYS2 actually allows to create files or directories whose names contain
tabs, newlines or colors, even if plain Win32 API cannot access them.
As we are using an MSYS2 bash to run the tests, such files or
directories are created successfully, but Git itself has no chance to
work with them because it is a regular Windows program, hence limited by
the Win32 API.

With this change, on Windows otherwise failing tests in
t3300-funny-names.sh, t3600-rm.sh, t3703-add-magic-pathspec.sh,
t3902-quoted.sh, t4016-diff-quote.sh, t4135-apply-weird-filenames.sh,
t9200-git-cvsexportcommit.sh, and t9903-bash-prompt.sh are skipped.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t3300-funny-names.sh           | 1 +
 t/t3600-rm.sh                    | 2 +-
 t/t3703-add-magic-pathspec.sh    | 2 +-
 t/t3902-quoted.sh                | 1 +
 t/t4016-diff-quote.sh            | 1 +
 t/t4135-apply-weird-filenames.sh | 3 ++-
 t/t9200-git-cvsexportcommit.sh   | 2 +-
 t/t9903-bash-prompt.sh           | 2 +-
 8 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh
index 9a146f1..04de03c 100755
--- a/t/t3300-funny-names.sh
+++ b/t/t3300-funny-names.sh
@@ -13,6 +13,7 @@ tree, index, and tree objects.
 
 HT='	'
 
+test_have_prereq MINGW ||
 echo 2>/dev/null > "Name with an${HT}HT"
 if ! test -f "Name with an${HT}HT"
 then
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index 2e47a2b..d046d98 100755
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
@@ -14,7 +14,7 @@ test_expect_success \
      git add -- foo bar baz 'space embedded' -q &&
      git commit -m 'add normal files'"
 
-if touch -- 'tab	embedded' 'newline
+if test_have_prereq !MINGW && touch -- 'tab	embedded' 'newline
 embedded' 2>/dev/null
 then
 	test_set_prereq FUNNYNAMES
diff --git a/t/t3703-add-magic-pathspec.sh b/t/t3703-add-magic-pathspec.sh
index 5115de7..3ef525a 100755
--- a/t/t3703-add-magic-pathspec.sh
+++ b/t/t3703-add-magic-pathspec.sh
@@ -38,7 +38,7 @@ cat >expected <<EOF
 add 'sub/foo'
 EOF
 
-if mkdir ":" 2>/dev/null
+if test_have_prereq !MINGW && mkdir ":" 2>/dev/null
 then
 	test_set_prereq COLON_DIR
 fi
diff --git a/t/t3902-quoted.sh b/t/t3902-quoted.sh
index 892f567..f528008 100755
--- a/t/t3902-quoted.sh
+++ b/t/t3902-quoted.sh
@@ -12,6 +12,7 @@ GN='純'
 HT='	'
 DQ='"'
 
+test_have_prereq MINGW ||
 echo foo 2>/dev/null > "Name and an${HT}HT"
 if ! test -f "Name and an${HT}HT"
 then
diff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh
index cd543ec..9c48e5c 100755
--- a/t/t4016-diff-quote.sh
+++ b/t/t4016-diff-quote.sh
@@ -13,6 +13,7 @@ P1='pathname	with HT'
 P2='pathname with SP'
 P3='pathname
 with LF'
+test_have_prereq !MINGW &&
 echo 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" || {
 	skip_all='Your filesystem does not allow tabs in filenames'
 	test_done
diff --git a/t/t4135-apply-weird-filenames.sh b/t/t4135-apply-weird-filenames.sh
index bf5dc57..27cb000 100755
--- a/t/t4135-apply-weird-filenames.sh
+++ b/t/t4135-apply-weird-filenames.sh
@@ -19,7 +19,8 @@ test_expect_success 'setup' '
 
 	test_when_finished "rm -f \"tab	embedded.txt\"" &&
 	test_when_finished "rm -f '\''\"quoteembedded\".txt'\''" &&
-	if touch -- "tab	embedded.txt" '\''"quoteembedded".txt'\''
+	if test_have_prereq !MINGW &&
+		touch -- "tab	embedded.txt" '\''"quoteembedded".txt'\''
 	then
 		test_set_prereq FUNNYNAMES
 	fi
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index 812c9cd..5cfb9cf 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -197,7 +197,7 @@ if p="Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" &&
 then
 
 # This test contains UTF-8 characters
-test_expect_success \
+test_expect_success !MINGW \
      'File with non-ascii file name' \
      'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö &&
       echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt &&
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index af82049..ffbfa0e 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -67,7 +67,7 @@ repo_with_newline='repo
 with
 newline'
 
-if mkdir "$repo_with_newline" 2>/dev/null
+if test_have_prereq !MINGW && mkdir "$repo_with_newline" 2>/dev/null
 then
 	test_set_prereq FUNNYNAMES
 else
-- 
2.7.0.windows.1.7.g55a05c8

^ permalink raw reply related	[flat|nested] 113+ messages in thread

* Re: [PATCH v3 16/20] mingw: mark t9100's test cases with appropriate prereqs
  2016-01-27 16:20     ` [PATCH v3 16/20] mingw: mark t9100's test cases with appropriate prereqs Johannes Schindelin
@ 2016-01-27 16:33       ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-27 16:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Junio,

On Wed, 27 Jan 2016, Johannes Schindelin wrote:

> --8323329-1704809497-1453911609=:2964
> Content-Type: text/plain; charset=X-UNKNOWN

Oh well. I guess I am really too stupid to get this right... Will change
my script to call format-patch with the --add-header='Content-Type:
text/plain; charset=UTF-8' option to prevent more misery in the future.

Sorry,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 12/19] mingw: skip test in t1508 that fails due to path conversion
  2016-01-27  8:50       ` Johannes Schindelin
@ 2016-01-27 20:23         ` Junio C Hamano
  2016-01-28  7:58           ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Junio C Hamano @ 2016-01-27 20:23 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Hi Junio,
>
> On Tue, 26 Jan 2016, Junio C Hamano wrote:
>
>> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
>> 
>> > @@ -35,7 +35,10 @@ test_expect_success 'setup' '
>> >  	git checkout -b upstream-branch &&
>> >  	test_commit upstream-one &&
>> >  	test_commit upstream-two &&
>> > -	git checkout -b @/at-test &&
>> > +	if ! test_have_prereq MINGW
>> > +	then
>> > +		git checkout -b @/at-slash
>> 
>> I presume that this is meant to be "@/at-test", not "@/at-slash".
>
> Oh my. That's what you get for redoing patches from scratch. Sorry about
> that!

Heh.  That is why it makes me feel uneasy, after asking you to fetch
from me and fix it up, to hear that you will send in a new reroll.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 00/19] Let Git's tests pass on Windows
  2016-01-27  8:38     ` Johannes Schindelin
@ 2016-01-27 20:24       ` Junio C Hamano
  0 siblings, 0 replies; 113+ messages in thread
From: Junio C Hamano @ 2016-01-27 20:24 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> I made a couple of other adjustments anyway, so expect a new iteration
> shortly. This time cross-checked on Linux.

Thanks, will take a look.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v2 12/19] mingw: skip test in t1508 that fails due to path conversion
  2016-01-27 20:23         ` Junio C Hamano
@ 2016-01-28  7:58           ` Johannes Schindelin
  0 siblings, 0 replies; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-28  7:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Hi Junio,

On Wed, 27 Jan 2016, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > On Tue, 26 Jan 2016, Junio C Hamano wrote:
> >
> >> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> >> 
> >> > -	git checkout -b @/at-test &&
> >> > +	if ! test_have_prereq MINGW
> >> > +	then
> >> > +		git checkout -b @/at-slash
> >> 
> >> I presume that this is meant to be "@/at-test", not "@/at-slash".
> >
> > Oh my. That's what you get for redoing patches from scratch. Sorry about
> > that!
> 
> Heh.  That is why it makes me feel uneasy, after asking you to fetch
> from me and fix it up, to hear that you will send in a new reroll.

I should have mentioned that I did rebase what your pu carries onto my
changes locally and found that the only differences were the consistency
tweaks (such as not adding the empty line pointed out by Eric, and such as
using !MINGW through-out).

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v3 11/20] tests: turn off git-daemon tests if FIFOs are not available
  2016-01-27 16:19     ` [PATCH v3 11/20] tests: turn off git-daemon tests if FIFOs are not available Johannes Schindelin
@ 2016-01-28  8:21       ` Eric Sunshine
  2016-01-28  8:40         ` Johannes Schindelin
  0 siblings, 1 reply; 113+ messages in thread
From: Eric Sunshine @ 2016-01-28  8:21 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, Git List

On Wed, Jan 27, 2016 at 11:19 AM, Johannes Schindelin
<johannes.schindelin@gmx.de> wrote:
> The Git daemon tests create a FIFO first thing and will hang if said
> FIFO is not available.
>
> This is a problem with Git for Windows, where `mkfifo` is an MSYS2
> program that leverages MSYS2's POSIX emulation layer, but
> `git-daemon.exe` is a MINGW program that has not the first clue about
> that POSIX emulation layer and therefore blinks twice when it sees
> MSYS2's emulated FIFOs and then just stares into space.
>
> This lets t5570-git-daemon.sh and t5811-proto-disable-git.sh pass.
>
> Signed-off-by: Stepan Kasal <kasal@ucw.cz>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh
> @@ -23,6 +23,11 @@ then
> +if ! test_have_prereq PIPE

Maybe:

    if test_have_prereq !PIPE

?

> +then
> +       test_skip_or_die $GIT_TEST_GIT_DAEMON "file system does not support FIFOs"
> +fi
> +
>  LIB_GIT_DAEMON_PORT=${LIB_GIT_DAEMON_PORT-${this_test#t}}
>
>  GIT_DAEMON_PID=
> --
> 2.7.0.windows.1.7.g55a05c8

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v3 11/20] tests: turn off git-daemon tests if FIFOs are not available
  2016-01-28  8:21       ` Eric Sunshine
@ 2016-01-28  8:40         ` Johannes Schindelin
  2016-01-28 21:35           ` Junio C Hamano
  0 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-28  8:40 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Junio C Hamano, Git List

Hi Eric,

On Thu, 28 Jan 2016, Eric Sunshine wrote:

> On Wed, Jan 27, 2016 at 11:19 AM, Johannes Schindelin
> <johannes.schindelin@gmx.de> wrote:
> > The Git daemon tests create a FIFO first thing and will hang if said
> > FIFO is not available.
> >
> > This is a problem with Git for Windows, where `mkfifo` is an MSYS2
> > program that leverages MSYS2's POSIX emulation layer, but
> > `git-daemon.exe` is a MINGW program that has not the first clue about
> > that POSIX emulation layer and therefore blinks twice when it sees
> > MSYS2's emulated FIFOs and then just stares into space.
> >
> > This lets t5570-git-daemon.sh and t5811-proto-disable-git.sh pass.
> >
> > Signed-off-by: Stepan Kasal <kasal@ucw.cz>
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> > diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh
> > @@ -23,6 +23,11 @@ then
> > +if ! test_have_prereq PIPE
> 
> Maybe:
> 
>     if test_have_prereq !PIPE
> 
> ?

Darn. Of course I only looked for '! .*MINGW', but I should have looked
for '! test_have_prereq' in the patches.

Junio, could you kindly fix up locally if this is the only remaining issue
of this patch series?

Thanks,
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v3 00/20] Let Git's tests pass on Windows
  2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
                       ` (19 preceding siblings ...)
  2016-01-27 16:20     ` [PATCH v3 20/20] mingw: do not bother to test funny file names Johannes Schindelin
@ 2016-01-28  8:42     ` Eric Sunshine
  2016-01-28  8:57       ` Johannes Schindelin
  20 siblings, 1 reply; 113+ messages in thread
From: Eric Sunshine @ 2016-01-28  8:42 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, Git List

On Wed, Jan 27, 2016 at 11:19 AM, Johannes Schindelin
<johannes.schindelin@gmx.de> wrote:
> Relative to v2, this fixes stupid typos that made the tests fail on
> Linux, a stupid copy-paste error pointed out by Eric Sunshine,
> unnecessary 'printf ""' calls pointed out by Junio Hamano, and I now
> use `test_have_prereq !MINGW` consistently, as pointed out by both Eric
> and Junio. This time, I also send the patch series with the character
> set set (sic!) to UTF-8. Oh, and this time, I also made sure that the
> regression tests pass on Windows & Linux alike.

For what it's worth, I ran the test suite on Mac OS X and FreeBSD, as
well, with this series applied and didn't run across any problems. I
also read through v3 and, other than the micro nit in patch 11/20,
didn't find anything upon which to comment.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v3 00/20] Let Git's tests pass on Windows
  2016-01-28  8:42     ` [PATCH v3 00/20] Let Git's tests pass on Windows Eric Sunshine
@ 2016-01-28  8:57       ` Johannes Schindelin
  2016-01-28 21:37         ` Junio C Hamano
  0 siblings, 1 reply; 113+ messages in thread
From: Johannes Schindelin @ 2016-01-28  8:57 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Junio C Hamano, Git List

Hi Eric,

On Thu, 28 Jan 2016, Eric Sunshine wrote:

> On Wed, Jan 27, 2016 at 11:19 AM, Johannes Schindelin
> <johannes.schindelin@gmx.de> wrote:
> > Relative to v2, this fixes stupid typos that made the tests fail on
> > Linux, a stupid copy-paste error pointed out by Eric Sunshine,
> > unnecessary 'printf ""' calls pointed out by Junio Hamano, and I now
> > use `test_have_prereq !MINGW` consistently, as pointed out by both Eric
> > and Junio. This time, I also send the patch series with the character
> > set set (sic!) to UTF-8. Oh, and this time, I also made sure that the
> > regression tests pass on Windows & Linux alike.
> 
> For what it's worth, I ran the test suite on Mac OS X and FreeBSD, as
> well, with this series applied and didn't run across any problems. I
> also read through v3 and, other than the micro nit in patch 11/20,
> didn't find anything upon which to comment.

Thank you so much! I really appreciate your feedback, and I have a lot of
respect for reviewers that go through a 19 or 20 strong patch series.

Thanks!
Dscho

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v3 11/20] tests: turn off git-daemon tests if FIFOs are not available
  2016-01-28  8:40         ` Johannes Schindelin
@ 2016-01-28 21:35           ` Junio C Hamano
  0 siblings, 0 replies; 113+ messages in thread
From: Junio C Hamano @ 2016-01-28 21:35 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Eric Sunshine, Git List

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> > diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh
>> > @@ -23,6 +23,11 @@ then
>> > +if ! test_have_prereq PIPE
>> 
>> Maybe:
>> 
>>     if test_have_prereq !PIPE
>> 
>> ?
>
> Darn. Of course I only looked for '! .*MINGW', but I should have looked
> for '! test_have_prereq' in the patches.

Wow.  Talk about fine-toothed comb ;-)

Will squash in.  Thanks for a set of sharp eyes.

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: [PATCH v3 00/20] Let Git's tests pass on Windows
  2016-01-28  8:57       ` Johannes Schindelin
@ 2016-01-28 21:37         ` Junio C Hamano
  0 siblings, 0 replies; 113+ messages in thread
From: Junio C Hamano @ 2016-01-28 21:37 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Eric Sunshine, Git List

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> For what it's worth, I ran the test suite on Mac OS X and FreeBSD, as
>> well, with this series applied and didn't run across any problems. I
>> also read through v3 and, other than the micro nit in patch 11/20,
>> didn't find anything upon which to comment.
>
> Thank you so much! I really appreciate your feedback, and I have a lot of
> respect for reviewers that go through a 19 or 20 strong patch series.

Yeah, especially with multiple rerolls.

Thanks, both.  Will requeue.

^ permalink raw reply	[flat|nested] 113+ messages in thread

end of thread, other threads:[~2016-01-28 21:37 UTC | newest]

Thread overview: 113+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-24 15:43 [PATCH 00/19] Let Git's tests pass on Windows Johannes Schindelin
2016-01-24 15:43 ` [PATCH 01/19] mingw: let's use gettext with MSYS2 Johannes Schindelin
2016-01-25  1:42   ` Junio C Hamano
2016-01-25 16:16     ` Johannes Schindelin
2016-01-25 18:53       ` Junio C Hamano
2016-01-24 15:43 ` [PATCH 02/19] mingw: do not trust MSYS2's MinGW gettext.sh Johannes Schindelin
2016-01-24 15:43 ` [PATCH 03/19] Git.pm: stop assuming that absolute paths start with a slash Johannes Schindelin
2016-01-24 15:43 ` [PATCH 04/19] mingw: factor out Windows specific environment setup Johannes Schindelin
2016-01-24 15:43 ` [PATCH 05/19] mingw: prepare the TMPDIR environment variable for shell scripts Johannes Schindelin
2016-01-25  2:11   ` Eric Sunshine
2016-01-26  8:38     ` Johannes Schindelin
2016-01-24 15:44 ` [PATCH 06/19] mingw: try to delete target directory before renaming Johannes Schindelin
2016-01-24 17:42   ` Philip Oakley
2016-01-25  6:59     ` Johannes Schindelin
2016-01-25 18:55       ` Junio C Hamano
2016-01-26  8:14         ` Johannes Schindelin
2016-01-24 15:44 ` [PATCH 07/19] mingw: let lstat() fail with errno == ENOTDIR when appropriate Johannes Schindelin
2016-01-24 15:44 ` [PATCH 08/19] mingw: fix t5601-clone.sh Johannes Schindelin
2016-01-24 15:44 ` [PATCH 09/19] mingw: accomodate t0060-path-utils for MSYS2 Johannes Schindelin
2016-01-24 19:51   ` Johannes Sixt
2016-01-25 15:39     ` Johannes Schindelin
2016-01-24 15:44 ` [PATCH 10/19] mingw: disable mkfifo-based tests Johannes Schindelin
2016-01-24 15:44 ` [PATCH 11/19] tests: turn off git-daemon tests if FIFOs are not available Johannes Schindelin
2016-01-24 15:45 ` [PATCH 12/19] mingw: do not use symlinks with SVN in t9100 Johannes Schindelin
2016-01-25  1:51   ` Junio C Hamano
2016-01-25 16:53     ` Johannes Schindelin
2016-01-24 15:45 ` [PATCH 13/19] mingw: outsmart MSYS2's path substitution in t1508 Johannes Schindelin
2016-01-25  2:03   ` Junio C Hamano
2016-01-25  6:22     ` Eric Sunshine
2016-01-25 18:50       ` Junio C Hamano
2016-01-26  6:53         ` Johannes Schindelin
2016-01-25 16:30     ` Johannes Schindelin
2016-01-25 17:04       ` Johannes Schindelin
2016-01-24 15:45 ` [PATCH 14/19] mingw: fix t9700's assumption about directory separators Johannes Schindelin
2016-01-24 15:45 ` [PATCH 15/19] mingw: work around pwd issues in the tests Johannes Schindelin
2016-01-24 15:45 ` [PATCH 16/19] mingw: avoid absolute path in t0008 Johannes Schindelin
2016-01-25  2:11   ` Junio C Hamano
2016-01-25 16:48     ` Johannes Schindelin
2016-01-25 19:31       ` Ray Donnelly
2016-01-25 22:20       ` Junio C Hamano
2016-01-26  8:00         ` Johannes Schindelin
2016-01-24 15:45 ` [PATCH 17/19] mingw: fix git-svn tests that expect chmod to work Johannes Schindelin
2016-01-25  2:14   ` Junio C Hamano
2016-01-26  6:31     ` Johannes Schindelin
2016-01-26 17:42       ` Junio C Hamano
2016-01-24 15:45 ` [PATCH 18/19] mingw: skip a couple of git-svn tests that cannot pass on Windows Johannes Schindelin
2016-01-25  2:16   ` Junio C Hamano
2016-01-26  6:45     ` Johannes Schindelin
2016-01-24 15:45 ` [PATCH 19/19] mingw: do not bother to test funny file names Johannes Schindelin
2016-01-25  1:34 ` [PATCH 00/19] Let Git's tests pass on Windows Junio C Hamano
2016-01-25 15:45   ` Johannes Schindelin
2016-01-26 14:34 ` [PATCH v2 " Johannes Schindelin
2016-01-26 14:34   ` [PATCH v2 01/19] mingw: let's use gettext with MSYS2 Johannes Schindelin
2016-01-26 14:34   ` [PATCH v2 02/19] mingw: do not trust MSYS2's MinGW gettext.sh Johannes Schindelin
2016-01-26 14:34   ` [PATCH v2 03/19] Git.pm: stop assuming that absolute paths start with a slash Johannes Schindelin
2016-01-26 14:34   ` [PATCH v2 04/19] mingw: factor out Windows specific environment setup Johannes Schindelin
2016-01-26 14:34   ` [PATCH v2 05/19] mingw: prepare the TMPDIR environment variable for shell scripts Johannes Schindelin
2016-01-26 14:34   ` [PATCH v2 06/19] mingw: try to delete target directory before renaming Johannes Schindelin
2016-01-26 14:34   ` [PATCH v2 07/19] mingw: let lstat() fail with errno == ENOTDIR when appropriate Johannes Schindelin
2016-01-26 14:34   ` [PATCH v2 08/19] mingw: fix t5601-clone.sh Johannes Schindelin
2016-01-26 14:35   ` [PATCH v2 09/19] mingw: accomodate t0060-path-utils for MSYS2 Johannes Schindelin
2016-01-26 14:35   ` [PATCH v2 10/19] mingw: disable mkfifo-based tests Johannes Schindelin
2016-01-26 14:35   ` [PATCH v2 11/19] tests: turn off git-daemon tests if FIFOs are not available Johannes Schindelin
2016-01-26 14:35   ` [PATCH v2 12/19] mingw: skip test in t1508 that fails due to path conversion Johannes Schindelin
2016-01-26 22:02     ` Junio C Hamano
2016-01-27  8:50       ` Johannes Schindelin
2016-01-27 20:23         ` Junio C Hamano
2016-01-28  7:58           ` Johannes Schindelin
2016-01-26 14:35   ` [PATCH v2 13/19] mingw: fix t9700's assumption about directory separators Johannes Schindelin
2016-01-26 14:35   ` [PATCH v2 14/19] mingw: work around pwd issues in the tests Johannes Schindelin
2016-01-26 14:35   ` [PATCH v2 15/19] Avoid absolute path in t0008 Johannes Schindelin
2016-01-26 14:35   ` [PATCH v2 16/19] mingw: mark t9100's test cases with appropriate prereqs Johannes Schindelin
2016-01-26 21:50     ` Junio C Hamano
2016-01-27 16:02       ` Johannes Schindelin
2016-01-26 14:35   ` [PATCH v2 17/19] mingw: avoid illegal filename in t9118 Johannes Schindelin
2016-01-26 14:35   ` [PATCH v2 18/19] mingw: handle the missing POSIXPERM prereq in t9124 Johannes Schindelin
2016-01-26 22:05     ` Junio C Hamano
2016-01-27  9:20       ` Johannes Schindelin
2016-01-26 14:35   ` [PATCH v2 19/19] mingw: do not bother to test funny file names Johannes Schindelin
2016-01-26 20:03     ` Eric Sunshine
2016-01-26 20:24       ` Junio C Hamano
2016-01-27  8:33       ` Johannes Schindelin
2016-01-26 22:12   ` [PATCH v2 00/19] Let Git's tests pass on Windows Junio C Hamano
2016-01-27  8:38     ` Johannes Schindelin
2016-01-27 20:24       ` Junio C Hamano
2016-01-27 16:19   ` [PATCH v3 00/20] " Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 01/20] mingw: let's use gettext with MSYS2 Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 02/20] mingw: do not trust MSYS2's MinGW gettext.sh Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 03/20] Git.pm: stop assuming that absolute paths start with a slash Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 04/20] mingw: factor out Windows specific environment setup Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 05/20] mingw: prepare the TMPDIR environment variable for shell scripts Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 06/20] mingw: try to delete target directory before renaming Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 07/20] mingw: let lstat() fail with errno == ENOTDIR when appropriate Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 08/20] mingw: fix t5601-clone.sh Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 09/20] mingw: accomodate t0060-path-utils for MSYS2 Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 10/20] mingw: disable mkfifo-based tests Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 11/20] tests: turn off git-daemon tests if FIFOs are not available Johannes Schindelin
2016-01-28  8:21       ` Eric Sunshine
2016-01-28  8:40         ` Johannes Schindelin
2016-01-28 21:35           ` Junio C Hamano
2016-01-27 16:19     ` [PATCH v3 12/20] mingw: skip test in t1508 that fails due to path conversion Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 13/20] mingw: fix t9700's assumption about directory separators Johannes Schindelin
2016-01-27 16:19     ` [PATCH v3 14/20] mingw: work around pwd issues in the tests Johannes Schindelin
2016-01-27 16:20     ` [PATCH v3 15/20] Avoid absolute path in t0008 Johannes Schindelin
2016-01-27 16:20     ` [PATCH v3 16/20] mingw: mark t9100's test cases with appropriate prereqs Johannes Schindelin
2016-01-27 16:33       ` Johannes Schindelin
2016-01-27 16:20     ` [PATCH v3 17/20] mingw: avoid illegal filename in t9118 Johannes Schindelin
2016-01-27 16:20     ` [PATCH v3 18/20] mingw: handle the missing POSIXPERM prereq in t9124 Johannes Schindelin
2016-01-27 16:20     ` [PATCH v3 19/20] mingw: skip a test in t9130 that cannot pass on Windows Johannes Schindelin
2016-01-27 16:20     ` [PATCH v3 20/20] mingw: do not bother to test funny file names Johannes Schindelin
2016-01-28  8:42     ` [PATCH v3 00/20] Let Git's tests pass on Windows Eric Sunshine
2016-01-28  8:57       ` Johannes Schindelin
2016-01-28 21:37         ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.