Commit Graph

73547 Commits

Author SHA1 Message Date
Johannes Schindelin
426963508d Merge branch 'status-no-lock-index'
This branch allows third-party tools to call `git status
--no-lock-index` to avoid lock contention with the interactive Git usage
of the actual human user.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 11:19:52 +01:00
Johannes Schindelin
0790b79679 Merge pull request #797 from glhez/master
`git bundle create <bundle>` leaks handle the revlist is empty.
2017-03-25 11:19:50 +01:00
Johannes Schindelin
d3c7b49c98 Merge 'release-gc-repack' into HEAD 2017-03-25 11:19:48 +01:00
Johannes Schindelin
dfbd94740e Merge branch 'spawn-with-spaces'
This change lets us spawn .bat scripts whose paths contain spaces.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 11:19:46 +01:00
Jeff Hostetler
d394ab37d2 test-strcmp-offset: created test for strcmp_offset
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-03-25 11:19:45 +01:00
Jeff Hostetler
923d4632b4 read-cache: run verify_hdr() in background thread
This is a performance optimization.

Teach do_read_index() to call verify_hdr() using a thread
and allow SHA1 verification to run concurrently with the
parsing of index-entries and extensions.

For large index files, this cuts the startup time in half.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-03-25 11:19:45 +01:00
Johannes Schindelin
6d7fe7323a msvc: avoid debug assertion windows in Debug Mode
For regular debugging, it is pretty helpful when a debug assertion in a
running application triggers a window that offers to start the debugger.

However, when running the test suite, it is not so helpful, in
particular when the debug assertions are then suppressed anyway because
we disable the invalid parameter checking (via invalidcontinue.obj, see
the comment in config.mak.uname about that object for more information).

So let's simply disable that window in Debug Mode (it is already
disabled in Release Mode).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 11:19:45 +01:00
Jeff Hostetler
5240242450 read-cache: speed up add_index_entry during checkout
Teach add_index_entry_with_check() and has_dir_name()
to see if the path of the new item is greater than the
last path in the index array before attempting to search
for it.

This is a performance optimization.

During checkout, merge_working_tree() populates the new
index in sorted order, so this change saves at least 2
lookups per file.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
2017-03-25 11:19:45 +01:00
Johannes Schindelin
dbbcd531de Merge 'no-dashed-invocation' into HEAD 2017-03-25 11:19:42 +01:00
Johannes Schindelin
6aba8fdce1 Merge 'misc-vs-fixes' into HEAD 2017-03-25 11:19:39 +01:00
Johannes Schindelin
a1554cd06c msvc: add a Makefile target to pre-generate the VS solution
The entire idea of generating the VS solution makes only sense if we
generate it via Continuous Integration; otherwise potential users would
still have to download the entire Git for Windows SDK.

So let's just add a target in the Makefile that can be used to generate
said solution; The generated files will then be committed so that they
can be pushed to a branch ready to check out by Visual Studio users.

To make things even more useful, we also generate and commit other files
that are required to run the test suite, such as templates and
bin-wrappers: with this, developers can run the test suite in a regular
Git Bash (that is part of a regular Git for Windows installation) after
building the solution in Visual Studio.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 11:19:39 +01:00
Johannes Schindelin
dc5e334b26 msvc: fix make test without having to play PATH games
When building with Microsoft Visual C, we use NuGet to acquire the
dependencies (such as OpenSSL, cURL, etc). We even unpack those
dependencies.

