Commit Graph

89107 Commits

Author SHA1 Message Date
Johannes Schindelin
fb6ce5464d status: verify that --show-ignored-directory prints a warning
The option is deprecated now, and we better make sure that keeps saying
so until we finally remove it.

Suggested by Kevin Willford.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:16 +02:00
Johannes Schindelin
cd071015e1 status: reinstate --show-ignored-directory as a deprecated option
It was a bad idea to just remove that option from Git for Windows
v2.15.0, as early users of that (still experimental) option would have
been puzzled what they are supposed to do now.

So let's reintroduce the flag, but make sure to show the user good
advice how to fix this going forward.

We'll remove this option in a more orderly fashion either in v2.16.0 or
in v2.17.0.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:16 +02:00
Johannes Schindelin
4cd0e72b4c Merge pull request #1344 from jeffhostetler/perf_add_excludes_with_fscache
dir.c: make add_excludes aware of fscache during status
2018-10-04 21:34:16 +02:00
Johannes Schindelin
bb5fa90ae6 msvc: fix make MSVC=1 install
We used to install into $HOME/bin/, which wreaks havoc with installed
versions of Git for Windows (because $HOME/bin is *prepended* to the
PATH, hence would override `git.exe` in Git Bash).

Let's align the MSVC case with the non-MSVC case and install into
/mingw64/bin/ (or /mingw32/bin/ in 32-bit Git for Windows SDKs) instead.

Noticed by Derrick Stolee.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:16 +02:00
Jeff Hostetler
1a1f0da906 dir.c: make add_excludes aware of fscache during status
Teach read_directory_recursive() and add_excludes() to
be aware of optional fscache and avoid trying to open()
and fstat() non-existant ".gitignore" files in every
directory in the worktree.

The current code in add_excludes() calls open() and then
fstat() for a ".gitignore" file in each directory present
in the worktree.  Change that when fscache is enabled to
call lstat() first and if present, call open().

This seems backwards because both lstat needs to do more
work than fstat.  But when fscache is enabled, fscache will
already know if the .gitignore file exists and can completely
avoid the IO calls.  This works because of the lstat diversion
to mingw_lstat when fscache is enabled.

This reduced status times on a 350K file enlistment of the
Windows repo on a NVMe SSD by 0.25 seconds.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2018-10-04 21:34:16 +02:00
Johannes Schindelin
c762ea1ee9 Merge pull request #1334 from max630/mingw-direct-CreateHardLinkW
mingw: use CreateHardLink directly
2018-10-04 21:34:15 +02:00
Johannes Schindelin
5ba305c16d Fix .git/ discovery at the root of UNC shares
A very common assumption in Git's source code base is that
offset_1st_component() returns either 0 for relative paths, or 1 for
absolute paths that start with a slash. In other words, the return value
is either 0 or points just after the dir separator.

This assumption is not fulfilled when calling offset_1st_component()
e.g. on UNC paths on Windows, e.g. "//my-server/my-share". In this case,
offset_1st_component() returns the length of the entire string (which is
correct, because stripping the last "component" would not result in a
valid directory), yet the return value still does not point just after a
dir separator.

This assumption is most prominently seen in the
setup_git_directory_gently_1() function, where we want to append a
".git" component and simply assume that there is already a dir
separator. In the UNC example given above, this assumption is incorrect.

As a consequence, Git will fail to handle a worktree at the top of a UNC
share correctly.

Let's fix this by adding a dir separator specifically for that case: we
found that there is no first component in the path and it does not end
in a dir separator? Then add it.

This fixes https://github.com/git-for-windows/git/issues/1320

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:15 +02:00
Max Kirillov
e2c47cf286 mingw: use CreateHardLink directly
It was observed that the current implementation of of get_proc_addr()
fails to load the kernel32.dll with code ERROR_INVALID_PARAMETER.
Probably the reason is that kernel32.dll is already loaded. The
behavior was seen at Windows SP1, both 32bit and 64bit. Probably it
would behave same way in some or all other Windows versions.

