Commit Graph

91647 Commits

Author SHA1 Message Date
Paul-Sebastian Ungureanu
ddda3fa643 stash: make push -q quiet
There is a change in behaviour with this commit. When there was
no initial commit, the shell version of stash would still display
a message. This commit makes `push` to not display any message if
`--quiet` or `-q` is specified. Add tests for `--quiet`.

Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:24 +01:00
Paul-Sebastian Ungureanu
840f9c860d stash: convert push to builtin
Add stash push to the helper.

Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:24 +01:00
Paul-Sebastian Ungureanu
8727fa59ff stash: convert create to builtin
Add stash create to the helper.

Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:24 +01:00
Paul-Sebastian Ungureanu
0a37a65e0b stash: convert store to builtin
Add stash store to the helper and delete the store_stash function
from the shell script.

Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:24 +01:00
Paul-Sebastian Ungureanu
4a300aacc7 stash: convert show to builtin
Add stash show to the helper and delete the show_stash, have_stash,
assert_stash_like, is_stash_like and parse_flags_and_rev functions
from the shell script now that they are no longer needed.

In shell version, although `git stash show` accepts `--index` and
`--quiet` options, it ignores them. In C, both options are passed
further to `git diff`.

Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:24 +01:00
Paul-Sebastian Ungureanu
ea21f532d2 stash: convert list to builtin
Add stash list to the helper and delete the list_stash function
from the shell script.

Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:24 +01:00
Joel Teichroeb
97ab38731e stash: convert pop to builtin
Add stash pop to the helper and delete the pop_stash, drop_stash,
assert_stash_ref functions from the shell script now that they
are no longer needed.

Signed-off-by: Joel Teichroeb <joel@teichroeb.net>
Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:23 +01:00
Joel Teichroeb
f05f3b4039 stash: convert branch to builtin
Add stash branch to the helper and delete the apply_to_branch
function from the shell script.

Checkout does not currently provide a function for checking out
a branch as cmd_checkout does a large amount of sanity checks
first that we require here.

Signed-off-by: Joel Teichroeb <joel@teichroeb.net>
Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:23 +01:00
Joel Teichroeb
bc6ffe0c96 stash: convert drop and clear to builtin
Add the drop and clear commands to the builtin helper. These two
are each simple, but are being added together as they are quite
related.

We have to unfortunately keep the drop and clear functions in the
shell script as functions are called with parameters internally
that are not valid when the commands are called externally. Once
pop is converted they can both be removed.

Signed-off-by: Joel Teichroeb <joel@teichroeb.net>
Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:23 +01:00
Joel Teichroeb
b327bab024 stash: convert apply to builtin
Add a builtin helper for performing stash commands. Converting
all at once proved hard to review, so starting with just apply
lets conversion get started without the other commands being
finished.

The helper is being implemented as a drop in replacement for
stash so that when it is complete it can simply be renamed and
the shell script deleted.

Delete the contents of the apply_stash shell function and replace
it with a call to stash--helper apply until pop is also
converted.

Signed-off-by: Joel Teichroeb <joel@teichroeb.net>
Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:23 +01:00
Paul-Sebastian Ungureanu
73d1d7bc3b stash: mention options in show synopsis
Mention in the documentation, that `show` accepts any
option known to `git diff`.

Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:23 +01:00
Paul-Sebastian Ungureanu
24adde79ac stash: add tests for git stash show config
This commit introduces tests for `git stash show`
config. It tests all the cases where `stash.showStat`
and `stash.showPatch` are unset or set to true / false.

Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:23 +01:00
Paul-Sebastian Ungureanu
8c9c44d2d8 stash: rename test cases to be more descriptive
Rename some test cases' labels to be more descriptive and under 80
characters per line.

Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:23 +01:00
Paul-Sebastian Ungureanu
083039e2b3 t3903: modernize style
Remove whitespaces after redirection operators and wrap
long lines.

Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 11:33:13 +01:00
Joel Teichroeb
c0fda17a0e stash: improve option parsing test coverage
In preparation for converting the stash command incrementally to
a builtin command, this patch improves test coverage of the option
parsing. Both for having too many parameters, or too few.

Signed-off-by: Joel Teichroeb <joel@teichroeb.net>
Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 10:20:37 +01:00
Paul-Sebastian Ungureanu
48359d77e1 strbuf.c: add strbuf_join_argv()
Implement `strbuf_join_argv()` to join arguments
into a strbuf.

Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 10:20:37 +01:00
Paul-Sebastian Ungureanu
5cc732817a sha1-name.c: add get_oidf() which acts like get_oid()
Compared to `get_oid()`, `get_oidf()` has as parameters
a pointer to `object_id`, a printf format string and
additional arguments. This will help simplify the code
in subsequent commits.