This patch teaches the test suite to add the directory with the unpacked
.dll files to the PATH before running the tests.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 11:19:39 +01:00
Johannes Schindelin
282a307691 msvc: ignore incremental compile output
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 11:19:39 +01:00
Johannes Schindelin
c5e26ab658 msvc: ignore .dll files copied into the top-level directory
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 11:19:39 +01:00
Johannes Schindelin
221e875f54 msvc: tell Visual Studio where we expect NuGet packages to be unpacked
We already unpack the NuGet packages in a certain place, via
compat/vcbuild/Makefile. Let's let Visual Studio use the very same place.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 11:19:39 +01:00
Philip Oakley
8666e82499 msvc: add pragmas for common warnings
MSVC can be overzealous about some warnings. Disable them.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
2017-03-25 11:19:39 +01:00
Philip Oakley
d204e9e46a msvc: do not include inttypes.h
This file is not available in earlier MSVC versions, and it is not
necessary to include it with MSVC, anyway.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 11:19:38 +01:00
Philip Oakley
ce649003ef msvc: add No_SafeExceptionHandler option
Microsoft flipped the Windows Safe Exception Handling default
in VS2013 so that zlib became unacceptable to certain OS versions
(Vista and subsequent 32-bit OS's) without the addition of
the option -SAFESEH:NO.

Provide a switch to disable the Safe Exception Handler when required.

The option ImageHasSafeExceptionHandlers for VS2013 is not available in
earlier versions, so use the SAFESEH:NO linker flag. See
https://msdn.microsoft.com/en-us/library/9a89h429.aspx for
further details.

This has only had limited testing due to the lack of a suitable system.

Helped-by: Yue Lin Ho <b8732003@student.nsysu.edu.tw>
Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Johannes Schindelin
be77adffa9 Vcproj.pm: urlencode '<' and '>' when generating VC projects
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Johannes Schindelin
7ec28f5114 Vcproj.pm: do not configure VCWebServiceProxyGeneratorTool
It is not necessary, and Visual Studio 2015 no longer supports it, anyway.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Philip Oakley
d9dbb7e6a4 Vcproj.pm: provide more GUIDs
Needed for: test-config; t-dump-split-index; t-dump-untracked-cache;
t-fake-ssh; t-sha1-array; t-submodule-config.

Plus a few spares.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
2017-03-25 10:40:43 +01:00
Philip Oakley
e4b5b4b599 Vcproj.pm: list git.exe first to be startup project
Visual Studio takes the first listed application/library as the default
startup project [1].

Detect the 'git' project and place it the head of the apps list, rather
than the tail.

Export the apps list before libs list for both the projects and global
structures of the .sln file.

[1] http://stackoverflow.com/questions/1238553/
vs2008-where-is-the-startup-project-setting-stored-for-a-solution
    "In the solution file, there are a list of pseudo-XML "Project"
    entries. It turns out that whatever is the first one ends up as
    the Startup Project, unless it’s overridden in the suo file. Argh.
    I just rearranged the order in the file and it’s good."

    "just moving the pseudo-xml isn't enough. You also have to move the
    group of entries in the "GlobalSection(ProjectConfigurationPlatforms)
    = postSolution" group that has the GUID of the project you moved to
    the top. So there are two places to move lines."

Signed-off-by: Philip Oakley <philipoakley@iee.org>
2017-03-25 10:40:43 +01:00
Philip Oakley
12401fa5ec Vcproj.pm: remove duplicate GUID
Delete the duplicated GUID from the generation code for the Visual Studio
.sln project file.

The duplicate GUID tended to be allocated to test-svn-fe, which was then
ignored by Visual Studio / MSVC, and its omission from the build never
noticed.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Johannes Schindelin
f896e09d2a contrib/buildsystems: make 'Restore NuGet Packages' work in Visual Studio
Visual Studio has this very neat feature that you can get dependencies in
the form of NuGet packages, and even further: you can specify in a project
what NuGet packages it needs. These dependencies can then be fetched via
right-clicking the solution in the Solution Explorer and clicking the
"Restore NuGet Packages" entry.

This feature is so neat, in fact, that we want to support it in Git for
Windows. The idea is that we will be able to provide developers with a
checkout of the Git sources that can be built outside of the Git for
Windows SDK, using *only* Visual Studio.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Johannes Schindelin
94ab889c83 contrib/buildsystems: support modern Visual Studio project definitions
The .sln/.vcproj files were used to define projects up until Visual
Studio 2008, but starting with Visual Studio 2010 the project
definitions are stored in .sln/.vcxproj files (which can also be used
by the MSBuild system).

Let's just copy-edit the generator of the .vcproj files to a new
generator that produces .vcxproj files directly, without forcing Visual
Studio to upgrade the project definitions.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Johannes Schindelin
4f26f88ef9 contrib/buildsystems: handle options starting with a slash
With the recent changes to allow building with MSVC=1, we now pass the
/OPT:REF option to the compiler. This confuses the parser that wants to
turn the output of a dry run into project definitions for QMake and Visual
Studio:

	Unhandled link option @ line 213: /OPT:REF at [...]

Let's just extend the code that passes through options that start with a
dash, so that it passes through options that start with a slash, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Philip Oakley
33f6b8dc05 contrib/buildsystems: optionally capture the dry-run in a file
Add an option for capturing the output of the make dry-run used in
determining the msvc-build structure for easy debugging.

You can use the output of `--make-out <path>` in subsequent runs via the
`--in <path>` option.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Johannes Schindelin
db72fe9da1 contrib/buildsystems: handle libiconv, too
Git's test suite shows tons of breakages unless Git is compiled
*without* NO_ICONV. That means, in turn, that we need to generate
build definitions *with* libiconv, which in turn implies that we
have to handle the -liconv option properly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Johannes Schindelin
2f9704bf64 contrib/buildsystems: ignore irrelevant files in Generators/
The Generators/ directory can contain spurious files such as editors'
backup files. Even worse, there could be .swp files which are not even
valid Perl scripts.

Let's just ignore anything but .pm files in said directory.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Philip Oakley
b17a3f2a72 contrib/buildsystems: handle the curl library option
Upon seeing the '-lcurl' option, point to the libcurl.lib.

While there, fix the elsif indentation.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Philip Oakley
8583fcaff0 contrib/buildsystems: redirect errors of the dry run into a log file
Rather than swallowing the errors, it is better to have them in a file.

To make it obvious what this is about, use the file name
'msvc-build-makedryerrors.txt'.

Further, if the output is empty, simply delete that file. As we target
Git for Windows' SDK (which, unlike its predecessor msysGit, offers
Perl versions newer than 5.8), we can use the quite readable syntax
`if -f -z $ErrsFile` (available in Perl >=5.10).

