aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile1
-rw-r--r--compat/mingw.c91
-rw-r--r--config.mak.uname3
-rw-r--r--perl/Git.pm3
-rw-r--r--t/lib-git-daemon.sh5
-rwxr-xr-xt/t0008-ignores.sh2
-rwxr-xr-xt/t0060-path-utils.sh9
-rwxr-xr-xt/t1508-at-combinations.sh6
-rwxr-xr-xt/t3300-funny-names.sh1
-rwxr-xr-xt/t3600-rm.sh2
-rwxr-xr-xt/t3703-add-magic-pathspec.sh2
-rwxr-xr-xt/t3902-quoted.sh1
-rwxr-xr-xt/t4016-diff-quote.sh1
-rwxr-xr-xt/t4135-apply-weird-filenames.sh3
-rwxr-xr-xt/t5601-clone.sh18
-rwxr-xr-xt/t7800-difftool.sh14
-rwxr-xr-xt/t9100-git-svn-basic.sh18
-rwxr-xr-xt/t9118-git-svn-funky-branch-names.sh12
-rwxr-xr-xt/t9124-git-svn-dcommit-auto-props.sh16
-rwxr-xr-xt/t9130-git-svn-authors-file.sh2
-rwxr-xr-xt/t9200-git-cvsexportcommit.sh2
-rwxr-xr-xt/t9400-git-cvsserver-server.sh6
-rwxr-xr-xt/t9401-git-cvsserver-crlf.sh6
-rwxr-xr-xt/t9402-git-cvsserver-refs.sh6
-rwxr-xr-xt/t9700/test.pl2
-rwxr-xr-xt/t9903-bash-prompt.sh2
-rw-r--r--t/test-lib.sh2
-rw-r--r--test-fake-ssh.c30
29 files changed, 197 insertions, 70 deletions
diff --git a/.gitignore b/.gitignore
index 1c2f83213..5087ce1eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -187,6 +187,7 @@
/test-dump-cache-tree
/test-dump-split-index
/test-dump-untracked-cache
+/test-fake-ssh
/test-scrap-cache-tree
/test-genrandom
/test-hashmap
diff --git a/Makefile b/Makefile
index fc2f1ab2c..10566d648 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/compat/mingw.c b/compat/mingw.c
index 77a51d3f7..fbe69b874 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;
@@ -1603,7 +1642,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) &&
@@ -2047,6 +2091,37 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
return -1;
}
+static void setup_windows_environment()
+{
+ char *tmp = getenv("TMPDIR");
+
+ /* on Windows it is TMP and TEMP */
+ if (!tmp) {
+ if (!(tmp = getenv("TMP")))
+ tmp = getenv("TEMP");
+ 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) */
+ 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 +2200,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);
diff --git a/config.mak.uname b/config.mak.uname
index 4b2e1b807..d6f7980bb 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -560,7 +560,8 @@ else
NO_R_TO_GCC_LINKER = YesPlease
INTERNAL_QSORT = YesPlease
HAVE_LIBCHARSET_H = YesPlease
- NO_GETTEXT = YesPlease
+ NO_GETTEXT =
+ USE_GETTEXT_SCHEME = fallthrough
USE_LIBPCRE= YesPlease
NO_CURL =
USE_NED_ALLOCATOR = YesPlease
diff --git a/perl/Git.pm b/perl/Git.pm
index 19ef08110..49eb88af8 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.
diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh
index bc4b3412f..340534c06 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=
diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
index 4ef5ed484..89544dd83 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 () {
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index f0152a7ab..8532a028e 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" \
diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
index 078e1195d..4a9964e9d 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}"
diff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh
index 9a146f133..04de03cad 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 2e47a2bfd..d046d98ae 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 5115de703..3ef525a55 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 892f56784..f528008c3 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 cd543ecc5..9c48e5c2c 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 bf5dc5728..27cb0009f 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/t5601-clone.sh b/t/t5601-clone.sh
index 669ec9ba8..c1efb8e44 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/t/t7800-difftool.sh b/t/t7800-difftool.sh
index ec8bc8c76..4e713f7aa 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/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh
index 258d9b8ce..56acc1e70 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 \
diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh
index a2219154b..ecb1fed14 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"
)
diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh
index aa841e129..9f7231d5b 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" &&
diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh
index d306b77c3..41264818c 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/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index 812c9cd46..5cfb9cfc5 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/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index 6146c3fec..d708cbf03 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 5a4ed28e4..f324b9f01 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 d00df0873..6d2d3c873 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
diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index 1140767b5..7e8c40b97 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");
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index af82049f8..ffbfa0efb 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
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 51e4a88c3..0b47eb6bb 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1000,7 +1000,7 @@ test_i18ngrep () {
test_lazy_prereq PIPE '
# test whether the filesystem supports FIFOs
case $(uname -s) in
- CYGWIN*)
+ CYGWIN*|MINGW*)
false
;;
*)
diff --git a/test-fake-ssh.c b/test-fake-ssh.c
new file mode 100644
index 000000000..980de216e
--- /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);
+}