This breaks all usages of "clone --local", including the automatic
tests where they call it.

The function CreateHardLink is available in all supported Windows
versions (since Windows XP), so there is no more need to resolve it
in runtime.

Signed-off-by: Max Kirillov <max@max630.net>
2018-10-04 21:34:15 +02:00
Johannes Schindelin
a81c47e3cc diff: munmap() file contents before running external diff
When running an external diff from, say, a diff tool, it is safe to
assume that we want to write the files in question. On Windows, that
means that there cannot be any other process holding an open handle to
said files.

So let's make sure that `git diff` itself is not holding any open handle
to the files in question.

This fixes https://github.com/git-for-windows/git/issues/1315

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:15 +02:00
Johannes Schindelin
62c89e8497 mingw: avoid infinite loop in rename()
We have this loop where we try to remove the read-only attribute when
rename() fails and try again. If it fails again, let's not try to remove
the read-only attribute and try *again*.

This fixes https://github.com/git-for-windows/git/issues/1299

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:15 +02:00
Johannes Schindelin
428fbee96a Merge branch 'git-gui-askyesno'
These changes are necessary to support better Git for Windows' new
auto-update feature.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:15 +02:00
Johannes Schindelin
ae52e86b84 Merge pull request #1302 from jeffhostetler/vs2017_vcxproj
VS2017 vcxproj
2018-10-04 21:34:14 +02:00
Johannes Schindelin
3fab17b0d8 git-gui--askyesno (mingw): use Git for Windows' icon, if available
For additional GUI goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:14 +02:00
Johannes Schindelin
66cb4fe386 Merge pull request #1273 from jeffhostetler/jeffhostetler/vs2017
MSVC Build: Support VS2017 or VS2015 compiler tools
2018-10-04 21:34:14 +02:00
Jeff Hostetler
b4bda8d397 vcxproj.pm: fix AdditionalDependencies
Add .LIBs for zlib and openssl to <AdditionalDependencies>
to help linker when building with VS2017.

This closes https://github.com/git-for-windows/git/issues/1234

Note: this patch still leaves a couple of TODOs:

- It should be possible to add GEN.DEPS\lib to
  <AdditionalLibraryDependencies> and then just set
  <AdditionalDependencies> to the library basenames.

- Likewise, you should be able to copy GEN.DEPS\bin\*.dll
  to the destination directory rather than using the full
  paths in the $afterTargets lines.

(This is in line with items in <AdditionalIncludeDirectories>
referencing GEN.DEPS\include.)

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:14 +02:00
Johannes Schindelin
785357e2d9 git-gui--askyesno: allow overriding the window title
"Question?" is maybe not the most informative thing to ask. In the
absence of better information, it is the best we can do, of course.

However, Git for Windows' auto updater just learned the trick to use
git-gui--askyesno to ask the user whether to update now or not. And in
this scripted scenario, we can easily pass a command-line option to
change the window title.

So let's support that with the new `--title <title>` option.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:14 +02:00
Jeff Hostetler
3b1f3bc101 packages.config: remove v120 and x86 versions
Toolset v120 corresponds to Visual Studio 2013. We already used
dependencies that were hardcoded to v140 (i.e. Visual Studio 2015), so
let's just remove the cruft.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:14 +02:00
Johannes Schindelin
dea2e3d4b9 git-gui--askyesno: fix funny text wrapping
The text wrapping seems to be aligned to the right side of the Yes
button, leaving an awful lot of empty space.

Let's try to counter this by using pixel units.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:14 +02:00
Johannes Schindelin
99dd2a643c Merge branch 'file-url-to-unc-path'
This topic branch teaches Git to accept UNC paths of the form
file://host/share/repository.git.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:13 +02:00
Jeff Hostetler
9571ddb22b MSVC Build: Support VS2017 command line compiler tools
Teach the top-level git Makefile to use whatever VS compiler
tool chain is installed on the system.