Original-idea-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
2018-11-20 10:20:36 +01:00
Johannes Schindelin
506a9a15cc Start the merging-rebase to v2.20.0-rc0
This commit starts the rebase of 1085d510a6 to 9524587d9b
2018-11-20 09:23:53 +01:00
Johannes Schindelin
114a662e1c Merge pull request #1900 from tanushree27/remove-ipv6-fallback
[Outreachy] Removed ipv6 fallback
2018-11-19 23:30:19 +01:00
Johannes Schindelin
e6246af5a2 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-11-19 23:30:19 +01:00
tanushree27
8f9735fff6 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-11-19 23:30:18 +01:00
Johannes Schindelin
04d486597f 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-11-19 23:30:18 +01:00
Johannes Schindelin
b41e88f4bf 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-11-19 23:30:18 +01:00
Johannes Schindelin
438314bc47 Merge pull request #1910 from benpeart/fscache_statistics-gfw
fscache: add fscache hit statistics
2018-11-19 23:30:18 +01:00
Johannes Schindelin
1b4e427404 Merge pull request #1914 from benpeart/free-fscache-after-add-gfw
At the end of the add command, disable and free the fscache
2018-11-19 23:30:17 +01:00
Johannes Schindelin
c01f644ff2 Merge pull request #1911 from benpeart/git_test_fscache-gfw
fscache: add GIT_TEST_FSCACHE support
2018-11-19 23:30:17 +01:00
Johannes Schindelin
f5fd79cb6e Merge pull request #1909 from benpeart/free-fscache-after-status-gfw
status: disable and free fscache at the end of the status command
2018-11-19 23:30:17 +01:00
Ben Peart
1c2f6c80a7 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-11-19 23:30:16 +01:00
Ben Peart
a1297bedc9 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-11-19 23:30:16 +01:00
Johannes Schindelin
ecebea38c9 Merge pull request #1908 from benpeart/FindFirstFileEx-gfw
fscache: use FindFirstFileExW to avoid retrieving the short name
2018-11-19 23:30:16 +01:00
Ben Peart
f1bf098296 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-11-19 23:30:16 +01:00
Ben Peart
be35dedc84 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-11-19 23:30:16 +01:00
Ben Peart
d569fecba1 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-11-19 23:30:16 +01:00
Ben Peart
20468043a7 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-11-19 23:30:15 +01:00
Ben Peart
1ca73e363c 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-11-19 23:30:15 +01:00
Ben Peart
a4427c4772 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-11-19 23:30:15 +01:00
Johannes Schindelin
5e1c85e754 Merge pull request #1859 from dscho/funny-cased-cwd
Fix t0001 when the current working directory differs in case from the canonical form
2018-11-19 23:30:15 +01:00
Ben Peart
33609ae3aa 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-11-19 23:30:15 +01:00
Jameson Miller
0c1b367ebf 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-11-19 23:30:14 +01:00
Johannes Schindelin
440ed260d4 Merge 'readme' into HEAD
Add a README.md for GitHub goodness.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 23:30:14 +01:00
Johannes Schindelin
0484017324 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-11-19 23:30:13 +01:00
Johannes Schindelin
f845097ee7 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-11-19 23:30:13 +01:00
Johannes Schindelin
2be715441f 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-11-19 23:30:12 +01:00
Johannes Schindelin
799cd5567f Merge pull request #1170 from dscho/mingw-kill-process
Handle Ctrl+C in Git Bash nicely

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 23:30:12 +01:00
Johannes Schindelin
26ef5f5919 Merge branch 'fsync-object-files-always'
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 23:30:12 +01:00
Johannes Schindelin
02d7a7f2c5 Merge pull request #1354 from dscho/phase-out-show-ignored-directory-gracefully
Phase out `--show-ignored-directory` gracefully
2018-11-19 23:30:11 +01:00
Johannes Schindelin
3a27c599e6 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>
2018-11-19 23:30:11 +01:00
Johannes Schindelin
545c98d3b7 Merge 'docker-volumes-are-no-symlinks'
This was pull request #1645 from ZCube/master

Support windows container.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 23:30:11 +01:00
Johannes Schindelin
9819dda076 Merge pull request #1827 from benpeart/fscache_refresh_index
Enable the filesystem cache (fscache) in refresh_index().
2018-11-19 23:30:10 +01:00
Johannes Schindelin
4cb277498d Merge pull request #1468 from atetubou/fscache_checkout_flush
checkout.c: enable fscache for checkout again

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2018-11-19 23:30:10 +01:00