Commit Graph

94153 Commits

Author SHA1 Message Date
Johannes Schindelin
02451caa3c fixup! Add a build definition for Azure DevOps
We do not need build-extra. So let's not clone it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-01-15 19:47:58 +01:00
Johannes Schindelin
6934fe7046 fixup! Add a build definition for Azure DevOps
Some improvements (suggested via review on the Git mailing list) have
not been incorporated into Git for Windows' `master` yet, other changes
were left-overs from debugging that need reverting.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-01-15 19:47:18 +01:00
Johannes Schindelin
760ff732cb fixup! Add a build definition for Azure DevOps
Let's use the new YAML schema. See
https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-01-15 19:47:18 +01:00
Johannes Schindelin
e1a2142157 fixup! Add a build definition for Azure DevOps
Remove a trailing empty line.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-01-15 19:47:18 +01:00
Johannes Schindelin
ca997ef3e9 fixup! Add a build definition for Azure DevOps
At some point we switched from Hosted Linux Preview to Ubuntu 16.04, at
which point it became unnecessary to install the `docker` package for
the Linux-32 job.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-01-15 19:47:18 +01:00
Johannes Schindelin
a2379f7031 fixup! Add a build definition for Azure DevOps
For some reason, the indentation of the PowerShell tasks got all messed
up. Fix that.

While at it, do not define `c()` for only one user, and do not
initialize `/etc/passwd` (it does not seem to have a noticeable effect).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-01-15 19:46:29 +01:00
Johannes Schindelin
82d81f2a8b fixup! ci/lib.sh: add support for Azure Pipelines
TASKDEFINITIONSURI is not set in parallel tasks... And COLLECTIONURI is
not set in the Linux32 job...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-01-15 19:30:54 +01:00
Johannes Schindelin
6b286585b1 Merge pull request #2008 from kraai/2006
Initialize rev before using &rev.pending
2019-01-09 12:37:19 +01:00
Matthew Kraai
8149e4f8d5 Initialize rev before using &rev.pending
If reset_tree returns a non-zero value, stash_working_tree calls
object_array_clear with &rev.pending before rev is initialized.  This
causes a segmentation fault.  Prevent this by initializing rev before
calling reset_tree.

This fixes #2006.

Signed-off-by: Matthew Kraai <mkraai@its.jnj.com>
2019-01-04 13:06:09 -08:00
Johannes Schindelin
7b95654d1c Merge pull request #1992 from orgads/rebase-post-checkout-hook
Rebase: Run post-checkout hook on checkout
2018-12-21 12:57:57 +01:00
Orgad Shaneh
93f54842f5 Rebase: Run post-checkout hook on checkout
Signed-off-by: Orgad Shaneh <orgads@gmail.com>
2018-12-20 23:59:14 +02:00
Orgad Shaneh
cd63940eff t5403: Refactor
* Replace multiple clones and commits by test_commits.
* Replace 3 invocations of awk by read.

