Test scripts have been updated to remove assumptions that are not
portable between Git for POSIX and Git for Windows, or to skip ones
with expectations that are not satisfiable on Git for Windows.

* js/mingw-tests: (21 commits)
  gitignore: ignore generated test-fake-ssh executable
  mingw: do not bother to test funny file names
  mingw: skip a test in t9130 that cannot pass on Windows
  mingw: handle the missing POSIXPERM prereq in t9124
  mingw: avoid illegal filename in t9118
  mingw: mark t9100's test cases with appropriate prereqs
  t0008: avoid absolute path
  mingw: work around pwd issues in the tests
  mingw: fix t9700's assumption about directory separators
  mingw: skip test in t1508 that fails due to path conversion
  tests: turn off git-daemon tests if FIFOs are not available
  mingw: disable mkfifo-based tests
  mingw: accomodate t0060-path-utils for MSYS2
  mingw: fix t5601-clone.sh
  mingw: let lstat() fail with errno == ENOTDIR when appropriate
  mingw: try to delete target directory before renaming
  mingw: prepare the TMPDIR environment variable for shell scripts
  mingw: factor out Windows specific environment setup
  Git.pm: stop assuming that absolute paths start with a slash
  mingw: do not trust MSYS2's MinGW gettext.sh
  ...
This commit is contained in:
Junio C Hamano 2016-02-17 10:13:28 -08:00
Родитель 9f03176ef6 80ce6c25a4
Коммит 4b589e5b28
29 изменённых файлов: 197 добавлений и 70 удалений

1
.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

Просмотреть файл

@ -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

Просмотреть файл

@ -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) {
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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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.

Просмотреть файл

@ -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=

Просмотреть файл

@ -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 () {

Просмотреть файл

@ -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" \

Просмотреть файл

@ -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}"

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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
}

Просмотреть файл

@ -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 &&

Просмотреть файл

@ -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 \

Просмотреть файл

@ -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" &&
if test_have_prereq !MINGW
then
svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
"$svnrepo/pr ject/branches/trailing_dot." &&
"$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"
)

Просмотреть файл

@ -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" &&

Просмотреть файл

@ -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)" &&

Просмотреть файл

@ -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 &&

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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");

Просмотреть файл

@ -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

Просмотреть файл

@ -1000,7 +1000,7 @@ test_i18ngrep () {
test_lazy_prereq PIPE '
# test whether the filesystem supports FIFOs
case $(uname -s) in
CYGWIN*)
CYGWIN*|MINGW*)
false
;;
*)

30
test-fake-ssh.c Normal file
Просмотреть файл

@ -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);
}