When building git from the command line in a git-sdk BASH
window with MAKE, the shell environment has environment
variables for GCC tools, but not MSVC tools.  MSVC bindings
are only avaliable from the various "VcVarsAll.bat" scripts
run by the "Developer Command Prompt" shortcuts.

Add compat/vcbuild/find_vs_env.bat to the Makefile.  It
uses the various "VcVarsAll.bat" scripts in a background
Developer Command Prompt process to compute the proper
environment variables and publish them for use by the Makefile.

[jes: fixed typos, used %SystemRoot% instead of C:\WINDOWS]

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:13 +02:00
Johannes Schindelin
2d32f769cc Merge pull request #1214 from rongjiecomputer/master
Implement pthread_cond_t with Win32 CONDITION_VARIABLE
2018-10-04 21:34:13 +02:00
Torsten Bögershausen
94264653f9 mingw: support UNC in git clone file://server/share/repo
Extend the parser to accept file://server/share/repo in the way that
Windows users expect it to be parsed who are used to referring to file
shares by UNC paths of the form \\server\share\folder.

[jes: tightened check to avoid handling file://C:/some/path as a UNC
path.]

This closes https://github.com/git-for-windows/git/issues/1264.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:13 +02:00
Johannes Schindelin
356451b7eb Merge branch 'busybox-w32'
This topic branch brings slightly experimental changes supporting Git
for Windows to use BusyBox-w32 to execute its shell scripts as well as
its test suite.

The test suite can be run by installing the test artifacts into a MinGit
that has busybox.exe (and using Git for Windows' SDK's Perl for now, as
the test suite requires Perl even when NO_PERL is set, go figure) by
using the `install-mingit-test-artifacts` Makefile target with the
DESTDIR variable pointing to the top-level directory of the MinGit
installation.

To facilitate running the test suite (without having `make` available,
as `make.exe` is not part of MinGit), this branch brings an experimental
patch to the `test-run-command` helper to run Git's test suite. It is
still very experimental, though: in this developer's tests it seemed
that the `poll()` emulation required for `run_parallel_processes()` to
work sometimes hiccups on Windows, causing infinite "hangs". It is also
possible that BusyBox itself has problems writing to the pipes opened by
`test-run-command` (and merging this branch will help investigate
further). Caveat emptor.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:13 +02:00
Johannes Schindelin
6876a0a46d mingw: add a Makefile target to copy test artifacts
The Makefile target `install-mingit-test-artifacts` simply copies stuff
and things directly into a MinGit directory, including an init.bat
script to set everything up so that the tests can be run in a cmd
window.

Sadly, Git's test suite still relies on a Perl interpreter even if
compiled with NO_PERL=YesPlease. We punt for now, installing a small
script into /usr/bin/perl that hands off to an existing Perl of a Git
for Windows SDK.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:11 +02:00
Johannes Schindelin
6b9b1aa163 t9350: skip ISO-8859-1 test when the environment is always-UTF-8
In the BusyBox-w32 version that is currently under consideration for
MinGit for Windows (to reduce the .zip size, and to avoid problems with
the MSYS2 runtime), the UTF-16 environment present in Windows is
considered to be authoritative, and the 8-bit version is always in UTF-8
encoding.

As a consequence, the ISO-8859-1 test in t9350-fast-export (which tries
to set GIT_AUTHOR_NAME to a ISO-8859-1 encoded value) *must* fail in
that setup.

So let's detect when it would fail (due to an environment being purely
kept UTF-8 encoded), and skip that test in that case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:11 +02:00
Johannes Schindelin
3b400e307c t9200: skip tests when $PWD contains a colon
On Windows, the current working directory is pretty much guaranteed to
contain a colon. If we feed that path to CVS, it mistakes it for a
separator between host and port, though.