Note that the file will contain the new values of the GIT_VERSION
and GITGUI_VERSION if they were generated by the make file. They
are omitted if the release is tagged and indentically defined in
their respective GIT_VERSION_GEN file DEF_VER variables.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Philip Oakley
c81ef25792 contrib/buildsystems: ignore gettext stuff
Git's build contains steps to handle internationalization. This caused
hiccups in the parser used to generate QMake/Visual Studio project files.

As those steps are irrelevant in this context, let's just ignore them.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Philip Oakley
4a1175f75b contrib/buildsystems: handle quoted spaces in filenames
The engine.pl script expects file names not to contain spaces. However,
paths with spaces are quite prevalent on Windows. Use shellwords() rather
than split() to parse them correctly.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:43 +01:00
Johannes Schindelin
cee4f21439 submodule: avoid dashed invocation
In the years-old effort to clean up the PATH a bit, we deprecated dashed
invocations.

But we did not hold ourselves to that. Until now.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:42 +01:00
Philip Oakley
046a1af47f contrib/buildsystems: fix misleading error message
The error message talked about a "lib option", but it clearly referred
to a link option.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:42 +01:00
Johannes Schindelin
c1ce1397e9 merge-one-file: avoid dashed invocation
The original idea of deprecating invocations of Git subcommands via
their dashed form was to be able to ship without having to hard-link
each and every builtin to its dashed form.

We need to follow this plan ourselves, by patching our very own scripts
accordingly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:42 +01:00
Johannes Schindelin
ebc74cd99c .gitignore: ignore Visual Studio's temporary/generated files
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:42 +01:00
Johannes Schindelin
71f3676c84 merge-octopus: avoid dashed invocation
A long time ago, in turn a long time after introducing builtins and
moving Git's scripts to libexec/git-core/, we deprecated the invocation
of dashed commands.

The merge-octopus script is a holdover from the time before that, as it
still tries to invoke a builtin by its dashed form. Let's just not.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:42 +01:00
Philip Oakley
6a6b6dac50 .gitignore: ignore library directories created by MSVC VS2008 buildsystem
Signed-off-by: Philip Oakley <philipoakley@iee.org>
2017-03-25 10:40:42 +01:00
Johannes Schindelin
bab3043b25 stash: avoid dashed invocation
The invocation of dashed Git commands was rightfully deprecated a long
time ago. We failed to heed that deprecation ourselves, but it is never
too late...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:42 +01:00
Philip Oakley
c0c23f2d70 .gitignore: improve MSVC ignore patterns
Add the Microsoft .manifest pattern, and correct the generic 'Debug'
and 'Release' directory patterns which were mechanically adjusted way
back in c591d5f (gitignore: root most patterns at the top-level directory,
2009-10-26) to allow multi-level projects within the Git suite.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
2017-03-25 10:40:42 +01:00
Johannes Schindelin
51587bd6cd rebase--merge: avoid dashed invocation
We deprecated the dashed invocations ages ago. Might just as well hold
ourselves to that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:42 +01:00
Johannes Schindelin
2a8140fb2f merge-resolve: avoid dashed call
We started deprecating the dashed form a long time ago, advertising the
fact that dashed invocations of Git commands are deprecated for several
major versions.