Signed-off-by: Orgad Shaneh <orgads@gmail.com>
2018-12-20 23:57:34 +02:00
Johannes Schindelin
7c9fbc07db Merge pull request #1983 from dscho/builtin-rebase-perf-fix
Fix a performance regression in the built-in rebase
2018-12-15 08:39:44 +01:00
Johannes Schindelin
046627e31e Merge pull request #1977 from derrickstolee/test-oid-fix-windows
.gitattributes: ensure t/oid-info/* has eol=lf
2018-12-15 08:39:14 +01:00
Johannes Schindelin
27472d158c rebase: teach reset_head() to optionally skip the worktree
This is what the legacy (scripted) rebase does in
`move_to_original_branch`, and we will need this functionality in the
next commit.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-12-15 08:39:14 +01:00
Johannes Schindelin
51c65a24a7 Merge pull request #1968 from dscho/http-version
http: add support selecting http version
2018-12-15 08:39:14 +01:00
Derrick Stolee
903d0ee67a .gitattributes: ensure t/oid-info/* has eol=lf
The new test_oid machinery in the test library requires reading
some information from t/oid-info/hash-info and t/oid-info/oid.
The shell logic that reads from these files is sensitive to CRLF
line endings, causing a failure when the test suite is run on a
Windows machine that converts LF to CRLF: the test suite fails
with a "bad hash algorithm" message, but does not record any
failed test cases. This caused CI builds to pass because they
fail only after reporting the failed test cases.

Exclude the files in this folder from this conversion.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
2018-12-15 08:38:35 +01:00
Johannes Schindelin
34e7f82b00 Merge pull request #1958 from dscho/ansi-unicode
mingw: safeguard against compiling with `-DUNICODE`
2018-12-15 08:38:35 +01:00
Force Charlie
5fae6128e5 http: add support selecting http version
Usually we don't need to set libcurl to choose which version of the
HTTP protocol to use to communicate with a server.
But different versions of libcurl, the default value is not the same.

CURL >= 7.62.0: CURL_HTTP_VERSION_2TLS
CURL < 7.62: CURL_HTTP_VERSION_1_1

In order to give users the freedom to control the HTTP version,
we need to add a setting to choose which HTTP version to use.

Signed-off-by: Force Charlie <charlieio@outlook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-12-15 08:38:35 +01:00
Johannes Schindelin
07bb682344 mingw: use ANSI or Unicode functions explicitly
For many Win32 functions, there actually exist two variants: one with
the `A` suffix that takes ANSI parameters (`char *` or `const char *`)
and one with the `W` suffix that takes Unicode parameters (`wchar_t *`
or `const wchar_t *`).

Let's be precise what we want to use.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-12-15 08:38:35 +01:00
Johannes Schindelin
a270bfdb06 Merge pull request #1937 from benpeart/fscache-NtQueryDirectoryFile-gfw
fscache: teach fscache to use NtQueryDirectoryFile
2018-12-15 08:38:34 +01:00
Johannes Schindelin
1bcb5c4544 Merge pull request #1934 from benpeart/fscache-thread-safe-enable-gfw
fscache: make fscache_enable() thread safe
2018-12-15 08:38:34 +01:00
Ben Peart
3f5fcb4e6f fscache: teach fscache to use NtQueryDirectoryFile
Using FindFirstFileExW() requires the OS to allocate a 64K buffer for each
directory and then free it when we call FindClose().  Update fscache to call
the underlying kernel API NtQueryDirectoryFile so that we can do the buffer
management ourselves.  That allows us to allocate a single buffer for the
lifetime of the cache and reuse it for each directory.

This change improves performance of 'git status' by 18% in a repo with ~200K
files and 30k folders.

Documentation for NtQueryDirectoryFile can be found at:

https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntifs/nf-ntifs-ntquerydirectoryfile
https://docs.microsoft.com/en-us/windows/desktop/FileIO/file-attribute-constants
https://docs.microsoft.com/en-us/windows/desktop/fileio/reparse-point-tags

To determine if the specified directory is a symbolic link, inspect the
FileAttributes member to see if the FILE_ATTRIBUTE_REPARSE_POINT flag is
set. If so, EaSize will contain the reparse tag (this is a so far
undocumented feature, but confirmed by the NTFS developers). To
determine if the reparse point is a symbolic link (and not some other
form of reparse point), test whether the tag value equals the value
IO_REPARSE_TAG_SYMLINK.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
2018-12-15 08:38:34 +01:00
Johannes Schindelin
dd4b6aa4b4 mingw: fix CPU reporting in git version --build-options
We cannot rely on `uname -m` in Git for Windows' SDK to tell us what
architecture we are compiling for, as we can compile both 32-bit and
64-bit `git.exe` from a 64-bit SDK, but the `uname -m` in that SDK will
always report `x86_64`.

So let's go back to our original design. And make it explicitly
Windows-specific.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-12-15 08:38:34 +01:00
Johannes Schindelin
e0e7c37b31 Merge pull request #1900 from tanushree27/remove-ipv6-fallback
[Outreachy] Removed ipv6 fallback
2018-12-15 08:38:34 +01:00
Johannes Schindelin
13a21014ef Merge pull request #1915 from dscho/open-in-gdb
Add a helper function to start GDB that was already attached to the current process
2018-12-15 08:38:34 +01:00
Ben Peart
903281dc49 fscache: make fscache_enable() thread safe
The recent change to make fscache thread specific relied on fscache_enable()
being called first from the primary thread before being called in parallel
from worker threads.  Make that more robust and protect it with a critical
section to avoid any issues.

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Ben Peart <benpeart@microsoft.com>
2018-12-15 08:38:33 +01:00
tanushree27
2899a999b3 mingw: remove obsolete IPv6-related code
To support IPv6, Git provided fall back functions for Windows versions that
did not support IPv6. However, as Git dropped support for Windows XP and
prior, those functions are not needed anymore.

Removed those fallbacks by reverting commit[1] and using the functions
directly (without 'ipv6_' prefix).

[1] fe3b2b7b82.

Signed-off-by: tanushree27 <tanushreetumane@gmail.com>
2018-12-15 08:38:33 +01:00
Johannes Schindelin
d9a208b14e Merge remote-tracking branch 'benpeart/fscache-per-thread-gfw'
This brings substantial wins in performance because the FSCache is now
per-thread, being merged to the primary thread only at the end, so we do
not have to lock (except while merging).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-12-15 08:38:33 +01:00
Johannes Schindelin
cf03c86a0d mingw: add a helper function to attach GDB to the current process
When debugging Git, the criss-cross spawning of processes can make
things quite a bit difficult, especially when a Unix shell script is
thrown in the mix that calls a `git.exe` that then segfaults.

To help debugging such things, we introduce the `open_in_gdb()` function
which can be called at a code location where the segfault happens (or as
close as one can get); This will open a new MinTTY window with a GDB
that already attached to the current process.

Inspired by Derrick Stolee.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-12-15 08:38:33 +01:00
Johannes Schindelin
80a78c50b5 Merge pull request #1910 from benpeart/fscache_statistics-gfw
fscache: add fscache hit statistics
2018-12-15 08:38:33 +01:00
Johannes Schindelin
21d1e5929f Merge pull request #1914 from benpeart/free-fscache-after-add-gfw
At the end of the add command, disable and free the fscache
2018-12-15 08:38:33 +01:00
Ben Peart
2e758dd8b0 fscache: teach fscache to use mempool
Now that the fscache is single threaded, take advantage of the mem_pool as
the allocator to significantly reduce the cost of allocations and frees.

With the reduced cost of free, in future patches, we can start freeing the
fscache at the end of commands instead of just leaking it.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
2018-12-15 08:38:32 +01:00
Johannes Schindelin
1d2aca066f Merge pull request #1911 from benpeart/git_test_fscache-gfw
fscache: add GIT_TEST_FSCACHE support
2018-12-15 08:38:32 +01:00
Ben Peart
f44eb5cc51 fscache: update fscache to be thread specific instead of global
The threading model for fscache has been to have a single, global cache.
This puts requirements on it to be thread safe so that callers like
preload-index can call it from multiple threads.  This was implemented
with a single mutex and completion events which introduces contention
between the calling threads.

Simplify the threading model by making fscache thread specific.  This allows
us to remove the global mutex and synchronization events entirely and instead
associate a fscache with every thread that requests one. This works well with
the current multi-threading which divides the cache entries into blocks with
a separate thread processing each block.

At the end of each worker thread, if there is a fscache on the primary
thread, merge the cached results from the worker into the primary thread
cache. This enables us to reuse the cache later especially when scanning for
untracked files.

In testing, this reduced the time spent in preload_index() by about 25% and
also reduced the CPU utilization significantly.  On a repo with ~200K files,
it reduced overall status times by ~12%.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
2018-12-15 08:38:32 +01:00
Johannes Schindelin
860c66c50f Merge pull request #1909 from benpeart/free-fscache-after-status-gfw
status: disable and free fscache at the end of the status command
2018-12-15 08:38:32 +01:00
Ben Peart
f2c9c4c075 fscache: fscache takes an initial size
Update enable_fscache() to take an optional initial size parameter which is
used to initialize the hashmap so that it can avoid having to rehash as
additional entries are added.

Add a separate disable_fscache() macro to make the code clearer and easier
to read.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
2018-12-15 08:38:32 +01:00
Johannes Schindelin
590dab86df Merge pull request #1908 from benpeart/FindFirstFileEx-gfw
fscache: use FindFirstFileExW to avoid retrieving the short name
2018-12-15 08:38:32 +01:00
Ben Peart
b87c51e6ee mem_pool: add GIT_TRACE_MEMPOOL support
Add tracing around initializing and discarding mempools. In discard report
on the amount of memory unused in the current block to help tune setting
the initial_size.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
2018-12-15 08:38:32 +01:00
Ben Peart
4be676e6db fscache: add fscache hit statistics
Track fscache hits and misses for lstat and opendir requests.  Reporting of
statistics is done when the cache is disabled for the last time and freed
and is only reported if GIT_TRACE_FSCACHE is set.

Sample output is:

11:33:11.836428 compat/win32/fscache.c:433 fscache: lstat 3775, opendir 263, total requests/misses 4052/269

Signed-off-by: Ben Peart <benpeart@microsoft.com>
2018-12-15 08:38:31 +01:00
Ben Peart
6407923af0 At the end of the add command, disable and free the fscache so that we don't
leak the memory and so that we can dump the fscache statistics.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
2018-12-15 08:38:31 +01:00
Ben Peart
3cb93647bd fscache: add GIT_TEST_FSCACHE support
Add support to fscache to enable running the entire test suite with the
fscache enabled.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
2018-12-15 08:38:31 +01:00
Ben Peart
48275d6c21 status: disable and free fscache at the end of the status command
At the end of the status command, disable and free the fscache so that we
don't leak the memory and so that we can dump the fscache statistics.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
2018-12-15 08:38:31 +01:00
Johannes Schindelin
5d6c7c99fd Merge pull request #1859 from dscho/funny-cased-cwd
Fix t0001 when the current working directory differs in case from the canonical form
2018-12-15 08:38:31 +01:00
Ben Peart
ba27e635aa fscache: use FindFirstFileExW to avoid retrieving the short name
Use FindFirstFileExW with FindExInfoBasic to avoid forcing NTFS to look up
the short name.  Also switch to a larger (64K vs 4K) buffer using
FIND_FIRST_EX_LARGE_FETCH to minimize round trips to the kernel.

In a repo with ~200K files, this drops warm cache status times from 3.19
seconds to 2.67 seconds for a 16% savings.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
2018-12-15 08:38:31 +01:00
Jameson Miller
1a331ddd67 Merge 'builtin-stash-rebase-v3'
To avoid having to play tricks as in earlier rounds, we bit the sour
apple and rebased the `builtin-stash-rebase-v3` branch thicket onto the
commit starting Git for Windows' merging-rebase.

(The merging-rebase pulls in the previous branch thicket via a "fake
merge", i.e. a merge commit that does not actually apply any changes
from the merged commit history. This has the unfortunate side effect of
confusing `merge` into thinking that any branch that was merged into an
earlier round does not need to be merged again.)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-12-15 08:38:31 +01:00
Johannes Schindelin
604c5228fb Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-12-15 08:38:30 +01:00
Johannes Schindelin
554d38513e Merge branch 'fix-terminal-prompt'
This fixes the issue identified in

	https://github.com/git-for-windows/git/issues/1498

where Git would not fall back to reading credentials from a Win32
Console when the credentials could not be read from the terminal via the
Bash hack (that is necessary to support running in a MinTTY).

Tested in a Powershell window.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-12-15 08:38:30 +01:00
Johannes Schindelin
af209cf202 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-12-15 08:38:30 +01:00
Johannes Schindelin
c9856690ed Merge branch 'inherit-only-stdhandles'
When spawning child processes, we do want them to inherit the standard
handles so that we can talk to them. We do *not* want them to inherit
any other handle, as that would hold a lock to the respective files
(preventing them from being renamed, modified or deleted), and the child
process would not know how to access that handle anyway.

Happily, there is an API to make that happen. It is supported in Windows
Vista and later, which is exactly what we promise to support in Git for
Windows for the time being.

This also means that we lift, at long last, the target Windows version
from Windows XP to Windows Vista.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-12-15 08:38:29 +01:00