This has not been a problem so far because Git for Windows uses MSYS2's
Bash using a POSIX emulation layer that also pretends that the current
directory is a Unix path (at least as long as we're in a shell script).

However, that is rather limiting, as Git for Windows also explores other
ports of other Unix shells. One of those is BusyBox-w32's ash, which is
a native port (i.e. *not* using any POSIX emulation layer, and certainly
not emulating Unix paths).

So let's just detect if there is a colon in $PWD and punt in that case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:10 +02:00
Johannes Schindelin
4f25a7ee5c t7063: when running under BusyBox, avoid unsupported find option
BusyBox' find implementation does not understand the -ls option, so
let's not use it when we're running inside BusyBox.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:10 +02:00
Johannes Schindelin
f89570c23e t5813: allow for $PWD to be a Windows path
Git for Windows uses MSYS2's Bash to run the test suite, which comes
with benefits but also at a heavy price: on the plus side, MSYS2's
POSIX emulation layer allows us to continue pretending that we are on a
Unix system, e.g. use Unix paths instead of Windows ones, yet this is
bought at a rather noticeable performance penalty.

There *are* some more native ports of Unix shells out there, though,
most notably BusyBox-w32's ash. These native ports do not use any POSIX
emulation layer (or at most a *very* thin one, choosing to avoid
features such as fork() that are expensive to emulate on Windows), and
they use native Windows paths (usually with forward slashes instead of
backslashes, which is perfectly legal in almost all use cases).

And here comes the problem: with a $PWD looking like, say,
C:/git-sdk-64/usr/src/git/t/trash directory.t5813-proto-disable-ssh
Git's test scripts get quite a bit confused, as their assumptions have
been shattered. Not only does this path contain a colon (oh no!), it
also does not start with a slash.

This is a problem e.g. when constructing a URL as t5813 does it:
ssh://remote$PWD. Not only is it impossible to separate the "host" from
the path with a $PWD as above, even prefixing $PWD by a slash won't
work, as /C:/git-sdk-64/... is not a valid path.

As a workaround, detect when $PWD does not start with a slash on
Windows, and simply strip the drive prefix, using an obscure feature of
Windows paths: if an absolute Windows path starts with a slash, it is
implicitly prefixed by the drive prefix of the current directory. As we
are talking about the current directory here, anyway, that strategy
works.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:10 +02:00
Johannes Schindelin
0e1756e4e6 t5605: special-case hardlink test for BusyBox-w32
When t5605 tries to verify that files are hardlinked (or that they are
not), it uses the `-links` option of the `find` utility.

BusyBox' implementation does not support that option, and BusyBox-w32's
lstat() does not even report the number of hard links correctly (for
performance reasons).

So let's just switch to a different method that actually works on
Windows.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:10 +02:00
Johannes Schindelin
8edaf5ee50 t5532: workaround for BusyBox on Windows
While it may seem super convenient to some old Unix hands to simpy
require Perl to be available when running the test suite, this is a
major hassle on Windows, where we want to verify that Perl is not,
actually, required in a NO_PERL build.

As a super ugly workaround, we "install" a script into /usr/bin/perl
reading like this:

	#!/bin/sh

	# We'd much rather avoid requiring Perl altogether when testing
	# an installed Git. Oh well, that's why we cannot have nice
	# things.
	exec c:/git-sdk-64/usr/bin/perl.exe "$@"

The problem with that is that BusyBox assumes that the #! line in a
script refers to an executable, not to a script. So when it encounters
the line #!/usr/bin/perl in t5532's proxy-get-cmd, it barfs.

Let's help this situation by simply executing the Perl script with the
"interpreter" specified explicitly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:10 +02:00
Johannes Schindelin
461d0b8054 t5003: skip unzip -a tests with BusyBox
BusyBox' unzip is working pretty well. But Git's tests want to abuse it
to not only extract files, but to convert their line endings on the fly,
too. BusyBox' unzip does not support that, and it would appear that
it would require rather intrusive changes.

So let's just work around this by skipping the test case that uses
`unzip -a` and the subsequent test cases expecting `unzip -a`'s output.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:10 +02:00
Johannes Schindelin
e474acb5a9 t5003: use binary file from t/diff-lib/
At some stage, t5003-archive-zip wants to add a file that is not ASCII.
To that end, it uses /bin/sh. But that file may actually not exist (it
is too easy to forget that not all the world is Unix/Linux...)! Besides,
we already have perfectly fine binary files intended for use solely by
the tests. So let's use one of them instead.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:10 +02:00
Johannes Schindelin
c80b335624 t4124: avoid using "normal" diff mode
Everybody and their dogs, cats and other pets settled on using unified
diffs. It is a really quaint holdover from a long-gone era that GNU diff
outputs "normal" diff by default.

Yet, t4124 relied on that mode.

This mode is so out of fashion in the meantime, though, that e.g.
BusyBox' diff decided not even to bother to support it. It only supports
unified diffs.

So let's just switch away from "normal" diffs and use unified diffs, as
we really are only interested in the `+` lines.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:10 +02:00
Johannes Schindelin
9ed7d597e5 t1300: mark all test cases with funny filenames as !MINGW
On Windows, it is impossible to create a file whose name contains a
quote character. We already excluded test cases using such files from
running on Windows when git.exe itself was tested.

However, we still had two test cases that try to create such a file, and
redirect stdin from such a file, respectively. This *seems* to work in
Git for Windows' Bash due to an obscure feature inherited from Cygwin:
illegal filename characters are simply mapped into/from a private UTF-8
page. Pure Win32 programs (such as git.exe) *still* cannot work with
those files, of course, but at least Unix shell scripts pretend to be
able to.

This entire strategy breaks down when switching to any Unix shell
lacking support for that private UTF-8 page trick, e.g. BusyBox-w32's
ash. So let's just exclude test cases that test whether the Unix shell
can redirect to/from files with "funny names" those from running on
Windows, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:10 +02:00
Johannes Schindelin
b8ac8bed8c t0021: use Windows path when appropriate
Since c6b0831c9c (docs: warn about possible '=' in clean/smudge filter
process values, 2016-12-03), t0021 writes out a file with quotes in its
name, and MSYS2's path conversion heuristics mistakes that to mean that
we are not talking about a path here.

Therefore, we need to use Windows paths, as the test-helper is a Win32
program that would otherwise have no idea where to look for the file.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:10 +02:00
Johannes Schindelin
e8fbc36a38 test-lib: add BUSYBOX prerequisite
When running with BusyBox, we will want to avoid calling executables on
the PATH that are implemented in BusyBox itself.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:09 +02:00
Johannes Schindelin
49d5d91d09 tests (mingw): remove Bash-specific pwd option
The -W option is only understood by MSYS2 Bash's pwd command. We already
make sure to override `pwd` by `builtin pwd -W` for MINGW, so let's not
double the effort here.

This will also help when switching the shell to another one (such as
BusyBox' ash) whose pwd does *not* understand the -W option.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:09 +02:00
Johannes Schindelin
fa4b217964 mingw: only use Bash-ism builtin pwd -W when available
Traditionally, Git for Windows' SDK uses Bash as its default shell.
However, other Unix shells are available, too. Most notably, the Win32
port of BusyBox comes with `ash` whose `pwd` command already prints
Windows paths as Git for Windows wants them, while there is not even a
`builtin` command.

Therefore, let's be careful not to override `pwd` unless we know that
the `builtin` command is available.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:09 +02:00
Johannes Schindelin
dfe71b5333 tests: use the correct path separator with BusyBox
BusyBox-w32 is a true Win32 application, i.e. it does not come with a
POSIX emulation layer.

That also means that it does *not* use the Unix convention of separating
the entries in the PATH variable using colons, but semicolons.

However, there are also BusyBox ports to Windows which use a POSIX
emulation layer such as Cygwin's or MSYS2's runtime, i.e. using colons
as PATH separators.

As a tell-tale, let's use the presence of semicolons in the PATH
variable: on Unix, it is highly unlikely that it contains semicolons,
and on Windows (without POSIX emulation), it is virtually guaranteed, as
everybody should have both $SYSTEMROOT and $SYSTEMROOT/system32 in their
PATH.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:09 +02:00
Johannes Schindelin
e174838400 tests: only override sort & find if there are usable ones in /usr/bin/
The idea is to allow running the test suite on MinGit with BusyBox
installed in /mingw64/bin/sh.exe. In that case, we will want to exclude
sort & find (and other Unix utilities) from being bundled.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:09 +02:00
Johannes Schindelin
d628b48f41 tests: move test PNGs into t/diff-lib/
We already have a directory where we store files intended for use by
multiple test scripts. The same directory is a better home for the
test-binary-*.png files than t/.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:09 +02:00
Johannes Schindelin
7887d20660 tests: use t/diff-lib/* consistently
The idea of copying README and COPYING into t/diff-lib/ was to step away
from using files from outside t/ in tests. Let's really make sure that
we use the files from t/diff-lib/ instead of other versions of those
files.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:09 +02:00
Johannes Schindelin
10388d68f3 t/lib-gettext:test installed git-sh-i18n if GIT_TEST_INSTALLED is set
It makes very, very little sense to test the built git-sh-i18n when the
user asked specifically to test another one.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:09 +02:00
Johannes Schindelin
cce9fae662 tests: respect GIT_TEST_INSTALLED when initializing repositories
It really makes very, very little sense to use a different git
executable than the one the caller indicated via setting the environment
variable GIT_TEST_INSTALLED.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:08 +02:00
Johannes Schindelin
94f9ec14bd tests: do not require Git to be built when testing an installed Git
We really only need the test helpers in that case, but that is not what
we test for. So let's skip the test for now when we know that we want to
test an installed Git.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:08 +02:00
Johannes Schindelin
4b5c288b2e tests(mingw): if iconv is unavailable, use test-helper --iconv
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:08 +02:00
Johannes Schindelin
2e54d07657 test-tool: learn to act as a drop-in replacement for iconv
It is convenient to assume that everybody who wants to build & test Git
has access to a working `iconv` executable (after all, we already pretty
much require libiconv).

However, that limits esoteric test scenarios such as Git for Windows',
where an end user installation has to ship with `iconv` for the sole
purpose of being testable. That payload serves no other purpose.

So let's just have a test helper (to be able to test Git, the test
helpers have to be available, after all) to act as `iconv` replacement.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:08 +02:00
Johannes Schindelin
f7e4214f57 tests: replace mingw_test_cmp with a helper in C
This helper is slightly more performant than the script with MSYS2's
Bash. And a lot more readable.

To accommodate t1050, which wants to compare files weighing in with 3MB
(falling outside of t1050's malloc limit of 1.5MB), we simply lift the
allocation limit by setting the environment variable GIT_ALLOC_LIMIT to
zero when calling the helper.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:08 +02:00
Johannes Schindelin
bee26315e5 test-lib: avoid unnecessary Perl invocation
It is a bit strange, and even undesirable, to require Perl just to run
the test suite even when NO_PERL was set.

This patch does not fix this problem by any stretch of imagination.
However, it fixes *the* Perl invocation that *every single* test script
has to run.

While at it, it makes the source code also more grep'able, as the code
that unsets some, but not all, GIT_* environment variables just became a
*lot* more explicit. And all that while still reducing the total number
of lines.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:08 +02:00
Johannes Schindelin
4d8e5bac60 test-run-command: learn to run (parts of) the testsuite
Instead of relying on the presence of `make`, or `prove`, we might just
as well use our own facilities to run the test suite.

This helps e.g. when trying to verify a Git for Windows installation
without requiring to download a full Git for Windows SDK (which would use
up 600+ megabytes of bandwidth, and over a gigabyte of disk space).

Of course, it still requires the test helpers to be build *somewhere*,
and the Git version should at least roughly match the version from which
the test suite comes.

At the same time, this new way to run the test suite allows to validate
that a BusyBox-backed MinGit works as expected (verifying that BusyBox'
functionality is enough to at least pass the test suite).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-10-04 21:34:08 +02:00