Yet we still used them ourselves.

With ashes on our heads, we now start to finally get rid of those calls.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:42 +01:00
Johannes Schindelin
3de9edd8b6 git: avoid calling aliased builtins via their dashed form
This is one of the few places where Git violates its own deprecation of
the dashed form. It is not necessary, either.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:42 +01:00
Jeff Hostetler
81989cff3e add: use preload-index and fscache for performance
Teach "add" to use preload-index and fscache features
to improve performance on very large repositories.

During an "add", a call is made to run_diff_files()
which calls check_remove() for each index-entry.  This
calls lstat().  On Windows, the fscache code intercepts
the lstat() calls and builds a private cache using the
FindFirst/FindNext routines, which are much faster.

Somewhat independent of this, is the preload-index code
which distributes some of the start-up costs across
multiple threads.

We need to keep the call to read_cache() before parsing the
pathspecs (and hence cannot use the pathspecs to limit any preload)
because parse_pathspec() is using the index to determine whether a
pathspec is, in fact, in a submodule. If we would not read the index
first, parse_pathspec() would not error out on a path that is inside
a submodule, and t7400-submodule-basic.sh would fail with

	not ok 47 - do not add files from a submodule

We still want the nice preload performance boost, though, so we simply
call read_cache_preload(&pathspecs) after parsing the pathspecs.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:41 +01:00
Johannes Schindelin
5a18234040 t5505,t5516: create .git/branches/ when needed
It is a real old anachronism from the Cogito days to have a
.git/branches/ directory. And to have tests that ensure that Cogito
users can migrate away from using that directory.

But so be it, let's continue testing it.

Let's make sure, however, that git init does not need to create that
directory.

This bug was noticed when testing with templates that had been
pre-committed, skipping the empty branches/ directory of course because
Git does not track empty directories.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:41 +01:00
Johannes Schindelin
57a7c91d5d Export the preload_index() function
The purpose of this function is to stat() the files listed in the index
in a multi-threaded fashion. It is called directly after reading the
index in the read_index_preloaded() function.

However, in some cases we may want to separate the index reading from
the preloading step, e.g. in builtin/add.c, where we need to load the
index before we parse the pathspecs (which needs to error out if one of
the pathspecs refers to a path within a submodule, for which the index
must have been read already), and only then will we want to preload,
possibly limited by the just-parsed pathspecs.

So let's just export that function to allow calling it separately.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:41 +01:00
Johannes Schindelin
735255f47a windows: clarify the need for invalidcontinue.obj
Git's source code wants to be able to close() the same file descriptor
multiple times, ignoring the error returned by the second call (and the
ones after that), or to access the osfhandle of an already-closed stdout,
among other things that the UCRT does not like.

Simply linking invalidcontinue.obj allows such usage without resorting to
Debug Assertions (or exiting with exit code 9 in Release Mode).

Let's add a note so we don't forget, as suggested by Jeff Hostetler.

See https://msdn.microsoft.com/en-us/library/ms235330.aspx for more
details.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:41 +01:00
Johannes Schindelin
c8dde6714f .gitattributes: fix end-of-lines
The test suite does actually not pass when files are checked out with
CR/LF line endings, so we have to force them to LF-only.

For good measure, we simply force all source files to LF, also to make
it easier for Git for Windows contributors to contribute to upstream
Git's source code.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:41 +01:00
Johannes Schindelin
f6081edde9 Ensure that bin-wrappers/* targets adds .exe if necessary
When compiling with Visual Studio, the projects' names are identical to
the executables modulo the extensions. Which means that the bin-wrappers
*need* to target the .exe files lest they try to execute directories.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-03-25 10:40:41 +01:00